diff --git a/test/integration/component/test_advancedsg_networks.py b/test/integration/component/test_advancedsg_networks.py index 2794f96951c..85ab697ea4e 100644 --- a/test/integration/component/test_advancedsg_networks.py +++ b/test/integration/component/test_advancedsg_networks.py @@ -1911,7 +1911,7 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase): self.debug("SSH into VM: %s" % vm.nic[0].ipaddress) vm.get_ssh_client(ipaddress=vm.nic[0].ipaddress) self.debug("SSH to VM successful, proceeding for %s operation" % value) - vm.delete(self.api_client) + vm.delete(self.api_client, expunge=False) if value == "recover": vm.recover(self.api_client) vm.start(self.api_client) diff --git a/test/integration/component/test_multiple_ips_per_nic.py b/test/integration/component/test_multiple_ips_per_nic.py index 24b85dfa8c0..58aac9f9fa9 100644 --- a/test/integration/component/test_multiple_ips_per_nic.py +++ b/test/integration/component/test_multiple_ips_per_nic.py @@ -1042,7 +1042,7 @@ class TestVmNetworkOperations(cloudstackTestCase): StaticNATRule.enable(self.apiclient, public_ip_2.ipaddress.id, virtual_machine.id, network.id, vmguestip=ipaddress_2.ipaddress) - virtual_machine.delete(self.apiclient) + virtual_machine.delete(self.apiclient, expunge=False) virtual_machine.recover(self.apiclient) retriesCount = 10 diff --git a/test/integration/component/test_ps_domain_limits.py b/test/integration/component/test_ps_domain_limits.py index afb09557041..39add1ee16e 100644 --- a/test/integration/component/test_ps_domain_limits.py +++ b/test/integration/component/test_ps_domain_limits.py @@ -670,7 +670,7 @@ class TestMultipleChildDomain(cloudstackTestCase): self.assertFalse(result[0], result[1]) self.assertTrue(result[2], "Resource count does not match") - vm_1.delete(self.apiclient) + vm_1.delete(self.apiclient, expunge=False) result = isDomainResourceCountEqualToExpectedCount( self.apiclient, self.account.domainid, diff --git a/test/integration/component/test_ps_limits.py b/test/integration/component/test_ps_limits.py index 1993e934b3b..cbedfe7432d 100644 --- a/test/integration/component/test_ps_limits.py +++ b/test/integration/component/test_ps_limits.py @@ -199,7 +199,7 @@ class TestVolumeLimits(cloudstackTestCase): expectedCount = self.initialResourceCount # Stopping instance try: - self.virtualMachine.delete(self.apiclient) + self.virtualMachine.delete(self.apiclient, expunge=False) except Exception as e: self.fail("Failed to destroy instance: %s" % e) response = matchResourceCount( diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py index fd995cdd5dd..8664e01523a 100644 --- a/test/integration/component/test_vpc_vm_life_cycle.py +++ b/test/integration/component/test_vpc_vm_life_cycle.py @@ -634,8 +634,8 @@ class TestVMLifeCycleVPC(cloudstackTestCase): self.debug("Destroying the virtual machines in account: %s" % self.account.name) try: - self.vm_1.delete(self.apiclient) - self.vm_2.delete(self.apiclient) + self.vm_1.delete(self.apiclient, expunge=False) + self.vm_2.delete(self.apiclient, expunge=False) except Exception as e: self.fail("Failed to stop the virtual instances, %s" % e) @@ -678,8 +678,8 @@ class TestVMLifeCycleVPC(cloudstackTestCase): self.debug("Deleted instacnes ..") try: - self.vm_1.delete(self.apiclient) - self.vm_2.delete(self.apiclient) + self.vm_1.delete(self.apiclient, expunge=False) + self.vm_2.delete(self.apiclient, expunge=False) except Exception as e: self.fail("Failed to stop the virtual instances, %s" % e) @@ -1399,7 +1399,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase): self.cleanup.append(self.vm_2) try: - self.vm_2.delete(self.apiclient) + self.vm_2.delete(self.apiclient, expunge=False) except Exception as e: self.fail("Failed to destroy the virtual instances, %s" % e) @@ -2426,8 +2426,8 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase): self.debug("Destroying the virtual machines in account: %s" % self.account.name) try: - self.vm_1.delete(self.apiclient) - self.vm_2.delete(self.apiclient) + self.vm_1.delete(self.apiclient, expunge=False) + self.vm_2.delete(self.apiclient, expunge=False) except Exception as e: self.fail("Failed to stop the virtual instances, %s" % e) @@ -3208,7 +3208,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase): self.debug("Destroying the virtual machines in account: %s" % self.account.name) try: - self.vm_1.delete(self.apiclient) + self.vm_1.delete(self.apiclient, expunge=False) list_vm_response = list_virtual_machines( self.apiclient, @@ -3223,7 +3223,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase): "VM state should be destroyed" ) - self.vm_2.delete(self.apiclient) + self.vm_2.delete(self.apiclient, expunge=False) list_vm_response = list_virtual_machines( self.apiclient, diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 58033c601f5..eb05a180aa1 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -612,10 +612,11 @@ class VirtualMachine: [setattr(cmd, k, v) for k, v in kwargs.items()] return(apiclient.updateVirtualMachine(cmd)) - def delete(self, apiclient, **kwargs): + def delete(self, apiclient, expunge=True, **kwargs): """Destroy an Instance""" cmd = destroyVirtualMachine.destroyVirtualMachineCmd() cmd.id = self.id + cmd.expunge = expunge [setattr(cmd, k, v) for k, v in kwargs.items()] apiclient.destroyVirtualMachine(cmd)