mirror of https://github.com/apache/cloudstack.git
In case of vm deployment failure vm cleanup was not handled properly Corrected few script issues
This closes #472
This commit is contained in:
parent
5e96d13944
commit
64361d2b71
|
|
@ -130,6 +130,7 @@ def CreateNetwork(self, networktype):
|
|||
account=self.account.name,
|
||||
domainid=self.account.domainid
|
||||
)
|
||||
self.cleanup.append(vpc)
|
||||
self.vpcid = vpc.id
|
||||
vpcs = VPC.list(self.apiclient, id=vpc.id)
|
||||
self.assertEqual(
|
||||
|
|
@ -148,7 +149,6 @@ def CreateNetwork(self, networktype):
|
|||
gateway="10.1.1.1",
|
||||
netmask="255.255.255.0")
|
||||
self.cleanup.append(network)
|
||||
self.cleanup.append(vpc)
|
||||
return network
|
||||
|
||||
|
||||
|
|
@ -306,12 +306,12 @@ class TestPathVMLC(cloudstackTestCase):
|
|||
# Cleanup VM before proceeding the cleanup as networks will be
|
||||
# cleaned up properly, continue if VM deletion fails,
|
||||
# because in that case VM is already deleted from the test case
|
||||
# try:
|
||||
# self.virtual_machine.delete(self.apiclient, expunge=True)
|
||||
# except Exception:
|
||||
# self.debug("Exception while destroying VM")
|
||||
try:
|
||||
|
||||
self.virtual_machine.delete(self.apiclient, expunge=True)
|
||||
except Exception:
|
||||
self.debug("Exception while destroying VM")
|
||||
try:
|
||||
self.cleanup = self.cleanup[::-1]
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
|
|
@ -382,7 +382,7 @@ class TestPathVMLC(cloudstackTestCase):
|
|||
networkids=[network.id, ],
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
|
||||
self.cleanup.append(self.virtual_machine)
|
||||
publicip = PublicIPAddress.create(
|
||||
self.userapiclient, accountid=self.account.name,
|
||||
zoneid=self.zone.id, domainid=self.account.domainid,
|
||||
|
|
@ -560,6 +560,7 @@ class TestPathVMLC(cloudstackTestCase):
|
|||
networkids=[network.id, ],
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self.cleanup.append(self.virtual_machine)
|
||||
return
|
||||
|
||||
@attr(tags=["basic"], required_hardware="True")
|
||||
|
|
@ -639,7 +640,7 @@ class TestPathVMLC(cloudstackTestCase):
|
|||
zoneid=self.zone.id,
|
||||
securitygroupids=[security_group.id, ]
|
||||
)
|
||||
|
||||
self.cleanup.append(self.virtual_machine)
|
||||
# Check VM accessibility
|
||||
try:
|
||||
SshClient(host=self.virtual_machine.ssh_ip,
|
||||
|
|
@ -754,6 +755,7 @@ class TestPathVMLC(cloudstackTestCase):
|
|||
networkids=[networkid, ],
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self.cleanup.append(self.virtual_machine)
|
||||
# Stop the VM and try to reboot it, it should fail
|
||||
self.virtual_machine.stop(self.userapiclient)
|
||||
with self.assertRaises(Exception):
|
||||
|
|
@ -797,6 +799,7 @@ class TestPathVMLC(cloudstackTestCase):
|
|||
serviceofferingid=self.service_offering_1.id,
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self.cleanup.append(self.virtual_machine)
|
||||
# Stop the VM and try to reboot it, it should fail
|
||||
self.virtual_machine.stop(self.userapiclient)
|
||||
with self.assertRaises(Exception):
|
||||
|
|
|
|||
Loading…
Reference in New Issue