cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [48/50] [abbrv] git commit: updated refs/heads/master to 4c5f792
Date Wed, 05 Nov 2014 10:45:42 GMT
CLOUDSTACK-7800: Correcting code related to unplug NIC on VMware

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2cd4ad20
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2cd4ad20
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2cd4ad20

Branch: refs/heads/master
Commit: 2cd4ad201adbee3ad75dd57d8196b633cdd0494b
Parents: c3e5964
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Tue Nov 4 18:08:15 2014 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Wed Nov 5 12:57:40 2014 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_nic.py | 90 +++++++++++----------------------
 1 file changed, 30 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2cd4ad20/test/integration/smoke/test_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index f130bbe..86faa56 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -24,6 +24,8 @@ from marvin.lib.base import (Account,
 from marvin.lib.common import (get_zone,
                                get_template,
                                get_domain)
+from marvin.lib.utils import validateList
+from marvin.codes import PASS
 from nose.plugins.attrib import attr
 
 import signal
@@ -149,7 +151,6 @@ class TestNic(cloudstackTestCase):
 
         hypervisorIsVmware = False
         isVmwareToolInstalled = False
-        assertForExceptionForNicOperations = False
         if self.hypervisor.lower() == "vmware":
             hypervisorIsVmware = True
 
@@ -163,59 +164,18 @@ class TestNic(cloudstackTestCase):
             mode=self.zone.networktype if hypervisorIsVmware else "default"
         )
 
-        # If hypervisor is Vmware, then check if
-        # the vmware tools are installed and the process is running
-        # Vmware tools are necessary for add and remove nic operations
-        if hypervisorIsVmware:
-            sshClient = self.virtual_machine.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
-
-        # If Vmware tools are not installed in case of vmware hypervisor
-        # then check for exception while performing add and remove nic
-        # operations
-        if hypervisorIsVmware and not isVmwareToolInstalled:
-            assertForExceptionForNicOperations = True
-
         self.cleanup.insert(0, self.virtual_machine)
-        list_vm_response = VirtualMachine.list(
+        vms = VirtualMachine.list(
             self.apiclient,
             id=self.virtual_machine.id
         )
 
-        self.debug(
-            "Verify listVirtualMachines response for virtual machine: %s"
-            % self.virtual_machine.id
-        )
-
-        self.assertEqual(
-            isinstance(list_vm_response, list),
-            True,
-            "Check list response returns a valid list"
-        )
-
-        self.assertNotEqual(
-            len(list_vm_response),
-            0,
-            "Check VM available in List Virtual Machines"
-        )
-        vm_response = list_vm_response[0]
-
         self.assertEqual(
+                validateList(vms)[0],
+                PASS,
+                "vms list validation failed")
 
-            vm_response.id,
-            self.virtual_machine.id,
-            "Check virtual machine id in listVirtualMachines"
-        )
-
-        self.assertEqual(
-            vm_response.name,
-            self.virtual_machine.name,
-            "Check virtual machine name in listVirtualMachines"
-        )
+        vm_response = vms[0]
 
         self.assertEqual(
             len(vm_response.nic),
@@ -231,30 +191,40 @@ class TestNic(cloudstackTestCase):
         existing_nic_ip = vm_response.nic[0].ipaddress
         existing_nic_id = vm_response.nic[0].id
 
-        if assertForExceptionForNicOperations:
-            with self.assertRaises(Exception):
-                self.virtual_machine.add_nic(
+        self.virtual_machine.add_nic(
                     self.apiclient,
                     self.test_network2.id)
-
-        else:
-            # 1. add a nic
-            self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
-
-            time.sleep(5)
-            # now go get the vm list?
-
-            list_vm_response = VirtualMachine.list(
+        list_vm_response = VirtualMachine.list(
                 self.apiclient,
                 id=self.virtual_machine.id
             )
 
-            self.assertEqual(
+        self.assertEqual(
                 len(list_vm_response[0].nic),
                 2,
                 "Verify we have 2 NIC's now"
             )
 
+        # 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+)
+        if hypervisorIsVmware:
+            sshClient = self.virtual_machine.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:
             new_nic_id = ""
             for nc in list_vm_response[0].nic:
                 if nc.ipaddress != existing_nic_ip:


Mime
View raw message