[ovirt-users] cloud-init options under python-sdk
Amedeo Salvati
amedeo at oscert.net
Tue Jul 22 09:48:33 UTC 2014
hello guys!
I'm writing some python code to start VMs, and based on operating system (at this moment centos6 nad centos7), I would like to use cloud-init options (available on web ui at run-once) to start them and resetting root password, change hostname and write some configuration files by using yaml semantics, but at this moment I was unable to find a way to do it...
somebody know a way (or could send me some hints) using python-sdk to start A VM and pass to it cloud-init options?
e.g. the portion of code I would like to change is vm.start() under rhel6|7:
try:
osVersion = vm.get_os().get_type()
if (osVersion == "rhel_6x64" or osVersion == "rhel_6" or osVersion == "rhel_7x64") and CLOUDINIT == "yes":
print "Starting VM: " + vm.name + " with cloud-init options"
----> vm.start() <----------
else:
print "Starting VM " + vm.name
vm.start()
while vmstat != 'down':
sleep(1)
vmstat = vm.get_status().state
except Exception, err:
print "Error on starting VM"
print err
Best regards
Amedeo Salvati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140722/29fed979/attachment-0001.html>
More information about the Users
mailing list