--_=__=_XaM3_.1418303367.2A.135188.42.25122.52.42.007.1168629845
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
=0A Ondra, Juan, Karli and all thanks!=0A Best Regards=0A Amedeo Sa=
lvati=0A=0A Da "Karli Sj=C3=B6berg" karli.sjoberg(a)slu.se=0A=0A A "Ame=
deo Salvati" amedeo(a)oscert.net=0A=0A Cc "users(a)ovirt.org" users(a)ovirt.o=
rg=0A=0A Data Thu, 11 Dec 2014 11:47:57 +0000=0A=0A Oggetto Re: [ovir=
t-users] how to rename disk alias on python sdk=0A=0A > On Thu, 2014-12=
-11 at 11:29 +0100, Amedeo Salvati wrote:=0A=0A > > Hello all,=0A=0A =
>=0A=0A > > I want to rename a disk alias using python
sdk, but I can=
not find an=0A=0A > > update method for object returned from
api.disks.=
get (like cdrom, vm,=0A=0A > > datacenter objects).=0A=0A > >=0A=0A =
> Simplified code is:=0A=0A > >=0A=0A > > d1 =3D
api.disks.get(id=3D=
"7408f728-97e5-4b10-beb7-d9a70083797e")=0A=0A >
> d1.get_alias()=0A=0A =
> 'FSBOVRHEL66TMP-1412_Disk1' <-- OLD alias=0A=0A
> > d1.set_alias(=
'PIPPO_Disk1')=0A=0A > >
d1.get_alias()=0A=0A > > 'PIPPO_Disk1' <-- N=
EW alias=0A=0A > >=0A=0A > > but after that I cannot find a method li=
ke d1.update() to "commit"=0A=0A > > changes of disk object, what I
mis=
s?=0A=0A > >=0A=0A > > Best regards=0A=0A > > Amedeo Salvati=0A=0A
=
> plain text document attachment (ATT00001)=0A=0A > >
_____________=
__________________________________=0A=0A > > Users mailing
list=0A=0A =
users=0A=0A >=0A=0A > This is
how we do it:=0A=0A >=0A=0A > DISK_=
NAME =3D '%s_Disk1' % (VM_NAME)=0A=0A > try:=0A=0A > vm =3D api.vms.g=
et(VM_NAME)=0A=0A > vmdisk =3D vm.disks.list()[0]=0A=0A > vmdisk.alia=
s =3D '%s' % (DISK_NAME)=0A=0A > vmdisk.update()=0A=0A > except Excep=
tion as e:=0A=0A > raise(e)=0A=0A >=0A=0A >=0A=0A > --=0A=0A
>=0A=
=0A > Med V=C3=A4nliga H=C3=A4lsningar=0A=0A >=0A=0A > ------------=
-------------------------------------------------------------------=0A=0A=
Karli Sj=C3=B6berg=0A=0A > Swedish University of Agricultural
Scie=
nces Box 7079 (Visiting Address=0A=0A > Kron=C3=A5sv=C3=A4gen 8)=0A=0A =
S-750 07 Uppsala, Sweden=0A=0A > Phone: +46-(0)18-67 15 66=0A=0A
=
karli.sjoberg(a)slu.se=0A
--_=__=_XaM3_.1418303367.2A.135188.42.25122.52.42.007.1168629845
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
=0A<div class=3D"xam_msg_class">=0A=0A Ondra, Juan, Karli and all
thank=
s!<br /><br />Best Regards<br />Amedeo Salvati<br /><br
/>=C2=A0<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;"> "Karli Sj=C3=B6berg"
karli.sjoberg(a)slu.se</s=
pan></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;
colo=
r:#5F5F5F; padding-left:5px;"> "Amedeo Salvati"
amedeo(a)oscert.n=
et</span></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=
; color:#5F5F5F; padding-left:5px;"> &quot;users(a)ovirt.org&quot;
users@ov=
irt.org</span></div>=0A<div><span style=3D"font-family:Arial;
font-size:1=
1px; color:#5F5F5F;">Data</span><span style=3D"font-family:Arial;
font-si=
ze:12px; color:#5F5F5F; padding-left:5px;"> Thu, 11 Dec 2014 11:47:57 +00=
00</span></div>=0A<div><span style=3D"font-family:Arial;
font-size:11px; =
color:#5F5F5F;">Oggetto</span><span style=3D"font-family:Arial;
font-size=
:12px; color:#5F5F5F; padding-left:5px;"> Re: [ovirt-users] how to rename=
disk alias on python sdk</span></div>=0A<br />=0A<div>> On
Thu, 2014-=
12-11 at 11:29 +0100, Amedeo Salvati wrote:</div><div>> > Hello
all=
,</div><div>> > </div><div>> > I want
to rename a disk alias =
using python sdk, but I cannot find an</div><div>> > update
method =
for object returned from api.disks.get (like cdrom, vm,</div><div>>
&g=
t; datacenter objects).</div><div>> >
</div><div>> > Simplifi=
ed code is:</div><div>> > </div><div>>
> d1 =3D api.disks.get=
(id=3D"7408f728-97e5-4b10-beb7-d9a70083797e")</div><div>>
&g=
t; d1.get_alias()</div><div>> >
'FSBOVRHEL66TMP-1412_Disk1' <-=
- OLD alias</div><div>> >
d1.set_alias('PIPPO_Disk1')</div><div>>=
; > d1.get_alias()</div><div>> > 'PIPPO_Disk1'
&=
lt;-- NEW alias</div><div>> > </div><div>>
> but after that I=
cannot find a method like d1.update() to
"commit"</div><div>&g=
t; > changes of disk object, what I miss?</div><div>> >
</div><d=
iv>> > Best regards</div><div>> > Amedeo
Salvati</div><div>&g=
t; > plain text document attachment (ATT00001)</div><div>>
> ___=
____________________________________________</div><div>> > Users
ma=
iling list</div><div>> >
Users(a)ovirt.org</div><div>&gt; > http:/=
/lists.ovirt.org/mailman/listinfo/users</div><div>>
</div><div>> Th=
is is how we do it:</div><div>> </div><div>>
DISK_NAME =3D =
'%s_Disk1' % (VM_NAME)</div><div>>
try:</div><div>> =
vm =3D api.vms.get(VM_NAME)</div><div>> vmdisk =3D
vm=
.disks.list()[0]</div><div>> vmdisk.alias =3D '%s'
% (DISK=
_NAME)</div><div>>
vmdisk.update()</div><div>> =
except Exception as e:</div><div>>
raise(e)</div><div>>=
</div><div>> </div><div>> --
</div><div>> </div><div>> Med V=
=C3=A4nliga H=C3=A4lsningar</div><div>> </div><div>>
--------------=
-----------------------------------------------------------------</div><d=
iv>> Karli Sj=C3=B6berg</div><div>> Swedish University of
Agricultu=
ral Sciences Box 7079 (Visiting Address</div><div>>
Kron=C3=A5sv=C3=A4=
gen 8)</div><div>> S-750 07 Uppsala,
Sweden</div><div>> Phone: +46=
-(0)18-67 15 66</div><div>>
karli.sjoberg(a)slu.se</div>=0A =0A</div>=0A=
--_=__=_XaM3_.1418303367.2A.135188.42.25122.52.42.007.1168629845--