mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
vGPU automation changes to make use of existing windows 8 template in the setup to deploy vGPU VMs
This commit is contained in:
parent
b7d3f1bd30
commit
acffe5ac3b
@ -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)")
|
||||
|
||||
while True:
|
||||
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:
|
||||
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):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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"""
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user