CLOUDSTACK-9532: Use macchinina as a template for failing tests

- Switches to macchinina as template for VM in the tests
- Modifies the ostype of the macchinina template to 'Other Linux (64-bit)'
- Check template download status, fixes Nonetype iterable issue

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-10-04 23:55:46 +05:30
parent b0d527688f
commit 0c146e14c6
7 changed files with 205 additions and 37 deletions

View File

@ -226,7 +226,7 @@ class Services:
"displaytext": "macchinina kvm", "displaytext": "macchinina kvm",
"format": "qcow2", "format": "qcow2",
"hypervisor": "kvm", "hypervisor": "kvm",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
"requireshvm": "True" "requireshvm": "True"
}, },
@ -235,7 +235,7 @@ class Services:
"displaytext": "macchinina xen", "displaytext": "macchinina xen",
"format": "vhd", "format": "vhd",
"hypervisor": "xenserver", "hypervisor": "xenserver",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
"requireshvm": "True", "requireshvm": "True",
}, },
@ -244,7 +244,7 @@ class Services:
"displaytext": "macchinina xen", "displaytext": "macchinina xen",
"format": "vhd", "format": "vhd",
"hypervisor": "hyperv", "hypervisor": "hyperv",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
"requireshvm": "True", "requireshvm": "True",
}, },
@ -253,7 +253,7 @@ class Services:
"displaytext": "macchinina vmware", "displaytext": "macchinina vmware",
"format": "ova", "format": "ova",
"hypervisor": "vmware", "hypervisor": "vmware",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
"requireshvm": "True", "requireshvm": "True",
} }

View File

@ -242,7 +242,7 @@ class TestPrivateGwACL(cloudstackTestCase):
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select vnet from op_dc_vnet_alloc where physical_network_id=\ "select vnet from op_dc_vnet_alloc where physical_network_id=\
(select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_network.id (select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id
) )
vlans = qresultset vlans = qresultset
vlan_1 = int(vlans[0][0]) vlan_1 = int(vlans[0][0])
@ -369,7 +369,7 @@ class TestPrivateGwACL(cloudstackTestCase):
self.fail("No Physical Networks found!") self.fail("No Physical Networks found!")
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select vnet from op_dc_vnet_alloc where physical_network_id=\ "select vnet from op_dc_vnet_alloc where physical_network_id=\
(select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_network.id (select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id
) )
vlans = qresultset vlans = qresultset
vlan_1 = int(vlans[0][0]) vlan_1 = int(vlans[0][0])

View File

