From cddcc097b975aa20e575accc7c4802468acea1f6 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 6 Jun 2012 12:29:55 +0530 Subject: [PATCH] Fixing the remoteSSHClient imports, migrate VM, SSVM and router tests --- test/integration/component/test_accounts.py | 2 +- .../component/test_blocker_bugs.py | 2 +- .../component/test_egress_rules.py | 2 +- .../component/test_high_availability.py | 4 +- .../component/test_network_offering.py | 4 +- .../component/test_project_configs.py | 2 +- .../component/test_project_usage.py | 2 +- test/integration/component/test_projects.py | 2 +- test/integration/component/test_routers.py | 3 +- .../component/test_security_groups.py | 2 +- test/integration/component/test_snapshots.py | 2 +- test/integration/component/test_usage.py | 2 +- test/integration/component/test_volumes.py | 2 +- test/integration/lib/base.py | 57 +++++++++++++++++-- test/integration/lib/common.py | 4 +- test/integration/lib/utils.py | 14 +---- test/integration/smoke/test_network.py | 38 ++++++------- test/integration/smoke/test_routers.py | 12 ++-- .../smoke/test_secondary_storage.py | 11 +--- test/integration/smoke/test_snapshots.py | 2 +- test/integration/smoke/test_ssvm.py | 4 +- test/integration/smoke/test_vm_life_cycle.py | 27 ++++----- test/integration/smoke/test_volumes.py | 2 +- 23 files changed, 113 insertions(+), 89 deletions(-) diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index 87c8ee1f4cf..1e94d105500 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -22,7 +22,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index c0c676a5424..87158f2c120 100644 --- a/test/integration/component/test_blocker_bugs.py +++ b/test/integration/component/test_blocker_bugs.py @@ -24,7 +24,7 @@ from integration.lib.common import * #Import Local Modules from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient class Services: """Test Services diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py index d6bbb2a963d..d85cc7e8c01 100644 --- a/test/integration/component/test_egress_rules.py +++ b/test/integration/component/test_egress_rules.py @@ -21,7 +21,7 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * diff --git a/test/integration/component/test_high_availability.py b/test/integration/component/test_high_availability.py index 8365f4afbec..8ecd774cd36 100644 --- a/test/integration/component/test_high_availability.py +++ b/test/integration/component/test_high_availability.py @@ -24,7 +24,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime @@ -171,7 +171,7 @@ class TestHighAvailability(cloudstackTestCase): except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return - @unittest.skip("skipped") + def test_01_host_maintenance_mode(self): """Test host maintenance mode """ diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py index d77da7712fc..466aac3c5a9 100644 --- a/test/integration/component/test_network_offering.py +++ b/test/integration/component/test_network_offering.py @@ -24,7 +24,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime @@ -1579,7 +1579,7 @@ class TestNetworkUpgrade(cloudstackTestCase): vpns = Vpn.list( self.apiclient, publicipid=src_nat.id, - listall=True, + listall=True, ) self.assertEqual( diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py index a94c2c11875..6fd4470fd2d 100644 --- a/test/integration/component/test_project_configs.py +++ b/test/integration/component/test_project_configs.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py index 0ba92d47dc3..ef646e1314c 100644 --- a/test/integration/component/test_project_usage.py +++ b/test/integration/component/test_project_usage.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime class Services: diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py index 9c07fe14c70..463cb4a24a4 100644 --- a/test/integration/component/test_projects.py +++ b/test/integration/component/test_projects.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py index 6aed7d5a1d4..9f37306e431 100644 --- a/test/integration/component/test_routers.py +++ b/test/integration/component/test_routers.py @@ -20,10 +20,10 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * -from marvin import remoteSSHClient from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * +from marvin.remoteSSHClient import remoteSSHClient #Import System modules import time @@ -80,6 +80,7 @@ class Services: # Algorithm used for load balancing "privateport": 22, "publicport": 2222, + "protocol": 'TCP', }, "fw_rule":{ "startport": 1, diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py index 7e54eea0d14..4f037c201f0 100644 --- a/test/integration/component/test_security_groups.py +++ b/test/integration/component/test_security_groups.py @@ -21,10 +21,10 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * -from marvin import remoteSSHClient from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * +from marvin.remoteSSHClient import remoteSSHClient #Import System modules import time diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py index 612e8e6f71f..cab3bef435d 100644 --- a/test/integration/component/test_snapshots.py +++ b/test/integration/component/test_snapshots.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient class Services: """Test Snapshots Services diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py index ec9288ab7fd..8cd450c79f9 100644 --- a/test/integration/component/test_usage.py +++ b/test/integration/component/test_usage.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient import datetime class Services: diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py index fef9ced15dd..f598385d26a 100644 --- a/test/integration/component/test_volumes.py +++ b/test/integration/component/test_volumes.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import * from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient #Import System modules import os import urllib diff --git a/test/integration/lib/base.py b/test/integration/lib/base.py index 46aef006a60..4689972f0e6 100644 --- a/test/integration/lib/base.py +++ b/test/integration/lib/base.py @@ -601,7 +601,9 @@ class Template: time.sleep(interval) elif 'Installing' not in template.status: - raise Exception("ErrorInDownload") + raise Exception( + "Error in downloading template: status - %s" % + template.status) elif timeout == 0: break @@ -693,10 +695,12 @@ class Iso: return elif 'Downloaded' not in response.status and \ 'Installing' not in response.status: - raise Exception("ErrorInDownload") + raise Exception( + "Error In Downloading ISO: ISO Status - %s" % + response.status) elif timeout == 0: - raise Exception("TimeoutException") + raise Exception("ISO download Timeout Exception") else: timeout = timeout - 1 return @@ -728,12 +732,12 @@ class PublicIPAddress: if zoneid: cmd.zoneid = zoneid elif "zoneid" in services: - services["zoneid"] + cmd.zoneid = services["zoneid"] if domainid: cmd.domainid = domainid elif "domainid" in services: - services["domainid"] + cmd.domainid = services["domainid"] if networkid: cmd.networkid = networkid @@ -1143,7 +1147,7 @@ class LoadBalancerRule: apiclient.removeFromLoadBalancerRule(cmd) return - def update(self, apiclient, algorithm=None, description=None, name=None): + def update(self, apiclient, algorithm=None, description=None, name=None, **kwargs): """Updates the load balancing rule""" cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd() cmd.id = self.id @@ -1154,8 +1158,40 @@ class LoadBalancerRule: if name: cmd.name = name + [setattr(cmd, k, v) for k, v in kwargs.items()] return apiclient.updateLoadBalancerRule(cmd) + def createSticky(self, apiclient, methodname, name, description=None, param=None): + """Creates a sticky policy for the LB rule""" + + cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd() + cmd.lbruleid = self.id + cmd.methodname = methodname + cmd.name = name + if description: + cmd.description = description + if param: + cmd.param = [] + for name, value in param.items(): + cmd.param.append({'name': name, 'value': value}) + return apiclient.createLBStickinessPolicy(cmd) + + def deleteSticky(self, apiclient, id): + """Deletes stickyness policy""" + + cmd = deleteLBStickinessPolicy.deleteLBStickinessPolicyCmd() + cmd.id = id + return apiclient.deleteLBStickinessPolicy(cmd) + + @classmethod + def listStickyPolicies(cls, apiclient, lbruleid, **kwargs): + """Lists stickiness policies for load balancing rule""" + + cmd= listLBStickinessPolicies.listLBStickinessPoliciesCmd() + cmd.lbruleid = lbruleid + [setattr(cmd, k, v) for k, v in kwargs.items()] + return apiclient.listLBStickinessPolicies(cmd) + @classmethod def list(cls, apiclient, **kwargs): """List all Load balancing rules matching criteria""" @@ -1404,6 +1440,15 @@ class Network: [setattr(cmd, k, v) for k, v in kwargs.items()] return(apiclient.updateNetwork(cmd)) + def restart(self, apiclient, cleanup=None): + """Restarts the network""" + + cmd = restartNetwork.restartNetworkCmd() + cmd.id = self.id + if cleanup: + cmd.cleanup = cleanup + return(apiclient.restartNetwork(cmd)) + @classmethod def list(cls, apiclient, **kwargs): """List all Networks matching criteria""" diff --git a/test/integration/lib/common.py b/test/integration/lib/common.py index 11dd2c05f27..b1c87bcf91d 100644 --- a/test/integration/lib/common.py +++ b/test/integration/lib/common.py @@ -106,12 +106,12 @@ def download_systemplates_sec_storage(server, services): try: # Login to management server - ssh = remoteSSHClient.remoteSSHClient( + ssh = remoteSSHClient( server["ipaddress"], server["port"], server["username"], server["password"] - ) + ) except Exception: raise Exception("SSH access failted for server with IP address: %s" % server["ipaddess"]) diff --git a/test/integration/lib/utils.py b/test/integration/lib/utils.py index 3592502c8dc..05aed798a24 100644 --- a/test/integration/lib/utils.py +++ b/test/integration/lib/utils.py @@ -114,12 +114,7 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=50): loop_cnt = retries while True: try: - ssh = remoteSSHClient.remoteSSHClient( - ipaddress, - port, - username, - password - ) + ssh = remoteSSHClient(ipaddress, port, username, password) except Exception as e: if loop_cnt == 0: raise e @@ -161,12 +156,7 @@ def get_process_status(hostip, port, username, password, linklocalip, process): """Double hop and returns a process status""" #SSH to the machine - ssh = remoteSSHClient.remoteSSHClient( - hostip, - port, - username, - password - ) + ssh = remoteSSHClient(hostip, port, username, password) ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no " ssh_command = ssh_command + \ "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % ( diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index e3015803e0c..89b37befe57 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -34,7 +34,7 @@ class Services: def __init__(self): self.services = { - "ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', + "ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e', # Cent OS 5.3 (64 bit) "mode": 'advanced', # Networking mode: Basic or advanced @@ -460,7 +460,7 @@ class TestPortForwarding(cloudstackTestCase): "SSHing into VM with IP address %s after NAT rule deletion" % self.virtual_machine.ipaddress) - remoteSSHClient.remoteSSHClient( + remoteSSHClient( src_nat_ip_addr.ipaddress, self.virtual_machine.ssh_port, self.virtual_machine.username, @@ -576,7 +576,7 @@ class TestPortForwarding(cloudstackTestCase): "SSHing into VM with IP address %s after NAT rule deletion" % self.virtual_machine.ipaddress) - remoteSSHClient.remoteSSHClient( + remoteSSHClient( ip_address.ipaddress.ipaddress, self.virtual_machine.ssh_port, self.virtual_machine.username, @@ -781,7 +781,7 @@ class TestLoadBalancingRule(cloudstackTestCase): (self.vm_1.ipaddress, src_nat_ip_addr.ipaddress) ) - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( src_nat_ip_addr.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -806,7 +806,7 @@ class TestLoadBalancingRule(cloudstackTestCase): self.vm_2.id )) - ssh_2 = remoteSSHClient.remoteSSHClient( + ssh_2 = remoteSSHClient( src_nat_ip_addr.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -839,7 +839,7 @@ class TestLoadBalancingRule(cloudstackTestCase): self.vm_2.id )) - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( src_nat_ip_addr.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -862,7 +862,7 @@ class TestLoadBalancingRule(cloudstackTestCase): with self.assertRaises(Exception): self.debug("Removed all VMs, trying to SSH") - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( src_nat_ip_addr.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -972,7 +972,7 @@ class TestLoadBalancingRule(cloudstackTestCase): self.vm_1.id, self.vm_2.id )) - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( self.non_src_nat_ip.ipaddress.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -991,7 +991,7 @@ class TestLoadBalancingRule(cloudstackTestCase): self.vm_1.id, self.vm_2.id )) - ssh_2 = remoteSSHClient.remoteSSHClient( + ssh_2 = remoteSSHClient( self.non_src_nat_ip.ipaddress.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -1019,7 +1019,7 @@ class TestLoadBalancingRule(cloudstackTestCase): self.non_src_nat_ip.ipaddress.ipaddress, self.vm_2.id )) - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( self.non_src_nat_ip.ipaddress.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -1045,7 +1045,7 @@ class TestLoadBalancingRule(cloudstackTestCase): self.non_src_nat_ip.ipaddress.ipaddress, self.vm_1.id )) - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( self.non_src_nat_ip.ipaddress.ipaddress, self.services['lbrule']["publicport"], self.vm_1.username, @@ -1198,7 +1198,7 @@ class TestRebootRouter(cloudstackTestCase): try: self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id) - remoteSSHClient.remoteSSHClient( + remoteSSHClient( self.nat_rule.ipaddress, self.services["natrule"]["publicport"], self.vm_1.username, @@ -1276,7 +1276,7 @@ class TestAssignRemoveLB(cloudstackTestCase): ] return - def test_assign_and_removal_elb(self): + def test_assign_and_removal_lb(self): """Test for assign & removing load balancing rule""" # Validate: @@ -1350,7 +1350,7 @@ class TestAssignRemoveLB(cloudstackTestCase): self.vm_2.id )) #Create SSH client for each VM - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( self.non_src_nat_ip.ipaddress, self.services["lbrule"]["publicport"], self.vm_1.username, @@ -1367,7 +1367,7 @@ class TestAssignRemoveLB(cloudstackTestCase): self.vm_1.id, self.vm_2.id )) - ssh_2 = remoteSSHClient.remoteSSHClient( + ssh_2 = remoteSSHClient( self.non_src_nat_ip.ipaddress, self.services["lbrule"]["publicport"], self.vm_2.username, @@ -1409,7 +1409,7 @@ class TestAssignRemoveLB(cloudstackTestCase): self.vm_1.id, )) # Again make a SSH connection, as previous is not used after LB remove - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( self.non_src_nat_ip.ipaddress, self.services["lbrule"]["publicport"], self.vm_1.username, @@ -1431,13 +1431,13 @@ class TestAssignRemoveLB(cloudstackTestCase): lb_rule.assign(self.apiclient, [self.vm_3]) try: - ssh_1 = remoteSSHClient.remoteSSHClient( + ssh_1 = remoteSSHClient( self.non_src_nat_ip.ipaddress, self.services["lbrule"]["publicport"], self.vm_1.username, self.vm_1.password ) - ssh_3 = remoteSSHClient.remoteSSHClient( + ssh_3 = remoteSSHClient( self.non_src_nat_ip.ipaddress, self.services["lbrule"]["publicport"], self.vm_3.username, @@ -1602,7 +1602,7 @@ class TestReleaseIP(cloudstackTestCase): # SSH Attempt though public IP should fail with self.assertRaises(Exception): - ssh_2 = remoteSSHClient.remoteSSHClient( + ssh_2 = remoteSSHClient( self.ip_addr.ipaddress, self.services["natrule"]["publicport"], self.virtual_machine.username, diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py index cd921accbe0..0d9a6305fd7 100644 --- a/test/integration/smoke/test_routers.py +++ b/test/integration/smoke/test_routers.py @@ -45,7 +45,7 @@ class Services: { "displayname": "Test VM", "username": "root", - "password": "fr3sca", + "password": "password", "ssh_port": 22, "hypervisor": 'XenServer', "privateport": 22, @@ -57,9 +57,9 @@ class Services: "firstname": "Test", "lastname": "User", "username": "testuser", - "password": "fr3sca", + "password": "password", }, - "ostypeid":'946b031b-0e10-4f4a-a3fc-d212ae2ea07f', + "ostypeid":'1a568aed-db2d-41ca-b644-416b0bdc067e', "sleep": 60, "timeout": 10, "mode": 'advanced', #Networking mode: Basic, Advanced @@ -155,7 +155,7 @@ class TestRouterServices(cloudstackTestCase): zoneid=router.zoneid, type='Routing', state='Up', - virtualmachineid=self.vm_1.id + id=router.hostid ) self.assertEqual( isinstance(hosts, list), @@ -217,7 +217,7 @@ class TestRouterServices(cloudstackTestCase): zoneid=router.zoneid, type='Routing', state='Up', - virtualmachineid=self.vm_1.id + id=router.hostid ) self.assertEqual( isinstance(hosts, list), @@ -403,7 +403,7 @@ class TestRouterServices(cloudstackTestCase): zoneid=router.zoneid, type='Routing', state='Up', - virtualmachineid=self.vm_1.id + id=router.hostid ) self.assertEqual( isinstance(hosts, list), diff --git a/test/integration/smoke/test_secondary_storage.py b/test/integration/smoke/test_secondary_storage.py index de0fc5e7ac7..c97a5c77ea1 100644 --- a/test/integration/smoke/test_secondary_storage.py +++ b/test/integration/smoke/test_secondary_storage.py @@ -42,14 +42,6 @@ class Services: "hypervisor": "XenServer", "templatefilter": "self", }, - 1: { - "hypervisor": "KVM", - "templatefilter": "self", - }, - 2: { - "hypervisor": "VMWare", - "templatefilter": "self", - }, }, "sleep": 60, "timeout": 5, @@ -92,6 +84,7 @@ class TestSecStorageServices(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return + @unittest.skip("do not add secondary storage") def test_01_add_sec_storage(self): """Test secondary storage """ @@ -380,4 +373,4 @@ class TestSecStorageServices(cloudstackTestCase): True, "Check whether state of template is ready or not" ) - return \ No newline at end of file + return diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index 510db0cfd35..657dec2358f 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -20,10 +20,10 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * +from marvin.remoteSSHClient import remoteSSHClient from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient class Services: diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py index 40257d8011c..fb98dd117ea 100644 --- a/test/integration/smoke/test_ssvm.py +++ b/test/integration/smoke/test_ssvm.py @@ -37,7 +37,7 @@ class Services: self.services = { "host": { "username": 'root', # Credentials for SSH - "password": 'fr3sca', + "password": 'password', "publicport": 22, }, "sleep": 60, @@ -81,7 +81,6 @@ class TestSSVMs(cloudstackTestCase): self.apiclient, systemvmtype='secondarystoragevm', state='Running', - zoneid=self.zone.id ) self.assertEqual( isinstance(list_ssvm_response, list), @@ -199,7 +198,6 @@ class TestSSVMs(cloudstackTestCase): self.apiclient, systemvmtype='consoleproxy', state='Running', - zoneid=self.zone.id ) self.assertEqual( isinstance(list_cpvm_response, list), diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index 529887268fb..9d116ba7263 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -20,7 +20,7 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * -from marvin import remoteSSHClient +from marvin.remoteSSHClient import remoteSSHClient from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * @@ -45,7 +45,7 @@ class Services: "username": "test", # Random characters are appended in create account to # ensure unique username generated each time - "password": "fr3sca", + "password": "password", }, "small": # Create a small virtual machine instance with disk offering @@ -87,7 +87,7 @@ class Services: "name": "Small Instance", "displaytext": "Small Instance", "cpunumber": 1, - "cpuspeed": 500, + "cpuspeed": 100, "memory": 256 }, "medium": @@ -97,17 +97,17 @@ class Services: "name": "Medium Instance", "displaytext": "Medium Instance", "cpunumber": 1, - "cpuspeed": 1000, - "memory": 1024 + "cpuspeed": 100, + "memory": 256 } }, "iso": # ISO settings for Attach/Detach ISO tests { "displaytext": "Test ISO", "name": "testISO", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://nfs1.lab.vmops.com/isos_32bit/dsl-4.4.10.iso", # Source URL where ISO is located - "ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', + "ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e', "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO }, "template": { @@ -121,7 +121,7 @@ class Services: "sleep": 60, "timeout": 10, #Migrate VM to hostid - "ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', + "ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e', # CentOS 5.3 (64-bit) "mode":'advanced', } @@ -754,18 +754,15 @@ class TestVMLifeCycle(cloudstackTestCase): True, "Check the number of hosts in the zone" ) - self.assertEqual( + self.assertGreaterEqual( len(hosts), 2, "Atleast 2 hosts should be present in a zone for VM migration" ) + # Remove the host of current VM from the hosts list + hosts[:] = [host for host in hosts if host.id != self.medium_virtual_machine.hostid] - # Find the host of VM and also the new host to migrate VM. - if self.medium_virtual_machine.hostid == hosts[0].id: - host = hosts[1] - else: - host = hosts[0] - + host = hosts[0] self.debug("Migrating VM-ID: %s to Host: %s" % ( self.medium_virtual_machine.id, host.id diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index f413b933662..8e270d5d280 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -20,10 +20,10 @@ import marvin from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * +from marvin.remoteSSHClient import remoteSSHClient from integration.lib.utils import * from integration.lib.base import * from integration.lib.common import * -from marvin import remoteSSHClient #Import System modules import os import urllib