mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7009: add ability to handle serviceofferingdetails to base.py
to support creation of service offering upon passing details in the following format serviceofferingdetails[1].key=pciDevice serviceofferingdetails[1].value=Group of NVIDIA Corporation GK107GL [GRID K1] GPUs serviceofferingdetails[2].key=vgpuType serviceofferingdetails[2].value=GRID K120Q
This commit is contained in:
parent
2fedc281b7
commit
2148a1a64d
@ -75,11 +75,12 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
|
||||
|
||||
self.testdata["vgpu140q"]["zoneid"] = self.zone.id
|
||||
self.testdata["vgpu140q"]["template"] = self.template.id
|
||||
self.testdata["service_offerings"]["vgpu260qwin"]["serviceofferingdetails"] = [{'pciDevice': 'VGPU'},
|
||||
{'vgpuType':'GRID K120Q'}]
|
||||
#create a service offering
|
||||
self.service_offering = ServiceOffering.create(
|
||||
self.apiclient,
|
||||
self.testdata["service_offerings"]["vgpu260qwin"],
|
||||
serviceofferingdetails={'pciDevice': 'VGPU'}
|
||||
)
|
||||
#build cleanup list
|
||||
self.cleanup = [
|
||||
|
||||
@ -1866,8 +1866,12 @@ class ServiceOffering:
|
||||
cmd.deploymentplanner = services["deploymentplanner"]
|
||||
|
||||
if "serviceofferingdetails" in services:
|
||||
cmd.serviceofferingdetails.append(
|
||||
{services['serviceofferingdetails']})
|
||||
count = 1
|
||||
for i in services["serviceofferingdetails"]:
|
||||
for key, value in i.items():
|
||||
setattr(cmd, "serviceofferingdetails[%d].key" % count, key)
|
||||
setattr(cmd, "serviceofferingdetails[%d].value" % count, value)
|
||||
count = count + 1
|
||||
|
||||
if "isvolatile" in services:
|
||||
cmd.isvolatile = services["isvolatile"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user