You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/08/29 10:41:11 UTC
[1/2] git commit: updated refs/heads/master to c6f0d46
Updated Branches:
refs/heads/master da6f048dd -> c6f0d4691
CLOUDSTACK-4407: Use extractTemplate API to get hypervisor specific template information
Template url, hypervisor and format were defined in Service class to be Xenserver specific
and therefore registering a new template failed on Vmware and KVM.
Fixed this to get hypervisor specific info for registering new template.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit 20256706b376551fe8993ee2e73c61df31dcb6de)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c6f0d469
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c6f0d469
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c6f0d469
Branch: refs/heads/master
Commit: c6f0d46911143ef79bec86d4b989d9256f15b29e
Parents: 1058654
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Mon Aug 26 18:27:53 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Aug 29 14:10:54 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_templates.py | 76 +++++++++++-----------
tools/marvin/marvin/integration/lib/base.py | 11 ++++
tools/marvin/marvin/integration/lib/common.py | 19 ++++++
3 files changed, 69 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6f0d469/test/integration/component/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py
index e4599d4..ea4b277 100644
--- a/test/integration/component/test_templates.py
+++ b/test/integration/component/test_templates.py
@@ -174,67 +174,69 @@ class TestCreateTemplate(cloudstackTestCase):
# tar bzip template.
# 6. Verify VMs & Templates is up and in ready state
- for k, v in self.services["templates"].items():
+ builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
+ self.services["templates"][0]["url"] = builtin_info[0]
+ self.services["templates"][0]["hypervisor"] = builtin_info[1]
+ self.services["templates"][0]["format"] = builtin_info[2]
- # Register new template
- template = Template.register(
+ # Register new template
+ template = Template.register(
self.apiclient,
- v,
+ self.services["templates"][0],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
)
- self.debug(
+ self.debug(
"Registered a template of format: %s with ID: %s" % (
- v["format"],
+ self.services["templates"][0]["format"],
template.id
))
- # Wait for template to download
- template.download(self.apiclient)
- self.cleanup.append(template)
-
- # Wait for template status to be changed across
- time.sleep(self.services["sleep"])
- timeout = self.services["timeout"]
- while True:
- list_template_response = list_templates(
+ # Wait for template to download
+ template.download(self.apiclient)
+ self.cleanup.append(template)
+
+ # Wait for template status to be changed across
+ time.sleep(self.services["sleep"])
+ timeout = self.services["timeout"]
+ while True:
+ list_template_response = list_templates(
self.apiclient,
- templatefilter=\
- self.services["templatefilter"],
+ templatefilter='all',
id=template.id,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
)
- if isinstance(list_template_response, list):
- break
- elif timeout == 0:
- raise Exception("List template failed!")
-
- time.sleep(5)
- timeout = timeout - 1
- #Verify template response to check whether template added successfully
- self.assertEqual(
+ if isinstance(list_template_response, list):
+ break
+ elif timeout == 0:
+ raise Exception("List template failed!")
+
+ time.sleep(5)
+ timeout = timeout - 1
+ #Verify template response to check whether template added successfully
+ self.assertEqual(
isinstance(list_template_response, list),
True,
"Check for list template response return valid data"
)
- self.assertNotEqual(
+ self.assertNotEqual(
len(list_template_response),
0,
"Check template available in List Templates"
)
- template_response = list_template_response[0]
- self.assertEqual(
+ template_response = list_template_response[0]
+ self.assertEqual(
template_response.isready,
True,
"Check display text of newly created template"
)
- # Deploy new virtual machine using template
- virtual_machine = VirtualMachine.create(
+ # Deploy new virtual machine using template
+ virtual_machine = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=template.id,
@@ -243,26 +245,26 @@ class TestCreateTemplate(cloudstackTestCase):
serviceofferingid=self.service_offering.id,
mode=self.services["mode"]
)
- self.debug("creating an instance with template ID: %s" % template.id)
- vm_response = list_virtual_machines(
+ self.debug("creating an instance with template ID: %s" % template.id)
+ vm_response = list_virtual_machines(
self.apiclient,
id=virtual_machine.id,
account=self.account.name,
domainid=self.account.domainid
)
- self.assertEqual(
+ self.assertEqual(
isinstance(vm_response, list),
True,
"Check for list VMs response after VM deployment"
)
#Verify VM response to check whether VM deployment was successful
- self.assertNotEqual(
+ self.assertNotEqual(
len(vm_response),
0,
"Check VMs available in List VMs response"
)
- vm = vm_response[0]
- self.assertEqual(
+ vm = vm_response[0]
+ self.assertEqual(
vm.state,
'Running',
"Check the state of VM created from Template"
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6f0d469/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index c528cea..2152637 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -903,6 +903,17 @@ class Template:
return Template(template[0].__dict__)
@classmethod
+ def extract(cls, apiclient, id, mode, zoneid=None):
+ "Extract template "
+
+ cmd = extractTemplate.extractTemplateCmd()
+ cmd.id = id
+ cmd.mode = mode
+ cmd.zoneid = zoneid
+
+ return apiclient.extractTemplate(cmd)
+
+ @classmethod
def create_from_snapshot(cls, apiclient, snapshot, services,
random_name=True):
"""Create Template from snapshot"""
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6f0d469/tools/marvin/marvin/integration/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py
index f27e87d..478aa31 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -265,6 +265,25 @@ def wait_for_ssvms(apiclient, zoneid, podid, interval=60):
break
return
+def get_builtin_template_info(apiclient, zoneid):
+ """Returns hypervisor specific infor for templates"""
+
+ list_template_response = Template.list(
+ apiclient,
+ templatefilter='featured',
+ zoneid=zoneid,
+ )
+
+ for b_template in list_template_response:
+ if b_template.templatetype == 'BUILTIN':
+ break
+
+ extract_response = Template.extract(apiclient,
+ b_template.id,
+ 'HTTP_DOWNLOAD',
+ zoneid)
+
+ return extract_response.url, b_template.hypervisor, b_template.format
def download_builtin_templates(apiclient, zoneid, hypervisor, host,
linklocalip, interval=60):
[2/2] git commit: updated refs/heads/master to c6f0d46
Posted by ts...@apache.org.
CLOUDSTACK-4499: Wait until hosts are up before adding storage pools
This works around the delay caused in adding Xen 6.1/6.2 hosts where
host takes two attempts to transition to Up state. We will wait for one
minute per cluster before attempting to add storage pool in the cluster.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit 22ee499c3571b2a6b6921abb36c679128893c415)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1058654c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1058654c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1058654c
Branch: refs/heads/master
Commit: 1058654cb4e3bbc73315d5944541e20fb57eaecc
Parents: da6f048
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Aug 29 12:33:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Aug 29 14:10:54 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/deployDataCenter.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1058654c/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 5352029..4c34a50 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -22,6 +22,7 @@ import cloudstackTestClient
import logging
from cloudstackAPI import *
from os import path
+from time import sleep
from optparse import OptionParser
@@ -87,9 +88,28 @@ specify a valid config file" % cfgFile)
if cluster.hypervisor.lower() != "vmware":
self.addHosts(cluster.hosts, zoneId, podId, clusterId,
cluster.hypervisor)
+ self.wait_for_host(zoneId, clusterId)
self.createPrimaryStorages(cluster.primaryStorages, zoneId, podId,
clusterId)
+ def wait_for_host(self, zoneId, clusterId):
+ """
+ Wait for the hosts in the zoneid, clusterid to be up
+
+ 2 retries with 30s delay
+ """
+ retry, timeout = 2, 30
+ cmd = listHosts.listHostsCmd()
+ cmd.clusterid, cmd.zoneid = clusterId, zoneId
+ hosts = self.apiClient.listHosts(cmd)
+ while retry != 0:
+ for host in hosts:
+ if host.state != 'Up':
+ break
+ sleep(timeout)
+ retry = retry - 1
+
+
def createPrimaryStorages(self, primaryStorages, zoneId, podId, clusterId):
if primaryStorages is None:
return