Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 02F39C852 for ; Fri, 28 Nov 2014 18:03:25 +0000 (UTC) Received: (qmail 77711 invoked by uid 500); 28 Nov 2014 18:03:16 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 77637 invoked by uid 500); 28 Nov 2014 18:03:16 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 76248 invoked by uid 99); 28 Nov 2014 18:03:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Nov 2014 18:03:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CB16F8B6490; Fri, 28 Nov 2014 18:03:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhaisaab@apache.org To: commits@cloudstack.apache.org Date: Fri, 28 Nov 2014 18:03:38 -0000 Message-Id: In-Reply-To: <22ac5e6bd91443c8904a13b31d7cd40d@git.apache.org> References: <22ac5e6bd91443c8904a13b31d7cd40d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [24/51] [abbrv] git commit: updated refs/heads/useraccount-refactoring to 1e25886 CLOUDSTACK-7933: test_escalations_instances.py - Fixed test_13_vm_nics for Vmware Signed-off-by: SrikanteswaraRao Talluri Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d0ca2d5d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d0ca2d5d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d0ca2d5d Branch: refs/heads/useraccount-refactoring Commit: d0ca2d5d8b1575bf8c7d1b6566cea15c8a2264bb Parents: 2fbef67 Author: Gaurav Aradhye Authored: Tue Nov 18 11:49:38 2014 +0530 Committer: SrikanteswaraRao Talluri Committed: Tue Nov 25 18:58:00 2014 +0530 ---------------------------------------------------------------------- .../component/test_escalations_instances.py | 74 ++++++++++++++------ 1 file changed, 51 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0ca2d5d/test/integration/component/test_escalations_instances.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py index fd25bb9..cc1f78b 100644 --- a/test/integration/component/test_escalations_instances.py +++ b/test/integration/component/test_escalations_instances.py @@ -1781,6 +1781,12 @@ class TestListInstances(cloudstackTestCase): raise unittest.SkipTest( "This feature is not supported on existing hypervisor.\ Hence, skipping the test") + + hypervisorIsVmware = False + + if self.hypervisor.lower() == "vmware": + hypervisorIsVmware = True + # Listing all the VM's for a User list_vms_before = VirtualMachine.list( self.userapiclient, @@ -1797,6 +1803,7 @@ class TestListInstances(cloudstackTestCase): accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, + mode=self.zone.networktype if hypervisorIsVmware else "default" ) self.assertIsNotNone( vm_created, @@ -2002,40 +2009,61 @@ class TestListInstances(cloudstackTestCase): default_nic.networkid, "Default NIC is not matching for VM" ) - # Deleting non default NIC - vm_created.remove_nic( - self.userapiclient, - non_default_nic.id - ) - # Listing the Vm details again - list_vms_after = VirtualMachine.list( - self.userapiclient, - id=vm_created.id - ) - status = validateList(list_vms_after) - self.assertEquals( + + # If hypervisor is Vmware, then check if + # the vmware tools are installed and the process is running + # Vmware tools are necessary for remove nic operations (vmware 5.5+) + isVmwareToolInstalled = False + if hypervisorIsVmware: + sshClient = vm_created.get_ssh_client() + result = str( + sshClient.execute("service vmware-tools status")).lower() + self.debug("and result is: %s" % result) + if "running" in result: + isVmwareToolInstalled = True + + goForUnplugOperation = True + # If Vmware tools are not installed in case of vmware hypervisor + # then don't go further for unplug operation (remove nic) as it won't + # be supported + if hypervisorIsVmware and not isVmwareToolInstalled: + goForUnplugOperation = False + + if goForUnplugOperation: + # Deleting non default NIC + vm_created.remove_nic( + self.userapiclient, + non_default_nic.id + ) + # Listing the Vm details again + list_vms_after = VirtualMachine.list( + self.userapiclient, + id=vm_created.id + ) + status = validateList(list_vms_after) + self.assertEquals( PASS, status[0], "Listing of VM failed" - ) - vm = list_vms_after[0] - # Verifying that VM nics size is 1 now - vm_nics_after = vm.nic - self.assertIsNotNone( + ) + vm = list_vms_after[0] + # Verifying that VM nics size is 1 now + vm_nics_after = vm.nic + self.assertIsNotNone( vm_nics_after, "Nic not found for the deployed VM" - ) - self.assertEquals( + ) + self.assertEquals( 1, len(vm_nics_after), "VM NIC's count is not matching" - ) - # Verifying the nic network is same as the default nic network - self.assertEquals( + ) + # Verifying the nic network is same as the default nic network + self.assertEquals( network2.id, vm_nics_after[0].networkid, "VM NIC is not same as expected" - ) + ) return