mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
b0d527688f
commit
0c146e14c6
@ -226,7 +226,7 @@ class Services:
|
||||
"displaytext": "macchinina kvm",
|
||||
"format": "qcow2",
|
||||
"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",
|
||||
"requireshvm": "True"
|
||||
},
|
||||
@ -235,7 +235,7 @@ class Services:
|
||||
"displaytext": "macchinina xen",
|
||||
"format": "vhd",
|
||||
"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",
|
||||
"requireshvm": "True",
|
||||
},
|
||||
@ -244,7 +244,7 @@ class Services:
|
||||
"displaytext": "macchinina xen",
|
||||
"format": "vhd",
|
||||
"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",
|
||||
"requireshvm": "True",
|
||||
},
|
||||
@ -253,7 +253,7 @@ class Services:
|
||||
"displaytext": "macchinina vmware",
|
||||
"format": "ova",
|
||||
"hypervisor": "vmware",
|
||||
"ostype": "Other PV (64-bit)",
|
||||
"ostype": "Other Linux (64-bit)",
|
||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||
"requireshvm": "True",
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ class TestPrivateGwACL(cloudstackTestCase):
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"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
|
||||
vlan_1 = int(vlans[0][0])
|
||||
@ -369,7 +369,7 @@ class TestPrivateGwACL(cloudstackTestCase):
|
||||
self.fail("No Physical Networks found!")
|
||||
qresultset = self.dbclient.execute(
|
||||
"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
|
||||
vlan_1 = int(vlans[0][0])
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
# under the License.
|
||||
|
||||
# Import Local Modules
|
||||
from marvin.codes import PASS, FAILED
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.cloudstackAPI import (stopVirtualMachine,
|
||||
@ -27,6 +28,7 @@ from marvin.lib.utils import (cleanup_resources,
|
||||
from marvin.lib.base import (ServiceOffering,
|
||||
VirtualMachine,
|
||||
Account,
|
||||
Template,
|
||||
ServiceOffering,
|
||||
NATRule,
|
||||
NetworkACL,
|
||||
@ -52,6 +54,7 @@ from marvin.lib.common import (get_zone,
|
||||
import time
|
||||
import logging
|
||||
|
||||
|
||||
def check_router_command(virtual_machine, public_ip, ssh_command, check_string, test_case, retries=5):
|
||||
result = 'failed'
|
||||
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)
|
||||
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):
|
||||
|
||||
@classmethod
|
||||
@ -81,12 +136,20 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
|
||||
cls.domain = get_domain(cls.api_client)
|
||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||
cls.services['mode'] = cls.zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
|
||||
macchinina = Templates().templates["macchinina"]
|
||||
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||
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"]["template"] = cls.template.id
|
||||
|
||||
# Create an account, network, VM and IP addresses
|
||||
cls.account = Account.create(
|
||||
@ -122,7 +185,8 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
|
||||
|
||||
cls._cleanup = [
|
||||
cls.service_offering,
|
||||
cls.account
|
||||
cls.account,
|
||||
cls.template
|
||||
]
|
||||
|
||||
return
|
||||
|
||||
@ -22,6 +22,7 @@ from marvin.lib.utils import (cleanup_resources,
|
||||
is_snapshot_on_nfs)
|
||||
from marvin.lib.base import (VirtualMachine,
|
||||
Account,
|
||||
Template,
|
||||
ServiceOffering,
|
||||
Snapshot)
|
||||
from marvin.lib.common import (get_domain,
|
||||
@ -32,6 +33,57 @@ from marvin.lib.common import (get_domain,
|
||||
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):
|
||||
|
||||
@classmethod
|
||||
@ -52,18 +104,18 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
||||
|
||||
cls._cleanup = []
|
||||
if not cls.hypervisorNotSupported:
|
||||
template = get_template(
|
||||
cls.apiclient,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
if template == FAILED:
|
||||
assert False, "get_template() failed to return template with description %s" % cls.services[
|
||||
"ostype"]
|
||||
macchinina = Templates().templates["macchinina"]
|
||||
cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()],
|
||||
cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
|
||||
cls.template.download(cls.apiclient)
|
||||
|
||||
if cls.template == FAILED:
|
||||
assert False, "get_template() failed to return template"
|
||||
|
||||
|
||||
cls.services["domainid"] = cls.domain.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
|
||||
|
||||
# Create VMs, NAT Rules etc
|
||||
@ -72,23 +124,26 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
||||
cls.services["account"],
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
cls._cleanup.append(cls.account)
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.apiclient,
|
||||
cls.services["service_offerings"]["tiny"]
|
||||
)
|
||||
cls._cleanup.append(cls.service_offering)
|
||||
cls.virtual_machine = cls.virtual_machine_with_disk = \
|
||||
VirtualMachine.create(
|
||||
cls.apiclient,
|
||||
cls.services["small"],
|
||||
templateid=template.id,
|
||||
templateid=cls.template.id,
|
||||
accountid=cls.account.name,
|
||||
domainid=cls.account.domainid,
|
||||
zoneid=cls.zone.id,
|
||||
serviceofferingid=cls.service_offering.id,
|
||||
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
|
||||
|
||||
@classmethod
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
""" Test redundancy features for VPC routers
|
||||
"""
|
||||
|
||||
from marvin.codes import PASS, FAILED
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.lib.base import (stopRouter,
|
||||
@ -25,6 +26,7 @@ from marvin.lib.base import (stopRouter,
|
||||
destroyRouter,
|
||||
rebootRouter,
|
||||
Account,
|
||||
Template,
|
||||
VpcOffering,
|
||||
VPC,
|
||||
ServiceOffering,
|
||||
@ -191,8 +193,49 @@ class Services:
|
||||
"publicport": 22,
|
||||
"protocol": 'TCP',
|
||||
},
|
||||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
"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
|
||||
cls.domain = get_domain(cls.api_client)
|
||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"])
|
||||
|
||||
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||
cls.template = Template.register(cls.api_client, cls.services["template"][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"]["template"] = cls.template.id
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"])
|
||||
cls._cleanup = [cls.service_offering]
|
||||
cls._cleanup = [cls.service_offering, cls.template]
|
||||
|
||||
cls.logger = logging.getLogger('TestVPCRedundancy')
|
||||
cls.stream_handler = logging.StreamHandler()
|
||||
@ -592,7 +640,7 @@ class TestVPCRedundancy(cloudstackTestCase):
|
||||
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.interval is ==> %s" % gc_wait)
|
||||
self.logger.debug("network.gc.interval is ==> %s" % gc_interval)
|
||||
|
||||
total_sleep = 120
|
||||
if gc_wait and gc_interval:
|
||||
|
||||
@ -222,7 +222,7 @@ class Services:
|
||||
"displaytext": "macchinina kvm",
|
||||
"format": "qcow2",
|
||||
"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",
|
||||
"requireshvm": "True",
|
||||
},
|
||||
@ -232,7 +232,7 @@ class Services:
|
||||
"displaytext": "macchinina xen",
|
||||
"format": "vhd",
|
||||
"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",
|
||||
"requireshvm": "True",
|
||||
},
|
||||
@ -242,7 +242,7 @@ class Services:
|
||||
"displaytext": "macchinina xen",
|
||||
"format": "vhd",
|
||||
"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",
|
||||
"requireshvm": "True",
|
||||
},
|
||||
@ -252,7 +252,7 @@ class Services:
|
||||
"displaytext": "macchinina vmware",
|
||||
"format": "ova",
|
||||
"hypervisor": "vmware",
|
||||
"ostype": "Other PV (64-bit)",
|
||||
"ostype": "Other Linux (64-bit)",
|
||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||
"requireshvm": "True",
|
||||
}
|
||||
|
||||
@ -1250,7 +1250,7 @@ class Template:
|
||||
|
||||
if isinstance(template_response, list):
|
||||
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
|
||||
continue
|
||||
|
||||
@ -1390,9 +1390,10 @@ class Iso:
|
||||
|
||||
if isinstance(iso_response, list):
|
||||
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
|
||||
continue
|
||||
|
||||
# Check whether download is in progress(for Ex:10% Downloaded)
|
||||
# or ISO is 'Successfully Installed'
|
||||
if response.status == 'Successfully Installed' and response.isready:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user