From 20196b74dea4a1af4ea643a45fdb96b03f8ea96d Mon Sep 17 00:00:00 2001 From: Alexandru Muresan Date: Tue, 25 Jul 2017 12:18:27 +0300 Subject: [PATCH] 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 --- nova/tests/unit/virt/hyperv/test_migrationops.py | 5 +++-- nova/virt/hyperv/migrationops.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nova/tests/unit/virt/hyperv/test_migrationops.py b/nova/tests/unit/virt/hyperv/test_migrationops.py index a054b85da2..86844b11cf 100644 --- a/nova/tests/unit/virt/hyperv/test_migrationops.py +++ b/nova/tests/unit/virt/hyperv/test_migrationops.py @@ -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) diff --git a/nova/virt/hyperv/migrationops.py b/nova/virt/hyperv/migrationops.py index 041fa8098e..7e8683900b 100644 --- a/nova/virt/hyperv/migrationops.py +++ b/nova/virt/hyperv/migrationops.py @@ -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 ""