diff options
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/driver.py | 9 | ||||
| -rw-r--r-- | nova/virt/fake.py | 9 | ||||
| -rw-r--r-- | nova/virt/hyperv/driver.py | 6 | ||||
| -rw-r--r-- | nova/virt/libvirt/driver.py | 31 | ||||
| -rw-r--r-- | nova/virt/xenapi/driver.py | 9 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 3 |
6 files changed, 47 insertions, 20 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 1d8f94e9d..41df132fc 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -242,7 +242,8 @@ class ComputeDriver(object): raise NotImplementedError() def migrate_disk_and_power_off(self, context, instance, dest, - instance_type, network_info): + instance_type, network_info, + block_device_info=None): """ Transfers the disk of a running instance in multiple phases, turning off the instance before the end. @@ -261,7 +262,8 @@ class ComputeDriver(object): raise NotImplementedError() def finish_migration(self, context, migration, instance, disk_info, - network_info, image_meta, resize_instance): + network_info, image_meta, resize_instance, + block_device_info=None): """Completes a resize, turning on the migrated instance :param network_info: @@ -277,7 +279,8 @@ class ComputeDriver(object): # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() - def finish_revert_migration(self, instance, network_info): + def finish_revert_migration(self, instance, network_info, + block_device_info=None): """Finish reverting a resize, powering back on the instance""" # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() diff --git a/nova/virt/fake.py b/nova/virt/fake.py index db7f3a6ff..48ee67d5b 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -124,10 +124,12 @@ class FakeDriver(driver.ComputeDriver): pass def migrate_disk_and_power_off(self, context, instance, dest, - instance_type, network_info): + instance_type, network_info, + block_device_info=None): pass - def finish_revert_migration(self, instance, network_info): + def finish_revert_migration(self, instance, network_info, + block_device_info=None): pass def power_off(self, instance): @@ -252,7 +254,8 @@ class FakeDriver(driver.ComputeDriver): return def finish_migration(self, context, migration, instance, disk_info, - network_info, image_meta, resize_instance): + network_info, image_meta, resize_instance, + block_device_info=None): return def confirm_migration(self, migration, instance, network_info): diff --git a/nova/virt/hyperv/driver.py b/nova/virt/hyperv/driver.py index f385640f5..539794e48 100644 --- a/nova/virt/hyperv/driver.py +++ b/nova/virt/hyperv/driver.py @@ -207,12 +207,14 @@ class HyperVDriver(driver.ComputeDriver): """Confirms a resize, destroying the source VM""" LOG.debug(_("confirm_migration called"), instance=instance) - def finish_revert_migration(self, instance, network_info): + def finish_revert_migration(self, instance, network_info, + block_device_info=None): """Finish reverting a resize, powering back on the instance""" LOG.debug(_("finish_revert_migration called"), instance=instance) def finish_migration(self, context, migration, instance, disk_info, - network_info, image_meta, resize_instance=False): + network_info, image_meta, resize_instance=False, + block_device_info=None): """Completes a resize, turning on the migrated instance""" LOG.debug(_("finish_migration called"), instance=instance) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index daa0840b6..41bbd2d22 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2765,7 +2765,8 @@ class LibvirtDriver(driver.ComputeDriver): @exception.wrap_exception() def migrate_disk_and_power_off(self, context, instance, dest, - instance_type, network_info): + instance_type, network_info, + block_device_info=None): LOG.debug(_("Starting migrate_disk_and_power_off"), instance=instance) disk_info_text = self.get_instance_disk_info(instance['name']) @@ -2773,6 +2774,15 @@ class LibvirtDriver(driver.ComputeDriver): self.power_off(instance) + block_device_mapping = driver.block_device_info_get_mapping( + block_device_info) + for vol in block_device_mapping: + connection_info = vol['connection_info'] + mount_device = vol['mount_device'].rpartition("/")[2] + self.volume_driver_method('disconnect_volume', + connection_info, + mount_device) + # copy disks to destination # rename instance dir to +_resize at first for using # shared storage for instance dir (eg. NFS). @@ -2826,7 +2836,8 @@ class LibvirtDriver(driver.ComputeDriver): @exception.wrap_exception() def finish_migration(self, context, migration, instance, disk_info, - network_info, image_meta, resize_instance): + network_info, image_meta, resize_instance, + block_device_info=None): LOG.debug(_("Starting finish_migration"), instance=instance) # resize disks. only "disk" and "disk.local" are necessary. @@ -2863,18 +2874,21 @@ class LibvirtDriver(driver.ComputeDriver): '-O', 'qcow2', info['path'], path_qcow) utils.execute('mv', path_qcow, info['path']) - xml = self.to_xml(instance, network_info) + xml = self.to_xml(instance, network_info, + block_device_info=block_device_info) # assume _create_image do nothing if a target file exists. # TODO(oda): injecting files is not necessary self._create_image(context, instance, xml, network_info=network_info, block_device_info=None) - self._create_domain_and_network(xml, instance, network_info) + self._create_domain_and_network(xml, instance, network_info, + block_device_info) timer = utils.LoopingCall(self._wait_for_running, instance) timer.start(interval=0.5).wait() @exception.wrap_exception() - def finish_revert_migration(self, instance, network_info): + def finish_revert_migration(self, instance, network_info, + block_device_info=None): LOG.debug(_("Starting finish_revert_migration"), instance=instance) @@ -2882,9 +2896,10 @@ class LibvirtDriver(driver.ComputeDriver): inst_base_resize = inst_base + "_resize" utils.execute('mv', inst_base_resize, inst_base) - xml_path = os.path.join(inst_base, 'libvirt.xml') - xml = open(xml_path).read() - self._create_domain_and_network(xml, instance, network_info) + xml = self.to_xml(instance, network_info, + block_device_info=block_device_info) + self._create_domain_and_network(xml, instance, network_info, + block_device_info) timer = utils.LoopingCall(self._wait_for_running, instance) timer.start(interval=0.5).wait() diff --git a/nova/virt/xenapi/driver.py b/nova/virt/xenapi/driver.py index 09eba2489..3425c64f8 100644 --- a/nova/virt/xenapi/driver.py +++ b/nova/virt/xenapi/driver.py @@ -183,13 +183,15 @@ class XenAPIDriver(driver.ComputeDriver): # TODO(Vek): Need to pass context in for access to auth_token self._vmops.confirm_migration(migration, instance, network_info) - def finish_revert_migration(self, instance, network_info): + def finish_revert_migration(self, instance, network_info, + block_device_info=None): """Finish reverting a resize, powering back on the instance""" # NOTE(vish): Xen currently does not use network info. self._vmops.finish_revert_migration(instance) def finish_migration(self, context, migration, instance, disk_info, - network_info, image_meta, resize_instance=False): + network_info, image_meta, resize_instance=False, + block_device_info=None): """Completes a resize, turning on the migrated instance""" self._vmops.finish_migration(context, migration, instance, disk_info, network_info, image_meta, resize_instance) @@ -230,7 +232,8 @@ class XenAPIDriver(driver.ComputeDriver): self._vmops.unpause(instance) def migrate_disk_and_power_off(self, context, instance, dest, - instance_type, network_info): + instance_type, network_info, + block_device_info=None): """Transfers the VHD of a running instance to another host, then shuts off the instance copies over the COW disk""" # NOTE(vish): Xen currently does not use network info. diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index c76f9f425..d3cead640 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -189,7 +189,8 @@ class VMOps(object): self._start(instance, vm_ref) def finish_migration(self, context, migration, instance, disk_info, - network_info, image_meta, resize_instance): + network_info, image_meta, resize_instance, + block_device_info=None): root_vdi = vm_utils.move_disks(self._session, instance, disk_info) if resize_instance: |
