--_=__=_XaM3_.1406033731.2A.648784.42.24684.52.42.007.584362592
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
hi Juan|guys,=0A=0Athanks for hints! but unfortunatly it seems wont works=
, because I've launched vm with this simple code:=0A=0Aaction =3D params.=
Action(vm=3Dparams.VM(initialization=3Dparams.Initialization(cloud_init=3D=
params.CloudInit(host=3Dparams.Host(name=3D"rheltest014")))))=0Avm.start(=
action )=0A=0Abut after boot the VM, cloud-init service hasn't set hostn=
ame and on cloud-init.log and cloud-init-output.log I cannot find any ent=
ry for setting hostname, instead if I use web ui it work's fine...=0A=0At=
here are any ways to debug cloud-init jobs?=0Athe params params.Host is r=
ight for CloudInit host or is intended for host / hypervisor?=0A=0ABest r=
egards=0AAmedeo Salvati=0A=0A=0ADa: "Juan Hernandez" jhernand(a)redhat.com=0A=
A: "Amedeo Salvati" amedeo(a)oscert.net, users(a)ovirt.org=0ACc: =0AData: Tue=
, 22 Jul 2014 12:21:01 +0200=0AOggetto: Re: [ovirt-users] cloud-init opti=
ons under python-sdk=0A=0A=0A> On 07/22/2014 11:48 AM, Amedeo Salvati wro=
te:=0A> > hello guys!=0A> > =0A> > I'm writing some python code to
start =
VMs, and based on operating system=0A> > (at this moment centos6 nad cent=
os7), I would like to use cloud-init=0A> > options (available on web ui a=
t run-once) to start them and resetting=0A> > root password, change hostn=
ame and write some configuration files by=0A> > using yaml semantics, but=
at this moment I was unable to find a way to=0A> > do it...=0A> > =0A>
>=
somebody know a way (or could send me some hints) using python-sdk to=0A=
> start A VM and pass to it cloud-init options?=0A> >
=0A> > e.g. the p=
ortion of code I would like to change is vm.start() under
rhel6|7:=0A> > =
=0A> > try:=0A> > osVersion =3D vm.get_os().g=
et_type()=0A> > if (osVersion =3D=3D "rhel_6x64" or
osVer=
sion =3D=3D "rhel_6" or=0A> > osVersion =3D=3D "rhel_7x64") and
CLOUDINIT=
=3D=3D "yes":=0A> > print "Starting VM: " +
vm.name =
+ " with cloud-init=0A> > options"=0A> > ---->
vm.star=
t() <---------- > else:=0A> > =
print "Starting VM " + vm.name=0A> >
vm.start(=
)=0A> > while vmstat !=3D 'down':=0A> >
=
sleep(1)=0A> > vmstat =3D vm.get_status().state=0A=
> except Exception, err:=0A> >
print "Error=
on starting VM"=0A> > print
err=0A> > =0A> > =0A> > Best=
regards=0A> > Amedeo Salvati=0A> > =0A> =0A> It should be something
like=
this:=0A> =0A> from ovirtsdk.xml import params=0A> =0A> action =3D p=
arams.Action(=0A> vm=3Dparams.VM(=0A> initialization=3Dparams.I=
nitialization(=0A> cloud_init=3Dparams.CloudInit(=0A> h=
ost=3Dparams.Host(=0A> name=3D"myvm"=0A> ),=0A>
=
users=3D...,=0A> files=3D...,=0A> ...=0A> =
)=0A> )=0A> )=0A> )=0A> =0A> vm.start(action)=0A>
=0A> =
=0A> -- =0A> Direcci=C3=B3n Comercial: C/Jose Bardasano Baos, 9, Edif. Go=
rbea 3, planta=0A> 3=C2=BAD, 28016 Madrid, Spain=0A> Inscrita en el Reg. =
Mercantil de Madrid =E2=80=93 C.I.F. B82657941 - Red Hat S.L.
--_=__=_XaM3_.1406033731.2A.648784.42.24684.52.42.007.584362592
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);">hi Juan|guys,<br><br>thanks for hints! but
unfor=
tunatly it seems wont works, because I've launched vm with this simple co=
de:<br><br>action =3D params.Action(vm=3Dparams.VM(initialization=3Dparam=
s.Initialization(cloud_init=3Dparams.CloudInit(host=3Dparams.Host(name=3D=
"rheltest014")))))<br>vm.start( action )<br><br>but after boot
the VM, cl=
oud-init service hasn't set hostname and on cloud-init.log and cloud-init=
-output.log I cannot find any entry for setting hostname, instead if I us=
e web ui it work's fine...<br><br>there are any ways to debug cloud-init
=
jobs?<br>the params params.Host is right for CloudInit host or is intende=
d for host / hypervisor?<br><br>Best regards<br>Amedeo
Salvati<br><br>=0A=
<div><span style=3D"font-family:Arial; font-size:11px;
color:#5F5F5F;">Da=
</span><span style=3D"font-family:Arial; font-size:12px; color:#5F5F5F; p=
adding-left:5px;">: "Juan Hernandez"
jhernand(a)redhat.com</span></div>=0A<=
div><span style=3D"font-family:Arial; font-size:11px;
color:#5F5F5F;">A</=
span><span style=3D"font-family:Arial; font-size:12px; color:#5F5F5F; pad=
ding-left:5px;">: "Amedeo Salvati" amedeo(a)oscert.net,
users(a)ovirt.org</sp=
an></div>=0A<div><span style=3D"font-family:Arial; font-size:11px;
color:=
#5F5F5F;">Cc</span><span style=3D"font-family:Arial; font-size:12px;
colo=
r:#5F5F5F; padding-left:5px;">: </span></div>=0A<div><span
style=3D"font-=
family:Arial; font-size:11px; color:#5F5F5F;">Data</span><span
style=3D"f=
ont-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: Tue=
, 22 Jul 2014 12:21:01 +0200</span></div>=0A<div><span
style=3D"font-fami=
ly:Arial; font-size:11px; color:#5F5F5F;">Oggetto</span><span
style=3D"fo=
nt-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;">: Re: =
[ovirt-users] cloud-init options under
python-sdk</span></div>=0A<br>=0A<=
div>> On 07/22/2014 11:48 AM, Amedeo Salvati
wrote:</div><div>> >=
; hello guys!</div><div>> > </div><div>>
> I'm writing some p=
ython code to start VMs, and based on operating system</div><div>>
>=
; (at this moment centos6 nad centos7), I would like to use cloud-init</d=
iv><div>> > options (available on web ui at run-once) to start
them=
and resetting</div><div>> > root password, change hostname and
wri=
te some configuration files by</div><div>> > using yaml
semantics, =
but at this moment I was unable to find a way to</div><div>> >
do i=
t...</div><div>> > </div><div>> >
somebody know a way (or cou=
ld send me some hints) using python-sdk to</div><div>> > start A
VM=
and pass to it cloud-init options?</div><div>> >
</div><div>> &=
gt; e.g. the portion of code I would like to change is vm.start() under r=
hel6|7:</div><div>> > </div><div>> >
try:</div><d=
iv>> > osVersion =3D
vm.get_os().get_type()</div><d=
iv>> > if (osVersion =3D=3D "rhel_6x64" or
osVersio=
n =3D=3D "rhel_6" or</div><div>> > osVersion =3D=3D
"rhel_7x64") an=
d CLOUDINIT =3D=3D "yes":</div><div>> >
print "=
Starting VM: " + vm.name + " with cloud-init</div><div>>
> options"=
</div><div>> > ----> vm.start()
=
<---------- > else:</div><div>> >
=
print "Starting VM " + vm.name</div><div>> >
=
vm.start()</div><div>> > while vmstat
!=3D =
'down':</div><div>> >
sleep(1)</div><div>> &=
gt; vmstat =3D vm.get_status().state</div><div>>
&=
gt; except Exception, err:</div><div>> >
=
print "Error on starting VM"</div><div>> >
print =
err</div><div>> > </div><div>> >
</div><div>> > Best re=
gards</div><div>> > Amedeo
Salvati</div><div>> > </div><div>&=
gt; </div><div>> It should be something like
this:</div><div>> </di=
v><div>> from ovirtsdk.xml import params</div><div>>
</div><div>&=
gt; action =3D params.Action(</div><div>>
vm=3Dparams.VM(</div><=
div>>
initialization=3Dparams.Initialization(</div><div>> =
cloud_init=3Dparams.CloudInit(</div><div>>
host=3Dparam=
s.Host(</div><div>>
name=3D"myvm"</div><div>> =
),</div><div>> users=3D...,</div><div>>
files=3D=
...,</div><div>> ...</div><div>>
)</div><div>>=
)</div><div>> )</div><div>>
)</div><div>> </div><di=
v>> vm.start(action)</div><div>>
</div><div>> </div><div>> =
-- </div><div>> Direcci=C3=B3n Comercial: C/Jose Bardasano Baos, 9,
Ed=
if. Gorbea 3, planta</div><div>> 3=C2=BAD, 28016 Madrid,
Spain</div><d=
iv>> Inscrita en el Reg. Mercantil de Madrid =E2=80=93 C.I.F. B8265794=
1 - Red Hat S.L.</div></div>=0A</div>=0A
--_=__=_XaM3_.1406033731.2A.648784.42.24684.52.42.007.584362592--