<div class="xam_msg_class">
<div style="font: normal 13px Arial; color:rgb(31, 28, 27);">hello guys! <br><br>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...<br><br>somebody know a way (or could send me some hints) using python-sdk to start A VM and pass to it cloud-init options?<br><br>e.g. the portion of code I would like to change is vm.start() under rhel6|7:<br><br> try:<br> osVersion = vm.get_os().get_type()<br> if (osVersion == "rhel_6x64" or osVersion == "rhel_6" or osVersion == "rhel_7x64") and CLOUDINIT == "yes":<br> print "Starting VM: " + vm.name + " with cloud-init options"<br>----> vm.start() <----------<br> else:<br> print "Starting VM " + vm.name<br> vm.start()<br> while vmstat != 'down':<br> sleep(1)<br> vmstat = vm.get_status().state<br> except Exception, err:<br> print "Error on starting VM"<br> print err<br><br><br>Best regards<br>Amedeo Salvati</div>
</div>