Fixing the remoteSSHClient imports, migrate VM, SSVM and router tests

This commit is contained in:
Prasanna Santhanam 2012-06-06 12:29:55 +05:30
parent ecfa3e7cf8
commit cddcc097b9
23 changed files with 113 additions and 89 deletions

View File

@ -22,7 +22,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime

View File

@ -24,7 +24,7 @@ from integration.lib.common import *
#Import Local Modules #Import Local Modules
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
class Services: class Services:
"""Test Services """Test Services

View File

@ -21,7 +21,7 @@
import marvin import marvin
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *

View File

@ -24,7 +24,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
@ -171,7 +171,7 @@ class TestHighAvailability(cloudstackTestCase):
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@unittest.skip("skipped")
def test_01_host_maintenance_mode(self): def test_01_host_maintenance_mode(self):
"""Test host maintenance mode """Test host maintenance mode
""" """

View File

@ -24,7 +24,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime

View File

@ -23,7 +23,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime

View File

@ -23,7 +23,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
class Services: class Services:

View File

@ -23,7 +23,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime

View File

@ -20,10 +20,10 @@
import marvin import marvin
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin.remoteSSHClient import remoteSSHClient
#Import System modules #Import System modules
import time import time
@ -80,6 +80,7 @@ class Services:
# Algorithm used for load balancing # Algorithm used for load balancing
"privateport": 22, "privateport": 22,
"publicport": 2222, "publicport": 2222,
"protocol": 'TCP',
}, },
"fw_rule":{ "fw_rule":{
"startport": 1, "startport": 1,

View File

@ -21,10 +21,10 @@
import marvin import marvin
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin.remoteSSHClient import remoteSSHClient
#Import System modules #Import System modules
import time import time

View File

@ -23,7 +23,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
class Services: class Services:
"""Test Snapshots Services """Test Snapshots Services

View File

@ -23,7 +23,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
class Services: class Services:

View File

@ -23,7 +23,7 @@ from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
#Import System modules #Import System modules
import os import os
import urllib import urllib

View File

@ -601,7 +601,9 @@ class Template:
time.sleep(interval) time.sleep(interval)
elif 'Installing' not in template.status: elif 'Installing' not in template.status:
raise Exception("ErrorInDownload") raise Exception(
"Error in downloading template: status - %s" %
template.status)
elif timeout == 0: elif timeout == 0:
break break
@ -693,10 +695,12 @@ class Iso:
return return
elif 'Downloaded' not in response.status and \ elif 'Downloaded' not in response.status and \
'Installing' not in response.status: 'Installing' not in response.status:
raise Exception("ErrorInDownload") raise Exception(
"Error In Downloading ISO: ISO Status - %s" %
response.status)
elif timeout == 0: elif timeout == 0:
raise Exception("TimeoutException") raise Exception("ISO download Timeout Exception")
else: else:
timeout = timeout - 1 timeout = timeout - 1
return return
@ -728,12 +732,12 @@ class PublicIPAddress:
if zoneid: if zoneid:
cmd.zoneid = zoneid cmd.zoneid = zoneid
elif "zoneid" in services: elif "zoneid" in services:
services["zoneid"] cmd.zoneid = services["zoneid"]
if domainid: if domainid:
cmd.domainid = domainid cmd.domainid = domainid
elif "domainid" in services: elif "domainid" in services:
services["domainid"] cmd.domainid = services["domainid"]
if networkid: if networkid:
cmd.networkid = networkid cmd.networkid = networkid
@ -1143,7 +1147,7 @@ class LoadBalancerRule:
apiclient.removeFromLoadBalancerRule(cmd) apiclient.removeFromLoadBalancerRule(cmd)
return 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""" """Updates the load balancing rule"""
cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd() cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd()
cmd.id = self.id cmd.id = self.id
@ -1154,8 +1158,40 @@ class LoadBalancerRule:
if name: if name:
cmd.name = name cmd.name = name
[setattr(cmd, k, v) for k, v in kwargs.items()]
return apiclient.updateLoadBalancerRule(cmd) 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 @classmethod
def list(cls, apiclient, **kwargs): def list(cls, apiclient, **kwargs):
"""List all Load balancing rules matching criteria""" """List all Load balancing rules matching criteria"""
@ -1404,6 +1440,15 @@ class Network:
[setattr(cmd, k, v) for k, v in kwargs.items()] [setattr(cmd, k, v) for k, v in kwargs.items()]
return(apiclient.updateNetwork(cmd)) 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 @classmethod
def list(cls, apiclient, **kwargs): def list(cls, apiclient, **kwargs):
"""List all Networks matching criteria""" """List all Networks matching criteria"""

View File

@ -106,7 +106,7 @@ def download_systemplates_sec_storage(server, services):
try: try:
# Login to management server # Login to management server
ssh = remoteSSHClient.remoteSSHClient( ssh = remoteSSHClient(
server["ipaddress"], server["ipaddress"],
server["port"], server["port"],
server["username"], server["username"],

View File

@ -114,12 +114,7 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=50):
loop_cnt = retries loop_cnt = retries
while True: while True:
try: try:
ssh = remoteSSHClient.remoteSSHClient( ssh = remoteSSHClient(ipaddress, port, username, password)
ipaddress,
port,
username,
password
)
except Exception as e: except Exception as e:
if loop_cnt == 0: if loop_cnt == 0:
raise e raise e
@ -161,12 +156,7 @@ def get_process_status(hostip, port, username, password, linklocalip, process):
"""Double hop and returns a process status""" """Double hop and returns a process status"""
#SSH to the machine #SSH to the machine
ssh = remoteSSHClient.remoteSSHClient( ssh = remoteSSHClient(hostip, port, username, password)
hostip,
port,
username,
password
)
ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no " ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no "
ssh_command = ssh_command + \ ssh_command = ssh_command + \
"-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % ( "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (

View File

@ -34,7 +34,7 @@ class Services:
def __init__(self): def __init__(self):
self.services = { self.services = {
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"mode": 'advanced', "mode": 'advanced',
# Networking mode: Basic or advanced # Networking mode: Basic or advanced
@ -460,7 +460,7 @@ class TestPortForwarding(cloudstackTestCase):
"SSHing into VM with IP address %s after NAT rule deletion" % "SSHing into VM with IP address %s after NAT rule deletion" %
self.virtual_machine.ipaddress) self.virtual_machine.ipaddress)
remoteSSHClient.remoteSSHClient( remoteSSHClient(
src_nat_ip_addr.ipaddress, src_nat_ip_addr.ipaddress,
self.virtual_machine.ssh_port, self.virtual_machine.ssh_port,
self.virtual_machine.username, self.virtual_machine.username,
@ -576,7 +576,7 @@ class TestPortForwarding(cloudstackTestCase):
"SSHing into VM with IP address %s after NAT rule deletion" % "SSHing into VM with IP address %s after NAT rule deletion" %
self.virtual_machine.ipaddress) self.virtual_machine.ipaddress)
remoteSSHClient.remoteSSHClient( remoteSSHClient(
ip_address.ipaddress.ipaddress, ip_address.ipaddress.ipaddress,
self.virtual_machine.ssh_port, self.virtual_machine.ssh_port,
self.virtual_machine.username, self.virtual_machine.username,
@ -781,7 +781,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
(self.vm_1.ipaddress, src_nat_ip_addr.ipaddress) (self.vm_1.ipaddress, src_nat_ip_addr.ipaddress)
) )
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
src_nat_ip_addr.ipaddress, src_nat_ip_addr.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -806,7 +806,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
self.vm_2.id self.vm_2.id
)) ))
ssh_2 = remoteSSHClient.remoteSSHClient( ssh_2 = remoteSSHClient(
src_nat_ip_addr.ipaddress, src_nat_ip_addr.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -839,7 +839,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
self.vm_2.id self.vm_2.id
)) ))
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
src_nat_ip_addr.ipaddress, src_nat_ip_addr.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -862,7 +862,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
with self.assertRaises(Exception): with self.assertRaises(Exception):
self.debug("Removed all VMs, trying to SSH") self.debug("Removed all VMs, trying to SSH")
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
src_nat_ip_addr.ipaddress, src_nat_ip_addr.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -972,7 +972,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
self.vm_1.id, self.vm_1.id,
self.vm_2.id self.vm_2.id
)) ))
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
self.non_src_nat_ip.ipaddress.ipaddress, self.non_src_nat_ip.ipaddress.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -991,7 +991,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
self.vm_1.id, self.vm_1.id,
self.vm_2.id self.vm_2.id
)) ))
ssh_2 = remoteSSHClient.remoteSSHClient( ssh_2 = remoteSSHClient(
self.non_src_nat_ip.ipaddress.ipaddress, self.non_src_nat_ip.ipaddress.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -1019,7 +1019,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
self.non_src_nat_ip.ipaddress.ipaddress, self.non_src_nat_ip.ipaddress.ipaddress,
self.vm_2.id self.vm_2.id
)) ))
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
self.non_src_nat_ip.ipaddress.ipaddress, self.non_src_nat_ip.ipaddress.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -1045,7 +1045,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
self.non_src_nat_ip.ipaddress.ipaddress, self.non_src_nat_ip.ipaddress.ipaddress,
self.vm_1.id self.vm_1.id
)) ))
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
self.non_src_nat_ip.ipaddress.ipaddress, self.non_src_nat_ip.ipaddress.ipaddress,
self.services['lbrule']["publicport"], self.services['lbrule']["publicport"],
self.vm_1.username, self.vm_1.username,
@ -1198,7 +1198,7 @@ class TestRebootRouter(cloudstackTestCase):
try: try:
self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id) self.debug("SSH into VM (ID : %s ) after reboot" % self.vm_1.id)
remoteSSHClient.remoteSSHClient( remoteSSHClient(
self.nat_rule.ipaddress, self.nat_rule.ipaddress,
self.services["natrule"]["publicport"], self.services["natrule"]["publicport"],
self.vm_1.username, self.vm_1.username,
@ -1276,7 +1276,7 @@ class TestAssignRemoveLB(cloudstackTestCase):
] ]
return return
def test_assign_and_removal_elb(self): def test_assign_and_removal_lb(self):
"""Test for assign & removing load balancing rule""" """Test for assign & removing load balancing rule"""
# Validate: # Validate:
@ -1350,7 +1350,7 @@ class TestAssignRemoveLB(cloudstackTestCase):
self.vm_2.id self.vm_2.id
)) ))
#Create SSH client for each VM #Create SSH client for each VM
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
self.non_src_nat_ip.ipaddress, self.non_src_nat_ip.ipaddress,
self.services["lbrule"]["publicport"], self.services["lbrule"]["publicport"],
self.vm_1.username, self.vm_1.username,
@ -1367,7 +1367,7 @@ class TestAssignRemoveLB(cloudstackTestCase):
self.vm_1.id, self.vm_1.id,
self.vm_2.id self.vm_2.id
)) ))
ssh_2 = remoteSSHClient.remoteSSHClient( ssh_2 = remoteSSHClient(
self.non_src_nat_ip.ipaddress, self.non_src_nat_ip.ipaddress,
self.services["lbrule"]["publicport"], self.services["lbrule"]["publicport"],
self.vm_2.username, self.vm_2.username,
@ -1409,7 +1409,7 @@ class TestAssignRemoveLB(cloudstackTestCase):
self.vm_1.id, self.vm_1.id,
)) ))
# Again make a SSH connection, as previous is not used after LB remove # 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.non_src_nat_ip.ipaddress,
self.services["lbrule"]["publicport"], self.services["lbrule"]["publicport"],
self.vm_1.username, self.vm_1.username,
@ -1431,13 +1431,13 @@ class TestAssignRemoveLB(cloudstackTestCase):
lb_rule.assign(self.apiclient, [self.vm_3]) lb_rule.assign(self.apiclient, [self.vm_3])
try: try:
ssh_1 = remoteSSHClient.remoteSSHClient( ssh_1 = remoteSSHClient(
self.non_src_nat_ip.ipaddress, self.non_src_nat_ip.ipaddress,
self.services["lbrule"]["publicport"], self.services["lbrule"]["publicport"],
self.vm_1.username, self.vm_1.username,
self.vm_1.password self.vm_1.password
) )
ssh_3 = remoteSSHClient.remoteSSHClient( ssh_3 = remoteSSHClient(
self.non_src_nat_ip.ipaddress, self.non_src_nat_ip.ipaddress,
self.services["lbrule"]["publicport"], self.services["lbrule"]["publicport"],
self.vm_3.username, self.vm_3.username,
@ -1602,7 +1602,7 @@ class TestReleaseIP(cloudstackTestCase):
# SSH Attempt though public IP should fail # SSH Attempt though public IP should fail
with self.assertRaises(Exception): with self.assertRaises(Exception):
ssh_2 = remoteSSHClient.remoteSSHClient( ssh_2 = remoteSSHClient(
self.ip_addr.ipaddress, self.ip_addr.ipaddress,
self.services["natrule"]["publicport"], self.services["natrule"]["publicport"],
self.virtual_machine.username, self.virtual_machine.username,

View File

@ -45,7 +45,7 @@ class Services:
{ {
"displayname": "Test VM", "displayname": "Test VM",
"username": "root", "username": "root",
"password": "fr3sca", "password": "password",
"ssh_port": 22, "ssh_port": 22,
"hypervisor": 'XenServer', "hypervisor": 'XenServer',
"privateport": 22, "privateport": 22,
@ -57,9 +57,9 @@ class Services:
"firstname": "Test", "firstname": "Test",
"lastname": "User", "lastname": "User",
"username": "testuser", "username": "testuser",
"password": "fr3sca", "password": "password",
}, },
"ostypeid":'946b031b-0e10-4f4a-a3fc-d212ae2ea07f', "ostypeid":'1a568aed-db2d-41ca-b644-416b0bdc067e',
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode": 'advanced', #Networking mode: Basic, Advanced "mode": 'advanced', #Networking mode: Basic, Advanced
@ -155,7 +155,7 @@ class TestRouterServices(cloudstackTestCase):
zoneid=router.zoneid, zoneid=router.zoneid,
type='Routing', type='Routing',
state='Up', state='Up',
virtualmachineid=self.vm_1.id id=router.hostid
) )
self.assertEqual( self.assertEqual(
isinstance(hosts, list), isinstance(hosts, list),
@ -217,7 +217,7 @@ class TestRouterServices(cloudstackTestCase):
zoneid=router.zoneid, zoneid=router.zoneid,
type='Routing', type='Routing',
state='Up', state='Up',
virtualmachineid=self.vm_1.id id=router.hostid
) )
self.assertEqual( self.assertEqual(
isinstance(hosts, list), isinstance(hosts, list),
@ -403,7 +403,7 @@ class TestRouterServices(cloudstackTestCase):
zoneid=router.zoneid, zoneid=router.zoneid,
type='Routing', type='Routing',
state='Up', state='Up',
virtualmachineid=self.vm_1.id id=router.hostid
) )
self.assertEqual( self.assertEqual(
isinstance(hosts, list), isinstance(hosts, list),

View File

@ -42,14 +42,6 @@ class Services:
"hypervisor": "XenServer", "hypervisor": "XenServer",
"templatefilter": "self", "templatefilter": "self",
}, },
1: {
"hypervisor": "KVM",
"templatefilter": "self",
},
2: {
"hypervisor": "VMWare",
"templatefilter": "self",
},
}, },
"sleep": 60, "sleep": 60,
"timeout": 5, "timeout": 5,
@ -92,6 +84,7 @@ class TestSecStorageServices(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@unittest.skip("do not add secondary storage")
def test_01_add_sec_storage(self): def test_01_add_sec_storage(self):
"""Test secondary storage """Test secondary storage
""" """

View File

@ -20,10 +20,10 @@
import marvin import marvin
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin.remoteSSHClient import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient
class Services: class Services:

View File

@ -37,7 +37,7 @@ class Services:
self.services = { self.services = {
"host": { "host": {
"username": 'root', # Credentials for SSH "username": 'root', # Credentials for SSH
"password": 'fr3sca', "password": 'password',
"publicport": 22, "publicport": 22,
}, },
"sleep": 60, "sleep": 60,
@ -81,7 +81,6 @@ class TestSSVMs(cloudstackTestCase):
self.apiclient, self.apiclient,
systemvmtype='secondarystoragevm', systemvmtype='secondarystoragevm',
state='Running', state='Running',
zoneid=self.zone.id
) )
self.assertEqual( self.assertEqual(
isinstance(list_ssvm_response, list), isinstance(list_ssvm_response, list),
@ -199,7 +198,6 @@ class TestSSVMs(cloudstackTestCase):
self.apiclient, self.apiclient,
systemvmtype='consoleproxy', systemvmtype='consoleproxy',
state='Running', state='Running',
zoneid=self.zone.id
) )
self.assertEqual( self.assertEqual(
isinstance(list_cpvm_response, list), isinstance(list_cpvm_response, list),

View File

@ -20,7 +20,7 @@
import marvin import marvin
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
@ -45,7 +45,7 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended in create account to # Random characters are appended in create account to
# ensure unique username generated each time # ensure unique username generated each time
"password": "fr3sca", "password": "password",
}, },
"small": "small":
# Create a small virtual machine instance with disk offering # Create a small virtual machine instance with disk offering
@ -87,7 +87,7 @@ class Services:
"name": "Small Instance", "name": "Small Instance",
"displaytext": "Small Instance", "displaytext": "Small Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 500, "cpuspeed": 100,
"memory": 256 "memory": 256
}, },
"medium": "medium":
@ -97,17 +97,17 @@ class Services:
"name": "Medium Instance", "name": "Medium Instance",
"displaytext": "Medium Instance", "displaytext": "Medium Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 1000, "cpuspeed": 100,
"memory": 1024 "memory": 256
} }
}, },
"iso": # ISO settings for Attach/Detach ISO tests "iso": # ISO settings for Attach/Detach ISO tests
{ {
"displaytext": "Test ISO", "displaytext": "Test ISO",
"name": "testISO", "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 # Source URL where ISO is located
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e',
"mode": 'HTTP_DOWNLOAD', # Downloading existing ISO "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO
}, },
"template": { "template": {
@ -121,7 +121,7 @@ class Services:
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
#Migrate VM to hostid #Migrate VM to hostid
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '1a568aed-db2d-41ca-b644-416b0bdc067e',
# CentOS 5.3 (64-bit) # CentOS 5.3 (64-bit)
"mode":'advanced', "mode":'advanced',
} }
@ -754,18 +754,15 @@ class TestVMLifeCycle(cloudstackTestCase):
True, True,
"Check the number of hosts in the zone" "Check the number of hosts in the zone"
) )
self.assertEqual( self.assertGreaterEqual(
len(hosts), len(hosts),
2, 2,
"Atleast 2 hosts should be present in a zone for VM migration" "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.debug("Migrating VM-ID: %s to Host: %s" % (
self.medium_virtual_machine.id, self.medium_virtual_machine.id,
host.id host.id

View File

@ -20,10 +20,10 @@
import marvin import marvin
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin.remoteSSHClient import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient
#Import System modules #Import System modules
import os import os
import urllib import urllib