Disconnect volumes after cold migrations

After cold migrating an instance, volumes are not disconnected on
the source node side. This change fixes it.

A recent change fixed a similar issue regarding vif ports but we've
missed volume connections.

Change-Id: I094b405a151366236d6b86e45e7a989818006e2b
Closes-Bug: #1705683
This commit is contained in:
Lucian Petrut 2017-08-30 14:58:23 +03:00
parent 90b372ea42
commit fedb492a14
2 changed files with 5 additions and 3 deletions

View File

@ -104,7 +104,8 @@ class MigrationOps(object):
instance.system_metadata['backup_location'] = instance_path
instance.save()
self._vmops.destroy(instance, network_info, destroy_disks=True)
self._vmops.destroy(instance, network_info,
block_device_info, destroy_disks=True)
# return the instance's path location.
return instance_path

View File

@ -125,7 +125,8 @@ class MigrationOpsTestCase(test_base.HyperVBaseTestCase):
disk_info = 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)
self.assertEqual(mock_move_vm_files.return_value, disk_info)
mock_check_flavor.assert_called_once_with(instance, flavor)
@ -136,7 +137,7 @@ class MigrationOpsTestCase(test_base.HyperVBaseTestCase):
instance.system_metadata['backup_location'])
instance.save.assert_called_once_with()
self._migrationops._vmops.destroy.assert_called_once_with(
instance, network_info, destroy_disks=True)
instance, network_info, mock.sentinel.bdi, destroy_disks=True)
def test_confirm_migration(self):
mock_instance = fake_instance.fake_instance_obj(