Skip to content

Instantly share code, notes, and snippets.

@cocampbe
Created August 8, 2017 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocampbe/f4437e6b7d666c0cd5a48cb60c795b57 to your computer and use it in GitHub Desktop.
Save cocampbe/f4437e6b7d666c0cd5a48cb60c795b57 to your computer and use it in GitHub Desktop.
Oracle VM REST API info
Found this info here: http://blog.ls-al.com/oracle-vm-ovm-rest-api/
Had trouble finding the rest calls to create a vm clone from a template.
## CloneVM failing
## The value for the argument "serverPoolId" was found to be null
def cloneVm(s,baseUri,templateVm,vmName):
repo_id=get_id_from_name(s,baseUri,'Repository','ovs1')
sp_id=get_id_from_name(s,baseUri,'ServerPool','ovs-home')
template_id=get_id_from_name(s,baseUri,'Vm',templateVm)
print 'clone {} into repo_id {:20} ServerPool Id {:55}'.format(template_id,repo_id,sp_id)
data={ "serverPoolId": sp_id,
"repositoryId": repo_id,
"createTemplate": False
}
uri='{base}/Vm/{vmId}/clone'.format(base=baseUri,vmId=template_id)
r=s.put(uri,data=json.dumps(data))
job=r.json()
print job
# wait for the job to complete
vm_id=wait_for_job(job['id']['uri'],s)
print "new vm id:" + vm_id
@divya-create
Copy link

divya-create commented Dec 22, 2019 via email

@divya-create
Copy link

Hi Team,
I have already tried this ovm_clone and working fine. ThanksI need help for i have to give input in ovm_clone based on the input cvm clone create from template with ,The below input asked from user1.vm name2.repository3.server name4.cpu5.memory6.nic card details.
Please provide me the python library and playbook for this.

@divya-create
Copy link

divya-create commented Dec 31, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment