From 185f9e37203bb4ef870d5eef5ec4d7a0d461a399 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Fri, 1 Sep 2017 19:48:04 +0300 Subject: [PATCH] Fixes vmops destroy planned VM call vmops' destroy method calls the wrong method "destroy_planned_vm" instead of "destroy_existing_planned_vm". Change-Id: I1f2f495bf55921a2322e71e224ed67990db4a02e (cherry picked from commit bd12ddf55e6ffbc43ee1746c924257eece8fb4fc) --- compute_hyperv/nova/vmops.py | 2 +- compute_hyperv/tests/unit/test_vmops.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compute_hyperv/nova/vmops.py b/compute_hyperv/nova/vmops.py index 197d8b7d..de32baa2 100644 --- a/compute_hyperv/nova/vmops.py +++ b/compute_hyperv/nova/vmops.py @@ -823,7 +823,7 @@ class VMOps(object): self.power_off(instance) self._vmutils.destroy_vm(instance_name) elif self._migrutils.planned_vm_exists(instance_name): - self._migrutils.destroy_planned_vm(instance_name) + self._migrutils.destroy_existing_planned_vm(instance_name) else: LOG.debug("Instance not found", instance=instance) diff --git a/compute_hyperv/tests/unit/test_vmops.py b/compute_hyperv/tests/unit/test_vmops.py index ac27faeb..ac7bbe76 100644 --- a/compute_hyperv/tests/unit/test_vmops.py +++ b/compute_hyperv/tests/unit/test_vmops.py @@ -1256,11 +1256,14 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase): elif planned_vm_exists: self._vmops._migrutils.planned_vm_exists.assert_called_once_with( mock_instance.name) - self._vmops._migrutils.destroy_planned_vm.assert_called_once_with( + destroy_planned_vm = ( + self._vmops._migrutils.destroy_existing_planned_vm) + destroy_planned_vm.assert_called_once_with( mock_instance.name) self.assertFalse(self._vmops._vmutils.destroy_vm.called) else: - self.assertFalse(self._vmops._migrutils.destroy_planned_vm.called) + self.assertFalse( + self._vmops._migrutils.destroy_existing_planned_vm.called) mock_unplug_vifs.assert_called_once_with( mock_instance, mock.sentinel.fake_network_info)