You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2017/12/10 20:47:24 UTC
[cloudstack] branch debian9-systemvmtemplate updated: refactor
tests,
introduce a new get_test_template that returns a small testing template such
as macchinina etc.
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/debian9-systemvmtemplate by this push:
new d9a3a23 refactor tests, introduce a new get_test_template that returns a small testing template such as macchinina etc.
d9a3a23 is described below
commit d9a3a23fce7b22b817efe4b9a96b1592e64220db
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Mon Dec 11 02:09:46 2017 +0530
refactor tests, introduce a new get_test_template that returns a small testing template such as macchinina etc.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
.../smoke/test_deploy_vm_with_userdata.py | 11 +--
...st_deploy_vms_with_varied_deploymentplanners.py | 9 +-
test/integration/smoke/test_internal_lb.py | 53 ++----------
test/integration/smoke/test_loadbalance.py | 10 +--
test/integration/smoke/test_metrics_api.py | 4 +-
test/integration/smoke/test_multipleips_per_nic.py | 7 +-
test/integration/smoke/test_network_acl.py | 9 +-
test/integration/smoke/test_nic_adapter_type.py | 6 +-
test/integration/smoke/test_password_server.py | 7 +-
test/integration/smoke/test_portforwardingrules.py | 6 +-
test/integration/smoke/test_privategw_acl.py | 7 +-
test/integration/smoke/test_router_dns.py | 11 ++-
test/integration/smoke/test_router_dnsservice.py | 11 +--
test/integration/smoke/test_routers.py | 12 ++-
.../smoke/test_routers_iptables_default_policy.py | 15 ++--
test/integration/smoke/test_routers_network_ops.py | 71 ++--------------
test/integration/smoke/test_service_offerings.py | 9 +-
test/integration/smoke/test_snapshots.py | 65 +--------------
test/integration/smoke/test_vpc_redundant.py | 55 ++-----------
test/integration/smoke/test_vpc_vpn.py | 92 ++-------------------
.../definitions/systemvmtemplate/cleanup.sh | 1 -
tools/marvin/marvin/lib/base.py | 7 +-
tools/marvin/marvin/lib/common.py | 95 ++++++++++++++++++++++
23 files changed, 203 insertions(+), 370 deletions(-)
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 96c9986..52b71f7 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -19,7 +19,7 @@ from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (ServiceOffering,
VirtualMachine,
Account)
-from marvin.lib.common import get_template, get_zone, list_virtual_machines
+from marvin.lib.common import get_test_template, get_zone, list_virtual_machines
from marvin.lib.utils import cleanup_resources
from nose.plugins.attrib import attr
from marvin.codes import FAILED
@@ -37,6 +37,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiClient, testClient.getZoneForTests())
+ cls.hypervisor = testClient.getHypervisorInfo()
if cls.zone.localstorageenabled:
#For devcloud since localstroage is enabled
cls.services["service_offerings"]["tiny"]["storagetype"] = "local"
@@ -46,14 +47,14 @@ class TestDeployVmWithUserData(cloudstackTestCase):
)
cls.account = Account.create(cls.apiClient, services=cls.services["account"])
cls.cleanup = [cls.account]
- cls.template = get_template(
+ cls.template = get_test_template(
cls.apiClient,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
if cls.template == FAILED:
- assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+ assert False, "get_test_template() failed to return template"
cls.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,\
@@ -68,7 +69,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
cls.services["virtual_machine"]["userdata"] = user_data
def setup(self):
- self.hypervisor = self.testClient.getHypervisorInfo()
+ self.hypervisor = self.testClient.getHypervisorInfo()
@attr(tags=["devcloud", "basic", "advanced", "post"], required_hardware="true")
def test_deployvm_userdata_post(self):
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index 1ef6af9..62ba1a4 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -18,7 +18,7 @@
from marvin.codes import FAILED
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster
-from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.lib.common import get_zone, get_domain, get_test_template
from marvin.lib.utils import cleanup_resources
from nose.plugins.attrib import attr
@@ -36,14 +36,15 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
- cls.template = get_template(
+ cls.hypervisor = testClient.getHypervisorInfo()
+ cls.template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
if cls.template == FAILED:
- assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+ assert False, "get_test_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 379bbb0..21a6f40 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -47,7 +47,7 @@ from marvin.sshClient import SshClient
from marvin.lib.common import (get_zone,
get_domain,
- get_template,
+ get_test_template,
list_network_offerings)
from marvin.lib.decoratorGenerators import skipTestIf
@@ -221,44 +221,6 @@ class Services:
"privateport": 22,
"publicport": 22,
"protocol": 'TCP',
- },
- "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"
- },
- "xenserver": {
- "name": "tiny-xen",
- "displaytext": "macchinina xen",
- "format": "vhd",
- "hypervisor": "xenserver",
- "ostype": "Other Linux (64-bit)",
- "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
- "requireshvm": "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",
- },
- "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",
- }
}
}
@@ -294,12 +256,14 @@ class TestInternalLb(cloudstackTestCase):
cls.hypervisor = testClient.getHypervisorInfo()
- cls.logger.debug("Downloading Template: %s from: %s" %(cls.services["template"][cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
- cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower()], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
- cls.template.download(cls.apiclient)
+ cls.template = get_test_template(
+ cls.apiclient,
+ cls.zone.id,
+ cls.hypervisor
+ )
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.logger.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,
@@ -857,9 +821,6 @@ class TestInternalLb(cloudstackTestCase):
def tearDownClass(cls):
try:
cls.logger.debug("Cleaning up class resources")
- try:
- cls.template.delete(cls.apiclient)
- except Exception: pass
cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Cleanup failed with %s" % e)
diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py
index 8e958a9..53047f9 100644
--- a/test/integration/smoke/test_loadbalance.py
+++ b/test/integration/smoke/test_loadbalance.py
@@ -40,14 +40,14 @@ class TestLoadBalance(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
- template = get_template(
+ cls.hypervisor = testClient.getHypervisorInfo()
+ template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"]
- )
+ cls.hypervisor)
if template == FAILED:
- assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
-
+ assert False, "get_test_template() failed to return template"
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
#Create an account, network, VM and IP addresses
diff --git a/test/integration/smoke/test_metrics_api.py b/test/integration/smoke/test_metrics_api.py
index 27c4a1b..7cd09b4 100644
--- a/test/integration/smoke/test_metrics_api.py
+++ b/test/integration/smoke/test_metrics_api.py
@@ -49,10 +49,10 @@ class TestMetrics(cloudstackTestCase):
self.apiclient,
self.services["service_offering"]
)
- self.template = get_template(
+ self.template = get_test_template(
self.apiclient,
self.zone.id,
- self.services["ostype"]
+ self.hypervisor
)
self.cleanup = []
diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py
index 4093356..3078328 100644
--- a/test/integration/smoke/test_multipleips_per_nic.py
+++ b/test/integration/smoke/test_multipleips_per_nic.py
@@ -30,7 +30,7 @@ from marvin.lib.base import Account, VirtualMachine, ServiceOffering
from marvin.lib.utils import cleanup_resources
#common - commonly used methods for all tests are listed here
-from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.lib.common import get_zone, get_domain, get_test_template
from marvin.cloudstackAPI.addIpToNic import addIpToNicCmd
from marvin.cloudstackAPI.removeIpFromNic import removeIpFromNicCmd
@@ -50,11 +50,12 @@ class TestDeployVM(cloudstackTestCase):
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+ self.hypervisor = self.testClient.getHypervisorInfo()
self.testdata["mode"] = self.zone.networktype
- self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+ self.template = get_test_template(self.apiclient, self.zone.id, self.hypervisor)
if self.template == FAILED:
- assert False, "get_template() failed to return template with description %s" % self.testdata["ostype"]
+ assert False, "get_test_template() failed to return template"
#create a user account
self.account = Account.create(
diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py
index 734c312..7b8aa36 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -34,20 +34,21 @@ class TestNetworkACL(cloudstackTestCase):
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+ cls.hypervisor = testClient.getHypervisorInfo()
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offerings"]["tiny"]
)
cls.account = Account.create(cls.apiclient, services=cls.services["account"])
- cls.template = get_template(
+ cls.template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
-
+
if cls.template == FAILED:
- assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+ assert False, "get_test_template() failed to return template"
cls.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,\
diff --git a/test/integration/smoke/test_nic_adapter_type.py b/test/integration/smoke/test_nic_adapter_type.py
index 91492eb..933b8d9 100644
--- a/test/integration/smoke/test_nic_adapter_type.py
+++ b/test/integration/smoke/test_nic_adapter_type.py
@@ -33,7 +33,7 @@ from marvin.lib.base import (
)
from marvin.lib.common import (get_domain,
get_zone,
- get_template
+ get_test_template
)
from marvin.lib.utils import (
get_hypervisor_type,
@@ -57,10 +57,10 @@ class TestAdapterTypeForNic(cloudstackTestCase):
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
- cls.template = get_template(
+ cls.template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.testdata["ostype"])
+ cls.hypervisor)
# Create Accounts & networks
cls.testdata["isolated_network"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_password_server.py b/test/integration/smoke/test_password_server.py
index 98c5ced..b623313 100644
--- a/test/integration/smoke/test_password_server.py
+++ b/test/integration/smoke/test_password_server.py
@@ -35,7 +35,7 @@ from marvin.lib.base import (ServiceOffering,
Network,
Router)
from marvin.lib.common import (get_zone,
- get_template,
+ get_test_template,
get_domain,
list_virtual_machines,
list_networks,
@@ -69,11 +69,12 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
- template = get_template(
+ template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_portforwardingrules.py b/test/integration/smoke/test_portforwardingrules.py
index fbac0b4..11901bd 100644
--- a/test/integration/smoke/test_portforwardingrules.py
+++ b/test/integration/smoke/test_portforwardingrules.py
@@ -38,7 +38,7 @@ from marvin.lib.base import (PublicIPAddress,
User)
from marvin.lib.common import (get_domain,
get_zone,
- get_template)
+ get_test_template)
from marvin.lib.utils import validateList, cleanup_resources
from marvin.codes import PASS
from nose.plugins.attrib import attr
@@ -58,10 +58,10 @@ class TestPortForwardingRules(cloudstackTestCase):
cls.zone = get_zone(
cls.api_client,
cls.testClient.getZoneForTests())
- cls.template = get_template(
+ cls.template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
if cls.zone.localstorageenabled:
cls.storagetype = 'local'
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index d48eb42..09d3fa4 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -168,11 +168,12 @@ class TestPrivateGwACL(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
- cls.template = get_template(
+ cls.template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"])
+ cls.hypervisor)
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -183,8 +184,6 @@ class TestPrivateGwACL(cloudstackTestCase):
cls.services["service_offering"])
cls._cleanup = [cls.service_offering]
- cls.hypervisor = cls.testClient.getHypervisorInfo()
-
# Skip rVR related test cases for VMware, for details see
# https://issues.apache.org/jira/browse/CLOUDSTACK-10181
cls.rvrNotSupported = False
diff --git a/test/integration/smoke/test_router_dns.py b/test/integration/smoke/test_router_dns.py
index 9b4ca7e..ec1d275 100644
--- a/test/integration/smoke/test_router_dns.py
+++ b/test/integration/smoke/test_router_dns.py
@@ -29,7 +29,7 @@ from marvin.lib.base import (ServiceOffering,
NetworkOffering,
Network)
from marvin.lib.common import (get_zone,
- get_template,
+ get_test_template,
get_domain,
list_routers,
list_nat_rules,
@@ -51,12 +51,15 @@ class TestRouterDns(cloudstackTestCase):
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
+
cls.services['mode'] = cls.zone.networktype
- cls.template = get_template(
+ cls.template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
+
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, cls.zone.id))
@@ -264,5 +267,5 @@ class TestRouterDns(cloudstackTestCase):
if not result:
self.fail("Did not to receive any response from the guest VM, failing.")
- self.assertTrue("google.com" in result and "#53" in result,
+ self.assertTrue("google.com" in result and "10.1.1.1" in result,
"VR DNS should serve requests from guest network, unable to get valid nslookup result from guest VM.")
diff --git a/test/integration/smoke/test_router_dnsservice.py b/test/integration/smoke/test_router_dnsservice.py
index ffadec7..d0c5a67 100644
--- a/test/integration/smoke/test_router_dnsservice.py
+++ b/test/integration/smoke/test_router_dnsservice.py
@@ -29,7 +29,7 @@ from marvin.lib.base import (ServiceOffering,
NetworkOffering,
Network)
from marvin.lib.common import (get_zone,
- get_template,
+ get_test_template,
get_domain,
list_routers,
list_nat_rules,
@@ -54,11 +54,12 @@ class TestRouterDnsService(cloudstackTestCase):
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
- cls.template = get_template(
+ cls.template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -267,9 +268,9 @@ class TestRouterDnsService(cloudstackTestCase):
if not result1:
self.fail("Did not to receive any response from the guest VM, failing.")
- self.assertTrue(VM1_NAME in result1 and "#53" in result1,
+ self.assertTrue(VM1_NAME in result1 and "10.1.1.1" in result1,
"VR DNS should serve requests from guest network, ping for %s successful." % VM1_NAME)
- self.assertTrue(VM2_NAME in result2 and "#53" in result2,
+ self.assertTrue(VM2_NAME in result2 and "10.1.1.1" in result2,
"VR DNS should serve requests from guest network, ping for %s successful." % VM2_NAME)
return
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 070841e..dfd5916 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -31,7 +31,7 @@ from marvin.lib.base import (Account,
VirtualMachine)
from marvin.lib.common import (get_domain,
get_zone,
- get_template,
+ get_test_template,
list_hosts,
list_routers,
list_networks,
@@ -57,17 +57,15 @@ class TestRouterServices(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+ cls.hypervisor = testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
- template = get_template(
+ template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
if template == FAILED:
- cls.fail(
- "get_template() failed to return template\
- with description %s" %
- cls.services["ostype"])
+ cls.fail("get_test_template() failed to return template")
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py
index ec35396..c077b56 100644
--- a/test/integration/smoke/test_routers_iptables_default_policy.py
+++ b/test/integration/smoke/test_routers_iptables_default_policy.py
@@ -35,7 +35,7 @@ from marvin.lib.base import (stopRouter,
LoadBalancerRule)
from marvin.lib.common import (get_domain,
get_zone,
- get_template,
+ get_test_template,
list_routers,
list_hosts)
from marvin.lib.utils import (cleanup_resources,
@@ -214,10 +214,12 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
- cls.template = get_template(
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
+ cls.template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"])
+ cls.hypervisor)
+
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -366,11 +368,12 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
- cls.template = get_template(
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
+ cls.template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"])
-
+ cls.hypervisor)
+
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
diff --git a/test/integration/smoke/test_routers_network_ops.py b/test/integration/smoke/test_routers_network_ops.py
index 09eb4f3..c189437 100644
--- a/test/integration/smoke/test_routers_network_ops.py
+++ b/test/integration/smoke/test_routers_network_ops.py
@@ -39,7 +39,7 @@ from marvin.lib.base import (ServiceOffering,
Router,
EgressFireWallRule)
from marvin.lib.common import (get_zone,
- get_template,
+ get_test_template,
get_domain,
list_virtual_machines,
list_networks,
@@ -67,57 +67,6 @@ def check_router_command(virtual_machine, public_ip, ssh_command, 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):
@classmethod
@@ -146,15 +95,9 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
cls.rvrNotSupported = True
return
- macchinina = Templates().templates["macchinina"]
- 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)
-
+ cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
@@ -193,8 +136,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
cls._cleanup = [
cls.service_offering,
- cls.account,
- cls.template
+ cls.account
]
return
@@ -723,11 +665,12 @@ class TestIsolatedNetworks(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
- cls.template = get_template(
+ cls.template = get_test_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 519b5ae..42bebe0 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -31,7 +31,7 @@ from marvin.lib.common import (list_service_offering,
list_virtual_machines,
get_domain,
get_zone,
- get_template)
+ get_test_template)
from nose.plugins.attrib import attr
@@ -163,14 +163,13 @@ class TestServiceOfferings(cloudstackTestCase):
cls.apiclient,
cls.services["service_offerings"]["tiny"]
)
- template = get_template(
+ template = get_test_template(
cls.apiclient,
cls.zone.id,
- cls.services["ostype"]
+ cls.hypervisor
)
if template == FAILED:
- assert False, "get_template() failed to return\
- template with description %s" % cls.services["ostype"]
+ assert False, "get_test_template() failed to return template"
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index 5761262..a75a1e9 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -30,7 +30,7 @@ from marvin.lib.base import (VirtualMachine,
Volume,
DiskOffering)
from marvin.lib.common import (get_domain,
- get_template,
+ get_test_template,
get_zone,
get_pod,
list_volumes,
@@ -41,57 +41,6 @@ from marvin.lib.decoratorGenerators import skipTestIf
from marvin.codes import PASS
-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
@@ -113,14 +62,9 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls._cleanup = []
if not cls.hypervisorNotSupported:
- 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)
-
+ cls.template = get_test_template(cls.apiclient, cl.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
-
+ assert False, "get_test_template() failed to return template"
cls.services["domainid"] = cls.domain.id
cls.services["small"]["zoneid"] = cls.zone.id
@@ -155,7 +99,6 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls._cleanup.append(cls.service_offering)
cls._cleanup.append(cls.account)
- cls._cleanup.append(cls.template)
cls._cleanup.append(cls.disk_offering)
return
@@ -430,4 +373,4 @@ class TestSnapshotRootDisk(cloudstackTestCase):
"Check list Snapshot response"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index 915736d..b87ce43 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -40,7 +40,7 @@ from marvin.lib.base import (stopRouter,
Configurations)
from marvin.lib.common import (get_domain,
get_zone,
- get_template,
+ get_test_template,
list_routers,
list_hosts)
from marvin.lib.utils import (cleanup_resources,
@@ -193,49 +193,7 @@ class Services:
"publicport": 22,
"protocol": 'TCP',
},
- "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",
- }
- }
+ "timeout": 10
}
@@ -263,12 +221,9 @@ class TestVPCRedundancy(cloudstackTestCase):
cls.rvrNotSupported = True
return
- 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)
-
+ cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
@@ -276,7 +231,7 @@ class TestVPCRedundancy(cloudstackTestCase):
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"])
- cls._cleanup = [cls.service_offering, cls.template]
+ cls._cleanup = [cls.service_offering]
cls.logger = logging.getLogger('TestVPCRedundancy')
cls.stream_handler = logging.StreamHandler()
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 1c4d418..4ab5971 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -52,7 +52,7 @@ from marvin.sshClient import SshClient
from marvin.lib.common import (get_zone,
get_domain,
- get_template,
+ get_test_template,
list_network_offerings)
from nose.plugins.attrib import attr
@@ -215,48 +215,6 @@ class Services:
"privateport": 22,
"publicport": 22,
"protocol": 'TCP',
- },
- "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",
- },
-
- "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",
- },
-
- "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",
- },
-
- "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",
- }
}
}
@@ -287,14 +245,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
cls.hypervisor = testClient.getHypervisorInfo()
- cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
- cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
- cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
- )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
- cls.template.download(cls.apiclient)
-
+ cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.logger.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,
@@ -436,9 +389,6 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
try:
cls.logger.debug("Cleaning up resources")
- try:
- cls.template.delete(cls.apiclient)
- except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)
@@ -470,14 +420,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
cls.hypervisor = testClient.getHypervisorInfo()
- cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
- cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
- cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
- )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
- cls.template.download(cls.apiclient)
-
+ cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.logger.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,
@@ -813,9 +758,6 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- try:
- cls.template.delete(cls.apiclient)
- except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)
@@ -854,14 +796,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
cls.rvrNotSupported = True
return
- cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
- cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
- cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
- )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
- cls.template.download(cls.apiclient)
-
+ cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.logger.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,
@@ -1203,9 +1140,6 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- try:
- cls.template.delete(cls.apiclient)
- except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)
@@ -1237,14 +1171,9 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
cls.hypervisor = testClient.getHypervisorInfo()
- cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
- cls.hypervisor.lower()], cls.services["template"][cls.hypervisor.lower()]["url"]))
- cls.template = Template.register(cls.apiclient, cls.services["template"][cls.hypervisor.lower(
- )], cls.zone.id, hypervisor=cls.hypervisor.lower(), account=cls.account.name, domainid=cls.domain.id)
- cls.template.download(cls.apiclient)
-
+ cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
- assert False, "get_template() failed to return template"
+ assert False, "get_test_template() failed to return template"
cls.logger.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,
@@ -1651,9 +1580,6 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- try:
- cls.template.delete(cls.apiclient)
- except Exception: pass
cleanup_resources(cls.apiclient, cls.cleanup)
except Exception, e:
raise Exception("Cleanup failed with %s" % e)
diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
index f1591ac..00f068d 100644
--- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh
+++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh
@@ -64,7 +64,6 @@ function cleanup_misc() {
rm -fr /usr/share/man
rm -fr /usr/share/info
rm -fr /usr/share/lintian
- rm -fr /usr/share/vim
find /usr/share/locale -type f | grep -v en | xargs rm -fr
}
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 340419a..6f26009 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1225,13 +1225,16 @@ class Template:
@classmethod
def register(cls, apiclient, services, zoneid=None,
account=None, domainid=None, hypervisor=None,
- projectid=None, details=None):
+ projectid=None, details=None, randomize_name=True):
"""Create template from URL"""
# Create template from Virtual machine and Volume ID
cmd = registerTemplate.registerTemplateCmd()
cmd.displaytext = services["displaytext"]
- cmd.name = "-".join([services["name"], random_gen()])
+ if randomize_name:
+ cmd.name = "-".join([services["name"], random_gen()])
+ else:
+ cmd.name = services["name"]
cmd.format = services["format"]
if hypervisor:
cmd.hypervisor = hypervisor
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index d1b872a..32abda7 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -76,6 +76,7 @@ from marvin.lib.base import (PhysicalNetwork,
NATRule,
StaticNATRule,
Volume,
+ Template,
Account,
Project,
Snapshot,
@@ -296,6 +297,7 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
if validateList(cmd_out)[0] != PASS:
return FAILED
return cmd_out[0]
+
def get_template(
apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN',
template_id=None, template_name=None, account=None, domain_id=None, project_id=None,
@@ -342,6 +344,99 @@ def get_template(
return list_templatesout[0]
+def get_test_template(apiclient, zone_id=None, hypervisor=None):
+ """
+ @Name : get_test_template
+ @Desc : Retrieves the test template used to running tests. When the template
+ is missing it will be download at most one in a zone for a hypervisor.
+ @Input : returns a template
+ """
+ test_templates = {
+ "kvm": {
+ "name": "tiny-kvm",
+ "displaytext": "tiny 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",
+ "isextractable": "True"
+ },
+ "xenserver": {
+ "name": "tiny-xen",
+ "displaytext": "tiny xen",
+ "format": "vhd",
+ "hypervisor": "xenserver",
+ "ostype": "Other Linux (64-bit)",
+ "url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
+ "requireshvm": "True",
+ "ispublic": "True",
+ "isextractable": "True"
+ },
+ "hyperv": {
+ "name": "tiny-hyperv",
+ "displaytext": "tiny hyperv",
+ "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",
+ "isextractable": "True"
+ },
+ "vmware": {
+ "name": "tiny-vmware",
+ "displaytext": "tiny 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"
+ },
+ "simulator": {
+ "name": "tiny-simulator",
+ "displaytext": "tiny simulator",
+ "format": "vhd",
+ "hypervisor": "simulator",
+ "ostype": "Other Linux (64-bit)",
+ "url": "http://fake.url/tiny.vhd.bz2",
+ "requireshvm": "True",
+ "ispublic": "True"
+ }
+ }
+
+ if hypervisor is None:
+ return FAILED
+
+ hypervisor = hypervisor.lower()
+ if hypervisor not in test_templates.keys():
+ print "Provided hypervisor has no test template"
+ return FAILED
+
+ test_template = test_templates[hypervisor]
+
+ cmd = listTemplates.listTemplatesCmd()
+ cmd.name = test_template['name']
+ cmd.templatefilter = 'all'
+ if zone_id is not None:
+ cmd.zoneid = zone_id
+ if hypervisor is not None:
+ cmd.hypervisor = hypervisor
+ templates = apiclient.listTemplates(cmd)
+
+ if validateList(templates)[0] != PASS:
+ template = Template.register(apiclient, test_template, zoneid=zone_id, hypervisor=hypervisor.lower(), randomize_name=False)
+ template.download(apiclient)
+ return template
+
+ for template in templates:
+ if template.isready and template.ispublic:
+ return template
+
+ return FAILED
+
def get_windows_template(
apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='USER',
--
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].