Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Partial stable/juno patch for LP #1392773
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 145e20a..12f0a05 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -4880,8 +4880,11 @@ class ComputeManager(manager.Manager):
is_volume_backed = self.compute_api.is_volume_backed_instance(ctxt,
instance)
dest_check_data['is_volume_backed'] = is_volume_backed
+ block_device_info = self._get_instance_block_device_info(
+ ctxt, instance, refresh_conn_info=True)
return self.driver.check_can_live_migrate_source(ctxt, instance,
- dest_check_data)
+ dest_check_data,
+ block_device_info)
@object_compat
@wrap_exception()
diff --git a/nova/virt/driver.py b/nova/virt/driver.py
index fd483e5..f71d799 100644
--- a/nova/virt/driver.py
+++ b/nova/virt/driver.py
@@ -808,7 +808,7 @@ class ComputeDriver(object):
raise NotImplementedError()
def check_can_live_migrate_source(self, context, instance,
- dest_check_data):
+ dest_check_data, block_device_info=None):
"""Check if it is possible to execute live migration.
This checks if the live migration can succeed, based on the
diff --git a/nova/virt/fake.py b/nova/virt/fake.py
index 049c519..fe9ff1c 100644
--- a/nova/virt/fake.py
+++ b/nova/virt/fake.py
@@ -426,7 +426,7 @@ class FakeDriver(driver.ComputeDriver):
return {}
def check_can_live_migrate_source(self, ctxt, instance_ref,
- dest_check_data):
+ dest_check_data, block_device_info=None):
return
def finish_migration(self, context, migration, instance, disk_info,
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 9b5b99a..6b79832 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -5017,7 +5017,7 @@ class LibvirtDriver(driver.ComputeDriver):
self._cleanup_shared_storage_test_file(filename)
def check_can_live_migrate_source(self, context, instance,
- dest_check_data):
+ dest_check_data, block_device_info=None):
"""Check if it is possible to execute live migration.
This checks if the live migration can succeed, based on the
@@ -5037,7 +5037,8 @@ class LibvirtDriver(driver.ComputeDriver):
dest_check_data['filename'])})
dest_check_data.update({'is_shared_block_storage':
- self._is_shared_block_storage(instance, dest_check_data)})
+ self._is_shared_block_storage(instance, dest_check_data,
+ block_device_info)})
if dest_check_data['block_migration']:
if (dest_check_data['is_shared_block_storage'] or
@@ -5064,7 +5065,8 @@ class LibvirtDriver(driver.ComputeDriver):
return dest_check_data
- def _is_shared_block_storage(self, instance, dest_check_data):
+ def _is_shared_block_storage(self, instance, dest_check_data,
+ block_device_info=None):
"""Check if all block storage of an instance can be shared
between source and destination of a live migration.
@@ -5078,6 +5080,7 @@ class LibvirtDriver(driver.ComputeDriver):
"""
if (CONF.libvirt.images_type == dest_check_data.get('image_type') and
self.image_backend.backend().is_shared_block_storage()):
+ # NOTE(dgenin): currently true only for RBD image backend
return True
if (dest_check_data.get('is_shared_instance_path') and
@@ -5088,7 +5091,8 @@ class LibvirtDriver(driver.ComputeDriver):
if (dest_check_data.get('is_volume_backed') and
not bool(jsonutils.loads(
- self.get_instance_disk_info(instance['name'])))):
+ self.get_instance_disk_info(instance['name'],
+ block_device_info)))):
# pylint: disable E1120
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment