diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 6415e8cbbb..a60e225087 100755 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -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 = "" 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( - "") + # 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') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 99a30059a8..7a2b5ad14d 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -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):