121
121
'Define live migration behavior')
122
122
flags.DEFINE_string('qemu_img', 'qemu-img',
123
123
'binary to use for qemu-img commands')
124
flags.DEFINE_bool('start_guests_on_host_boot', False,
125
'Whether to restart guests when the host reboots')
126
124
flags.DEFINE_string('libvirt_vif_type', 'bridge',
127
125
'Type of VIF to create.')
128
126
flags.DEFINE_string('libvirt_vif_driver',
173
171
self.vif_driver = utils.import_object(FLAGS.libvirt_vif_driver)
175
173
def init_host(self, host):
176
# Adopt existing VM's running here
177
ctxt = nova_context.get_admin_context()
178
for instance in db.instance_get_all_by_host(ctxt, host):
180
LOG.debug(_('Checking state of %s'), instance['name'])
181
state = self.get_info(instance['name'])['state']
182
except exception.NotFound:
183
state = power_state.SHUTOFF
185
LOG.debug(_('Current state of %(name)s was %(state)s.'),
186
{'name': instance['name'], 'state': state})
187
db.instance_set_state(ctxt, instance['id'], state)
189
# NOTE(justinsb): We no longer delete SHUTOFF instances,
190
# the user may want to power them back on
192
if state != power_state.RUNNING:
194
self.firewall_driver.setup_basic_filtering(instance)
195
self.firewall_driver.prepare_instance_filter(instance)
196
self.firewall_driver.apply_instance_filter(instance)
174
# NOTE(nsokolov): moved instance restarting to ComputeManager
198
177
def _get_connection(self):
199
178
if not self._wrapped_conn or not self._test_connection():
604
583
LOG.debug(_("instance %s: is running"), instance['name'])
605
584
self.firewall_driver.apply_instance_filter(instance)
607
if FLAGS.start_guests_on_host_boot:
608
LOG.debug(_("instance %s: setting autostart ON") %
610
domain.setAutostart(1)
612
586
def _wait_for_boot():
613
587
"""Called at an interval until the VM is running."""
614
588
instance_name = instance['name']