Merge "libvirt: remove old code in post_live_migration_at_destination"

This commit is contained in:
Zuul
2017-11-10 16:10:08 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 17 deletions
+3 -4
View File
@@ -14679,16 +14679,15 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self, mock_get_guest, mock_write_instance_config):
instance = objects.Instance(id=1, uuid=uuids.instance)
dom = mock.MagicMock()
dom.XMLDesc.return_value = "<domain></domain>"
guest = libvirt_guest.Guest(dom)
mock_get_guest.return_value = guest
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
drvr.post_live_migration_at_destination(mock.ANY, instance, mock.ANY)
mock_write_instance_config.assert_called_once_with(
"<domain></domain>")
# Assert that we don't try to write anything to the destination node
# since the source live migrated with the VIR_MIGRATE_PERSIST_DEST flag
mock_write_instance_config.assert_not_called()
def test_create_propagates_exceptions(self):
self.flags(virt_type='lxc', group='libvirt')
+5 -13
View File
@@ -7136,19 +7136,11 @@ class LibvirtDriver(driver.ComputeDriver):
:param network_info: instance network information
:param block_migration: if true, post operation of block_migration.
"""
guest = self._host.get_guest(instance)
# TODO(sahid): In Ocata we have added the migration flag
# VIR_MIGRATE_PERSIST_DEST to libvirt, which means that the
# guest XML is going to be set in libvirtd on destination node
# automatically. However we do not remove that part until P*
# because during an upgrade, to ensure migrating instances
# from node running Newton is still going to set the guest XML
# in libvirtd on destination node.
# Make sure we define the migrated instance in libvirt
xml = guest.get_xml_desc()
self._host.write_instance_config(xml)
# The source node set the VIR_MIGRATE_PERSIST_DEST flag when live
# migrating so the guest xml should already be persisted on the
# destination host, so just perform a sanity check to make sure it
# made it as expected.
self._host.get_guest(instance)
def _get_instance_disk_info_from_config(self, guest_config,
block_device_info):