@ -16,6 +16,7 @@
# under the License. # under the License.
# Import Local Modules # Import Local Modules
from marvin.codes import PASS, FAILED
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.cloudstackAPI import (stopVirtualMachine, from marvin.cloudstackAPI import (stopVirtualMachine,
@ -27,6 +28,7 @@ from marvin.lib.utils import (cleanup_resources,
from marvin.lib.base import (ServiceOffering, from marvin.lib.base import (ServiceOffering,
VirtualMachine, VirtualMachine,
Account, Account,
Template,
ServiceOffering, ServiceOffering,
NATRule, NATRule,
NetworkACL, NetworkACL,
@ -52,6 +54,7 @@ from marvin.lib.common import (get_zone,
import time import time
import logging import logging
def check_router_command(virtual_machine, public_ip, ssh_command, check_string, test_case, retries=5): def check_router_command(virtual_machine, public_ip, ssh_command, check_string, test_case, retries=5):
result = 'failed' result = 'failed'
try: try:
@ -63,6 +66,58 @@ def check_router_command(virtual_machine, public_ip, ssh_command, check_string,
logging.debug("Result from SSH into the Virtual Machine: %s" % result) logging.debug("Result from SSH into the Virtual Machine: %s" % result)
return result.count(check_string) return result.count(check_string)
class Templates:
"""Test data for templates
"""
def __init__(self):
self.templates = {
"macchinina": {
"kvm": {
"name": "tiny-kvm",
"displaytext": "macchinina kvm",
"format": "qcow2",
"hypervisor": "kvm",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
"requireshvm": "True",
"ispublic": "True",
},
"xenserver": {
"name": "tiny-xen",
"displaytext": "macchinina xen",
"format": "vhd",
"hypervisor": "xen",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
"requireshvm": "True",
"ispublic": "True",
},
"hyperv": {
"name": "tiny-hyperv",
"displaytext": "macchinina xen",
"format": "vhd",
"hypervisor": "hyperv",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
"requireshvm": "True",
"ispublic": "True",
},
"vmware": {
"name": "tiny-vmware",
"displaytext": "macchinina vmware",
"format": "ova",
"hypervisor": "vmware",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
"requireshvm": "True",
"ispublic": "True",
},
}
}
class TestRedundantIsolateNetworks(cloudstackTestCase): class TestRedundantIsolateNetworks(cloudstackTestCase):
@classmethod @classmethod
@ -81,12 +136,20 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client, macchinina = Templates().templates["macchinina"]
cls.zone.id, cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services["ostype"] cls.logger.debug("Downloading Template: %s from: %s" % (macchinina[cls.hypervisor.lower()],
) macchinina[cls.hypervisor.lower()]["url"]))
cls.template = Template.register(cls.api_client, macchinina[cls.hypervisor.lower()],
cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
cls.template.download(cls.api_client)
if cls.template == FAILED:
assert False, "get_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
# Create an account, network, VM and IP addresses # Create an account, network, VM and IP addresses
cls.account = Account.create( cls.account = Account.create(
@ -122,7 +185,8 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
cls._cleanup = [ cls._cleanup = [
cls.service_offering, cls.service_offering,
cls.account cls.account,
cls.template
] ]
return return

View File

@ -22,6 +22,7 @@ from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs) is_snapshot_on_nfs)
from marvin.lib.base import (VirtualMachine, from marvin.lib.base import (VirtualMachine,
Account, Account,
Template,
ServiceOffering, ServiceOffering,
Snapshot) Snapshot)
from marvin.lib.common import (get_domain, from marvin.lib.common import (get_domain,
@ -32,6 +33,57 @@ from marvin.lib.common import (get_domain,
from marvin.lib.decoratorGenerators import skipTestIf from marvin.lib.decoratorGenerators import skipTestIf
class Templates:
"""Test data for templates
"""
def __init__(self):
self.templates = {
"macchinina": {
"kvm": {
"name": "tiny-kvm",
"displaytext": "macchinina kvm",
"format": "qcow2",
"hypervisor": "kvm",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
"requireshvm": "True",
"ispublic": "True",
},
"xenserver": {
"name": "tiny-xen",
"displaytext": "macchinina xen",
"format": "vhd",
"hypervisor": "xen",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
"requireshvm": "True",
"ispublic": "True",
},
"hyperv": {
"name": "tiny-hyperv",
"displaytext": "macchinina xen",
"format": "vhd",
"hypervisor": "hyperv",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
"requireshvm": "True",
"ispublic": "True",
},
"vmware": {
"name": "tiny-vmware",
"displaytext": "macchinina vmware",
"format": "ova",
"hypervisor": "vmware",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
"requireshvm": "True",
"ispublic": "True",
},
}
}
class TestSnapshotRootDisk(cloudstackTestCase): class TestSnapshotRootDisk(cloudstackTestCase):
@classmethod @classmethod
@ -52,18 +104,18 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls._cleanup = [] cls._cleanup = []
if not cls.hypervisorNotSupported: if not cls.hypervisorNotSupported:
template = get_template( macchinina = Templates().templates["macchinina"]
cls.apiclient, cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()],
cls.zone.id, cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
cls.services["ostype"] cls.template.download(cls.apiclient)
)
if template == FAILED: if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services[ assert False, "get_template() failed to return template"
"ostype"]
cls.services["domainid"] = cls.domain.id cls.services["domainid"] = cls.domain.id
cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["zoneid"] = cls.zone.id
cls.services["templates"]["ostypeid"] = template.ostypeid cls.services["templates"]["ostypeid"] = cls.template.ostypeid
cls.services["zoneid"] = cls.zone.id cls.services["zoneid"] = cls.zone.id
# Create VMs, NAT Rules etc # Create VMs, NAT Rules etc
@ -72,23 +124,26 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls.services["account"], cls.services["account"],
domainid=cls.domain.id domainid=cls.domain.id
) )
cls._cleanup.append(cls.account)
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.apiclient, cls.apiclient,
cls.services["service_offerings"]["tiny"] cls.services["service_offerings"]["tiny"]
) )
cls._cleanup.append(cls.service_offering)
cls.virtual_machine = cls.virtual_machine_with_disk = \ cls.virtual_machine = cls.virtual_machine_with_disk = \
VirtualMachine.create( VirtualMachine.create(
cls.apiclient, cls.apiclient,
cls.services["small"], cls.services["small"],
templateid=template.id, templateid=cls.template.id,
accountid=cls.account.name, accountid=cls.account.name,
domainid=cls.account.domainid, domainid=cls.account.domainid,
zoneid=cls.zone.id, zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id, serviceofferingid=cls.service_offering.id,
mode=cls.services["mode"] mode=cls.services["mode"]
) )
cls._cleanup.append(cls.virtual_machine)
cls._cleanup.append(cls.service_offering)
cls._cleanup.append(cls.account)
cls._cleanup.append(cls.template)
return return
@classmethod @classmethod

View File

@ -18,6 +18,7 @@
""" Test redundancy features for VPC routers """ Test redundancy features for VPC routers
""" """
from marvin.codes import PASS, FAILED
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (stopRouter, from marvin.lib.base import (stopRouter,
@ -25,6 +26,7 @@ from marvin.lib.base import (stopRouter,
destroyRouter, destroyRouter,
rebootRouter, rebootRouter,
Account, Account,
Template,
VpcOffering, VpcOffering,
VPC, VPC,
ServiceOffering, ServiceOffering,
@ -191,8 +193,49 @@ class Services:
"publicport": 22, "publicport": 22,
"protocol": 'TCP', "protocol": 'TCP',
}, },
"ostype": 'CentOS 5.3 (64-bit)',
"timeout": 10, "timeout": 10,
"template": {
"kvm": {
"name": "tiny-kvm",
"displaytext": "macchinina kvm",
"format": "qcow2",
"hypervisor": "kvm",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
"requireshvm": "True",
"ispublic": "True",
},
"xenserver": {
"name": "tiny-xen",
"displaytext": "macchinina xen",
"format": "vhd",
"hypervisor": "xen",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
"requireshvm": "True",
"ispublic": "True",
},
"hyperv": {
"name": "tiny-hyperv",
"displaytext": "macchinina xen",
"format": "vhd",
"hypervisor": "hyperv",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
"requireshvm": "True",
"ispublic": "True",
},
"vmware": {
"name": "tiny-vmware",
"displaytext": "macchinina vmware",
"format": "ova",
"hypervisor": "vmware",
"ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
"requireshvm": "True",
"ispublic": "True",
}
}
} }
@ -210,17 +253,22 @@ class TestVPCRedundancy(cloudstackTestCase):
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client, cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.zone.id, cls.template = Template.register(cls.api_client, cls.services["template"][cls.hypervisor.lower(
cls.services["ostype"]) )], cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
cls.template.download(cls.api_client)
if cls.template == FAILED:
assert False, "get_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"]) cls.services["service_offering"])
cls._cleanup = [cls.service_offering] cls._cleanup = [cls.service_offering, cls.template]
cls.logger = logging.getLogger('TestVPCRedundancy') cls.logger = logging.getLogger('TestVPCRedundancy')
cls.stream_handler = logging.StreamHandler() cls.stream_handler = logging.StreamHandler()
@ -592,7 +640,7 @@ class TestVPCRedundancy(cloudstackTestCase):
gc_interval = Configurations.list(self.apiclient, name="network.gc.interval") gc_interval = Configurations.list(self.apiclient, name="network.gc.interval")
self.logger.debug("network.gc.wait is ==> %s" % gc_wait) self.logger.debug("network.gc.wait is ==> %s" % gc_wait)
self.logger.debug("network.gc.interval is ==> %s" % gc_wait) self.logger.debug("network.gc.interval is ==> %s" % gc_interval)
total_sleep = 120 total_sleep = 120
if gc_wait and gc_interval: if gc_wait and gc_interval:

View File

@ -222,7 +222,7 @@ class Services:
"displaytext": "macchinina kvm", "displaytext": "macchinina kvm",
"format": "qcow2", "format": "qcow2",
"hypervisor": "kvm", "hypervisor": "kvm",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
"requireshvm": "True", "requireshvm": "True",
}, },
@ -232,7 +232,7 @@ class Services:
"displaytext": "macchinina xen", "displaytext": "macchinina xen",
"format": "vhd", "format": "vhd",
"hypervisor": "xen", "hypervisor": "xen",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
"requireshvm": "True", "requireshvm": "True",
}, },
@ -242,7 +242,7 @@ class Services:
"displaytext": "macchinina xen", "displaytext": "macchinina xen",
"format": "vhd", "format": "vhd",
"hypervisor": "hyperv", "hypervisor": "hyperv",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
"requireshvm": "True", "requireshvm": "True",
}, },
@ -252,7 +252,7 @@ class Services:
"displaytext": "macchinina vmware", "displaytext": "macchinina vmware",
"format": "ova", "format": "ova",
"hypervisor": "vmware", "hypervisor": "vmware",
"ostype": "Other PV (64-bit)", "ostype": "Other Linux (64-bit)",
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova", "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
"requireshvm": "True", "requireshvm": "True",
} }

View File

@ -1250,7 +1250,7 @@ class Template:
if isinstance(template_response, list): if isinstance(template_response, list):
template = template_response[0] template = template_response[0]
if retries >=0 and not hasattr(template, 'status'): if not hasattr(template, 'status') or not template or not template.status:
retries = retries - 1 retries = retries - 1
continue continue
@ -1390,9 +1390,10 @@ class Iso:
if isinstance(iso_response, list): if isinstance(iso_response, list):
response = iso_response[0] response = iso_response[0]
if retries >= 0 and not hasattr(response, 'status'): if not hasattr(response, 'status') or not response or not response.status:
retries = retries - 1 retries = retries - 1
continue continue
# Check whether download is in progress(for Ex:10% Downloaded) # Check whether download is in progress(for Ex:10% Downloaded)
# or ISO is 'Successfully Installed' # or ISO is 'Successfully Installed'
if response.status == 'Successfully Installed' and response.isready: if response.status == 'Successfully Installed' and response.isready: