Repository: cloudstack Updated Branches: refs/heads/master b7d3f1bd3 -> acffe5ac3
vGPU automation changes to make use of existing windows 8 template in the setup to deploy vGPU VMs Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/acffe5ac Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/acffe5ac Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/acffe5ac Branch: refs/heads/master Commit: acffe5ac3b77f5078164bed33c2ec897f937df7e Parents: b7d3f1b Author: sailajamada <sailaja.m...@citrix.com> Authored: Mon Aug 4 16:08:36 2014 +0530 Committer: sailajamada <sailaja.m...@citrix.com> Committed: Mon Aug 4 16:13:48 2014 +0530 ---------------------------------------------------------------------- .../component/test_deploy_vgpu_vm.py | 28 ++++++----- tools/marvin/marvin/lib/common.py | 53 ++++++++++++++++++++ 2 files changed, 69 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/acffe5ac/test/integration/component/test_deploy_vgpu_vm.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_deploy_vgpu_vm.py b/test/integration/component/test_deploy_vgpu_vm.py index 5c507aa..fd3f374 100644 --- a/test/integration/component/test_deploy_vgpu_vm.py +++ b/test/integration/component/test_deploy_vgpu_vm.py @@ -29,7 +29,7 @@ from marvin.lib.base import Account, VirtualMachine, ServiceOffering , Template 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, list_hosts ,list_service_offering +from marvin.lib.common import get_zone, get_domain, get_template, list_hosts ,list_service_offering, get_windows_template from marvin.sshClient import SshClient @@ -129,17 +129,20 @@ class TestvGPUWindowsVm(cloudstackTestCase): domainid=cls.domain.id ) - cls.template = Template.register( - cls.apiclient, - cls.testdata["vgpu"] ["templateregister1"], - hypervisor = "XenServer", - zoneid=cls.zone.id, - domainid=cls.account.domainid, - account=cls.account.name - ) - timeout = cls.testdata["vgpu"]["timeout"] + cls.template = get_windows_template(cls.apiclient, cls.zone.id ,ostype_desc="Windows 8 (64-bit)") + + if cls.template == FAILED: + cls.template = Template.register( + cls.apiclient, + cls.testdata["vgpu"] ["templateregister1"], + hypervisor = "XenServer", + zoneid=cls.zone.id, + domainid=cls.account.domainid, + account=cls.account.name + ) + timeout = cls.testdata["vgpu"]["timeout"] - while True: + while True: time.sleep(cls.testdata["vgpu"]["sleep"]) list_template_response = Template.list( cls.apiclient, @@ -219,7 +222,7 @@ class TestvGPUWindowsVm(cloudstackTestCase): serviceofferingid=vgpuofferingid, templateid=self.template.id ) - time.sleep(300) + time.sleep(600) list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id) self.debug( @@ -455,3 +458,4 @@ class TestvGPUWindowsVm(cloudstackTestCase): + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/acffe5ac/tools/marvin/marvin/lib/common.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py index 29677d3..62d409c 100644 --- a/tools/marvin/marvin/lib/common.py +++ b/tools/marvin/marvin/lib/common.py @@ -300,6 +300,59 @@ def get_template( return list_templatesout[0] + +def get_windows_template( + apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='USER', + template_id=None, template_name=None, account=None, domain_id=None, project_id=None, + hypervisor=None): + ''' + @Name : get_template + @Desc : Retrieves the template Information based upon inputs provided + Template is retrieved based upon either of the inputs matched + condition + @Input : returns a template" + @Output : FAILED in case of any failure + template Information matching the inputs + ''' + cmd = listTemplates.listTemplatesCmd() + cmd.templatefilter = template_filter + if domain_id is not None: + cmd.domainid = domain_id + if zone_id is not None: + cmd.zoneid = zone_id + if template_id is not None: + cmd.id = template_id + if template_name is not None: + cmd.name = template_name + if hypervisor is not None: + cmd.hypervisor = hypervisor + if project_id is not None: + cmd.projectid = project_id + if account is not None: + cmd.account = account + + + ''' + Get the Templates pertaining to the inputs provided + ''' + list_templatesout = apiclient.listTemplates(cmd) + #print("template result is %s"%(list_templatesout)) + if list_templatesout is None: + return FAILED + if validateList(list_templatesout[0]) == FAIL : + return FAILED + + for template in list_templatesout: + if template.isready and template.templatetype == "USER" and template.ostypename == ostype_desc: + return template + ''' + Return default first template, if no template matched + ''' + + return FAILED + + + def download_systemplates_sec_storage(server, services): """Download System templates on sec storage"""