<div class="xam_msg_class">
                        Ondra, Juan, Karli and all thanks!<br /><br />Best Regards<br />Amedeo Salvati<br /><br /> <br />
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Da</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;"> "Karli Sjöberg" karli.sjoberg@slu.se</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">A</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;"> "Amedeo Salvati" amedeo@oscert.net</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Cc</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;"> "users@ovirt.org" users@ovirt.org</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Data</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;"> Thu, 11 Dec 2014 11:47:57 +0000</span></div>
<div><span style="font-family:Arial; font-size:11px; color:#5F5F5F;">Oggetto</span><span style="font-family:Arial; font-size:12px; color:#5F5F5F; padding-left:5px;"> Re: [ovirt-users] how to rename disk alias on python sdk</span></div>
<br />
<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>> > datacenter objects).</div><div>> > </div><div>> > Simplified code is:</div><div>> > </div><div>> > d1 = api.disks.get(id="7408f728-97e5-4b10-beb7-d9a70083797e")</div><div>> > 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' <-- NEW alias</div><div>> > </div><div>> > but after that I cannot find a method like d1.update() to "commit"</div><div>> > changes of disk object, what I miss?</div><div>> > </div><div>> > Best regards</div><div>> > Amedeo Salvati</div><div>> > plain text document attachment (ATT00001)</div><div>> > _______________________________________________</div><div>> > Users mailing list</div><div>> > Users@ovirt.org</div><div>> > http://lists.ovirt.org/mailman/listinfo/users</div><div>> </div><div>> This is how we do it:</div><div>> </div><div>> DISK_NAME = '%s_Disk1' % (VM_NAME)</div><div>> try:</div><div>> vm = api.vms.get(VM_NAME)</div><div>> vmdisk = vm.disks.list()[0]</div><div>> vmdisk.alias = '%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änliga Hälsningar</div><div>> </div><div>> -------------------------------------------------------------------------------</div><div>> Karli Sjöberg</div><div>> Swedish University of Agricultural Sciences Box 7079 (Visiting Address</div><div>> Kronåsvägen 8)</div><div>> S-750 07 Uppsala, Sweden</div><div>> Phone: +46-(0)18-67 15 66</div><div>> karli.sjoberg@slu.se</div>
                
</div>