cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject [1/4] git commit: updated refs/heads/master to f11e570
Date Tue, 13 Jan 2015 09:50:03 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 06d4458d0 -> f11e57079


CLOUDSTACK-8152: Adding delay before creating snapshot/template from root disk after writing
data to disk - test_vm_passwordenabled.py

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/d79837b6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d79837b6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d79837b6

Branch: refs/heads/master
Commit: d79837b67a481e618c8291152a9ecec299ff02dd
Parents: 06d4458
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Tue Jan 13 13:56:41 2015 +0530
Committer: SrikanteswaraRao Talluri <talluri@apache.org>
Committed: Tue Jan 13 15:09:58 2015 +0530

----------------------------------------------------------------------
 .../component/test_vm_passwdenabled.py          | 97 ++++++++++++--------
 1 file changed, 59 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d79837b6/test/integration/component/test_vm_passwdenabled.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vm_passwdenabled.py b/test/integration/component/test_vm_passwdenabled.py
index d998ed5..77d3013 100644
--- a/test/integration/component/test_vm_passwdenabled.py
+++ b/test/integration/component/test_vm_passwdenabled.py
@@ -14,24 +14,33 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-import marvin
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             ServiceOffering,
+                             VirtualMachine,
+                             EgressFireWallRule,
+                             Template)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_virtual_machines,
+                               list_volumes)
 from nose.plugins.attrib import attr
+import time
 
 
 _multiprocess_shared_ = True
+
+
 class Services:
+
     """Test VM Life Cycle Services
     """
 
     def __init__(self):
         self.services = {
-            "disk_offering":{
+            "disk_offering": {
                 "displaytext": "Small",
                 "name": "Small",
                 "disksize": 1
@@ -44,26 +53,26 @@ class Services:
                 # Random characters are appended in create account to
                 # ensure unique username generated each time
                 "password": "password",
-                },
+            },
             "small":
             # Create a small virtual machine instance with disk offering
                 {
                     "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
+                    "username": "root",  # VM creds for SSH
                     "password": "password",
                     "ssh_port": 22,
                     "hypervisor": 'XenServer',
                     "privateport": 22,
                     "publicport": 22,
                     "protocol": 'TCP',
-                    },
+            },
             "egress": {
                     "name": 'web',
                     "protocol": 'TCP',
                     "startport": 80,
                     "endport": 80,
                     "cidrlist": '0.0.0.0/0',
-                },
+            },
             "service_offerings":
                 {
                     "small":
@@ -75,19 +84,20 @@ class Services:
                             "cpunumber": 1,
                             "cpuspeed": 100,
                             "memory": 256,
-                            },
-                },
+                        },
+            },
             "template": {
                 "displaytext": "Cent OS Template",
                 "name": "Cent OS Template",
                 "passwordenabled": True,
-                },
+            },
             "sleep": 60,
             "timeout": 10,
             "ostype": 'CentOS 5.3 (64-bit)',
             # CentOS 5.3 (64-bit)
         }
 
+
 class TestVMPasswordEnabled(cloudstackTestCase):
 
     @classmethod
@@ -132,33 +142,39 @@ class TestVMPasswordEnabled(cloudstackTestCase):
 
         networkid = cls.virtual_machine.nic[0].networkid
 
-        # create egress rule to allow wget of my cloud-set-guest-password script
+        # create egress rule to allow wget of my cloud-set-guest-password
+        # script
         if zone.networktype.lower() == 'advanced':
-            EgressFireWallRule.create(cls.api_client,
-                                  networkid=networkid,
-                                  protocol=cls.services["egress"]["protocol"],
-                                  startport=cls.services["egress"]["startport"],
-                                  endport=cls.services["egress"]["endport"],
-                                  cidrlist=cls.services["egress"]["cidrlist"])
+            EgressFireWallRule.create(
+                cls.api_client,
+                networkid=networkid,
+                protocol=cls.services["egress"]["protocol"],
+                startport=cls.services["egress"]["startport"],
+                endport=cls.services["egress"]["endport"],
+                cidrlist=cls.services["egress"]["cidrlist"])
 
         cls.virtual_machine.password = cls.services["small"]["password"]
         ssh = cls.virtual_machine.get_ssh_client()
 
-        #below steps are required to get the new password from VR(reset password)
-        #http://cloudstack.org/dl/cloud-set-guest-password
-        #Copy this file to /etc/init.d
-        #chmod +x /etc/init.d/cloud-set-guest-password
-        #chkconfig --add cloud-set-guest-password
+        # below steps are required to get the new password from VR
+        # (reset password)
+        # http://cloudstack.org/dl/cloud-set-guest-password
+        # Copy this file to /etc/init.d
+        # chmod +x /etc/init.d/cloud-set-guest-password
+        # chkconfig --add cloud-set-guest-password
 
         cmds = [
             "cd /etc/init.d;wget http://people.apache.org/~tsp/cloud-set-guest-password",
             "chmod +x /etc/init.d/cloud-set-guest-password",
             "chkconfig --add cloud-set-guest-password",
-            ]
+        ]
         for c in cmds:
-            result = ssh.execute(c)
+            ssh.execute(c)
+
+        # Adding delay of 120 sec to avoid data loss due to timing issue
+        time.sleep(120)
 
-        #Stop virtual machine
+        # Stop virtual machine
         cls.virtual_machine.stop(cls.api_client)
 
         # Poll listVM to ensure VM is stopped properly
@@ -200,7 +216,7 @@ class TestVMPasswordEnabled(cloudstackTestCase):
 
         cls.services["template"]["ostype"] = cls.services["ostype"]
         cls.services["template"]["ispublic"] = True
-        #Create templates for Edit, Delete & update permissions testcases
+        # Create templates for Edit, Delete & update permissions testcases
         cls.pw_enabled_template = Template.create(
             cls.api_client,
             cls.services["template"],
@@ -236,11 +252,18 @@ class TestVMPasswordEnabled(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created instances
+        # Clean up, terminate the created instances
         cleanup_resources(self.apiclient, self.cleanup)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+    @attr(
+        tags=[
+            "advanced",
+            "advancedns",
+            "smoke",
+            "basic",
+            "sg"],
+        required_hardware="true")
     def test_11_get_vm_password(self):
         """Test get VM password for password enabled template"""
 
@@ -254,9 +277,6 @@ class TestVMPasswordEnabled(cloudstackTestCase):
         self.debug("Stopping VM: %s" % self.vm.name)
         self.vm.stop(self.apiclient)
 
-        # Sleep to ensure VM is stopped properly
-        time.sleep(self.services["sleep"])
-
         self.debug("Resetting VM password for VM: %s" % self.vm.name)
         password = self.vm.resetPassword(self.apiclient)
         self.debug("Password reset to: %s" % password)
@@ -281,7 +301,8 @@ class TestVMPasswordEnabled(cloudstackTestCase):
         try:
             self.debug("SSHing into VM: %s" % self.vm.ssh_ip)
             self.vm.password = password
-            ssh = self.vm.get_ssh_client()
+            self.vm.get_ssh_client()
         except Exception as e:
-            self.fail("SSH into VM: %s failed" % self.vm.ssh_ip)
+            self.fail("SSH into VM: %s failed: %s" %
+                      (self.vm.ssh_ip, e))
         return


Mime
View raw message