Hi All,
I was trying to create a resource tag on ISO and Template with a sample
data for a test
case. Can anyone help me toknow is there anything I'm missing in the input
parameters ?
For both resources, I get a db exception "Out of range value for column
'domain_id' at row 1" where the domainid gets value as -1.
I'm running this test on simulator.
*1] For ISO: *
*a) ISO in json*
iso1A": {
"displaytext": "Dummy ISO",
"name": "Dummy ISO",
"url": "http://people.apache.org/~tsp/dummy.iso",
"zoneid": "9ecf9d8b-cf18-4322-a641-a1c0aced5857",
# Source URL where ISO is located
"isextractable": True,
"isfeatured": True,
"ispublic": False,
"ostype": 'CentOS 5.3 (64-bit)',
"mode": 'HTTP_DOWNLOAD',
# Used in Extract template, value must be HTTP_DOWNLOAD
},
*b)* C*reating an iso with its tag*
self.account_1A = Account.create(
self.apiclient,
self.services["account1A"],
admin=False,
domainid=self.domain_1.id
)
self.userapiclient_1A =
self.testClient.getUserApiClient(self.user_1A.username,
self.domain_1.name)
self.iso1A = Iso.create(
self.apiclient,
self.services["iso"],
account=self.account_1A.name,
domainid=self.account_1A.domainid
)
self.debug("ISO created with ID: %s" % self.iso1A.id)
self.debug("Creating a tag for the ISO1A")
self.resource_tag_1A = Tag.create(
self.apiclient,
resourceIds=self.iso1A.id,
resourceType='iso',
tags={'OS': 'CentOS'}
)
*2] For Template : *
*a) Template in json*
"template1A": {
"displaytext": "Cent OS Template",
"name": "Cent OS Template",
"ostype": 'CentOS 5.3 (64-bit)',
"templatefilter": 'self',
},
*b ) Create template with tag. *
try:
self.debug("Stopping the virtual machine: %s" %
self.virtual_machine_1A.name)
#Stop virtual machine
self.virtual_machine_1A.stop(self.apiclient)
except Exception as e:
self.fail("Failed to stop VM: %s" % e)
timeout = self.services["timeout"]
while True:
list_volume = Volume.list(
self.apiclient,
virtualmachineid=self.virtual_machine_1A.id,
type='ROOT',
listall=True
)
if isinstance(list_volume, list):
break
elif timeout == 0:
raise Exception("List volumes failed.")
time.sleep(5)
timeout = timeout - 1
self.volumeT = list_volume[0]
self.template1A = Template.create(
self.apiclient,
self.services["template1A"],
self.volumeT.id
)
self.debug("Created the template1A(%s). Now restarting the
userVm: %s" % (self.template1A.name, self.virtual_machine_1A.name))
self.virtual_machine_1A.start(self.apiclient)
self.debug("Creating a tag for the template1A")
self.resource_tag_1A = Tag.create(
self.apiclient,
resourceIds=self.template1A.id,
resourceType='Template',
tags={'OS': 'CentOS'}
)
Thanks and Regards,
--
*Namita Chaudhari* ● Engineer - Product Development ● SunGard Availability
Services, India. ● 2nd Floor, Wing 4, Cluster D, MIDC Kharadi Knowledge
Park, Pune - 411 014 ● Email: [email protected]
<[email protected]> ● www.sungardas.in
[image: Description: cid:[email protected]] [image:
Description: cid:[email protected]] [image: Description:
cid:[email protected]] [image: Description:
cid:[email protected]] [image: Description:
cid:[email protected]] [image: Description:
cid:[email protected]]