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:
SrikanteswaraRao Talluri 2014-06-30 19:20:07 +05:30
parent 2fedc281b7
commit 2148a1a64d
2 changed files with 8 additions and 3 deletions

View File

@ -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 = [

View File

@ -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"]