Hyper-V: Perform proper cleanup after cold migration

At the moment, vif ports and volume connections are not cleaned up
on the source node after a cold migration.

This change addresses this issue by passing the network and block
device info objects when destroying the instance.

Change-Id: I4fd61a6ac09f194ad8be61e6dda092bfd402b806
Closes-Bug: #1705683
This commit is contained in:
Alexandru Muresan 2017-07-25 12:18:27 +03:00 committed by Matt Riedemann
parent be3a66781f
commit 20196b74de
2 changed files with 5 additions and 3 deletions

View File

@ -201,7 +201,8 @@ class MigrationOpsTestCase(test_base.HyperVBaseTestCase):
self._migrationops.migrate_disk_and_power_off(
self.context, instance, mock.sentinel.FAKE_DEST, flavor,
network_info, None, self._FAKE_TIMEOUT, self._FAKE_RETRY_INTERVAL)
network_info, mock.sentinel.bdi,
self._FAKE_TIMEOUT, self._FAKE_RETRY_INTERVAL)
mock_check_flavor.assert_called_once_with(instance, flavor)
self._migrationops._vmops.power_off.assert_called_once_with(
@ -210,7 +211,7 @@ class MigrationOpsTestCase(test_base.HyperVBaseTestCase):
mock_migrate_disk_files.assert_called_once_with(
instance.name, disk_files, mock.sentinel.FAKE_DEST)
self._migrationops._vmops.destroy.assert_called_once_with(
instance, destroy_disks=False)
instance, network_info, mock.sentinel.bdi, destroy_disks=False)
def test_confirm_migration(self):
mock_instance = fake_instance.fake_instance_obj(self.context)

View File

@ -129,7 +129,8 @@ class MigrationOps(object):
if disk_files:
self._migrate_disk_files(instance.name, disk_files, dest)
self._vmops.destroy(instance, destroy_disks=False)
self._vmops.destroy(instance, network_info,
block_device_info, destroy_disks=False)
# disk_info is not used
return ""