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.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f5c8e386 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f5c8e386 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f5c8e386 Branch: refs/heads/vmware-datamodel Commit: f5c8e386e5881c1d7aad1f85922752621bb96c1a Parents: 612afbd Author: Devdeep Singh <devd...@gmail.com> Authored: Mon May 20 18:26:50 2013 +0530 Committer: Devdeep Singh <devd...@gmail.com> Committed: Mon May 20 18:26:50 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 1 - .../smoke/test_deploy_vm_with_userdata.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5c8e386/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 05ff6aa..86150a2 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -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; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5c8e386/test/integration/smoke/test_deploy_vm_with_userdata.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py index 8ca9bd0..260106c 100644 --- a/test/integration/smoke/test_deploy_vm_with_userdata.py +++ b/test/integration/smoke/test_deploy_vm_with_userdata.py @@ -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):