CLOUDSTACK-2379: Fix for issue destroy vm causing NPE. Made the following changes.

1. Made a fix to make sure a null object is added to the exception.
2. Also fixed the marvin test cases for the feature. Account cleanup will remove the vms deployed for the account. There is no need to explicitly delete the vms for the account.
3. Fixed the assertion checks for the vm created for an account. If there are multiple vms for an account, the test script needs to compare the ids with the correct instance.
This commit is contained in:
Devdeep Singh 2013-05-20 18:26:50 +05:30
parent 612afbd179
commit f5c8e386e5
2 changed files with 4 additions and 5 deletions

View File

@ -3228,7 +3228,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
if (vm == null || vm.getRemoved() != null) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Unable to find a virtual machine with specified vmId");
ex.addProxyObject(vm, vmId, "vmId");
throw ex;
}

View File

@ -105,13 +105,13 @@ class TestDeployVmWithUserData(cloudstackTestCase):
vms = list_virtual_machines(
self.apiClient,
account=self.account.name,
domainid=self.account.domainid
domainid=self.account.domainid,
id=deployVmResponse.id
)
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state")
self.cleanup.append(deployVmResponse)
@attr(tags=["simulator", "devcloud", "basic", "advanced"])
def test_deployvm_userdata(self):
@ -129,13 +129,13 @@ class TestDeployVmWithUserData(cloudstackTestCase):
vms = list_virtual_machines(
self.apiClient,
account=self.account.name,
domainid=self.account.domainid
domainid=self.account.domainid,
id=deployVmResponse.id
)
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state")
self.cleanup.append(deployVmResponse)
@classmethod
def tearDownClass(cls):