--_=__=_XaM3_.1406022513.2A.527548.42.32355.52.42.007.202691555
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
hello guys! =0A=0AI'm writing some python code to start VMs, and based on=
operating system (at this moment centos6 nad centos7), I would like to u=
se cloud-init options (available on web ui at run-once) to start them and=
resetting root password, change hostname and write some configuration fi=
les by using yaml semantics, but at this moment I was unable to find a wa=
y to do it...=0A=0Asomebody know a way (or could send me some hints) usin=
g python-sdk to start A VM and pass to it cloud-init options?=0A=0Ae.g. t=
he portion of code I would like to change is vm.start() under rhel6|7:=0A=
=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 try=
:=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 osVersion =3D vm.get_os().get_type()=0A=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 if (osVersion =3D=3D "rhel_6x64" or osVersion =3D=3D "rhel_6" or
osVe=
rsion =3D=3D "rhel_7x64") and CLOUDINIT =3D=3D
"yes":=0A=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 print "Starting VM: " + vm.name + " with cloud-init=
options"=0A----> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 vm.start()=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <-----=
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0A=0A=0ABest rega=
rds=0AAmedeo Salvati
--_=__=_XaM3_.1406022513.2A.527548.42.32355.52.42.007.202691555
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
=0A<div class=3D"xam_msg_class">=0A<div style=3D"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 momen=
t I was unable to find a way to do it...<br><br>somebody know a way (or c=
ould send me some hints) using python-sdk to start A VM and pass to it cl=
oud-init options?<br><br>e.g. the portion of code I would like to change =
is vm.start() under
rhel6|7:<br><br> &=
nbsp;
try:<br>  =
;
osVersion =3D vm.=
get_os().get_type()<br> &n=
bsp; if (osVersion =3D=3D
"rhel_6x64"=
or osVersion =3D=3D "rhel_6" or osVersion =3D=3D "rhel_7x64") and
CLOUDI=
NIT =3D=3D
"yes":<br> &nbs=
p;
print "Sta=
rting VM: " + vm.name + " with cloud-init options"<br>---->
&nbs=
p;  =
;
vm.start() &=
nbsp;
<----------<br> &=
nbsp; &n=
bsp;
else:<br>  =
;
print "Starting V=
M " +
vm.name<br> &n=
bsp;
vm.start()<br>=
&=
nbsp; while vmstat !=3D
'down':<br> &n=
bsp; &nb=
sp;
sleep(1)<br> &nb=
sp;
vms=
tat =3D
vm.get_status().state<br> &nbs=
p; except Exception,
err:<br> &n=
bsp;
pr=
int "Error on starting
VM"<br> &=
nbsp; print
err<br><br><br>Best=
regards<br>Amedeo Salvati</div>=0A</div>=0A
--_=__=_XaM3_.1406022513.2A.527548.42.32355.52.42.007.202691555--