<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;"> &quot;Karli Sjöberg&quot; 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;"> &quot;Amedeo Salvati&quot; 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;"> &quot;users@ovirt.org&quot; 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>&gt; On Thu, 2014-12-11 at 11:29 +0100, Amedeo Salvati wrote:</div><div>&gt; &gt; Hello all,</div><div>&gt; &gt; </div><div>&gt; &gt; I want to rename a disk alias using python sdk, but I cannot find an</div><div>&gt; &gt; update method for object returned from api.disks.get (like cdrom, vm,</div><div>&gt; &gt; datacenter objects).</div><div>&gt; &gt; </div><div>&gt; &gt; Simplified code is:</div><div>&gt; &gt; </div><div>&gt; &gt; d1 = api.disks.get(id=&quot;7408f728-97e5-4b10-beb7-d9a70083797e&quot;)</div><div>&gt; &gt; d1.get_alias()</div><div>&gt; &gt; 'FSBOVRHEL66TMP-1412_Disk1'   &lt;-- OLD alias</div><div>&gt; &gt; d1.set_alias('PIPPO_Disk1')</div><div>&gt; &gt; d1.get_alias()</div><div>&gt; &gt; 'PIPPO_Disk1'                 &lt;-- NEW alias</div><div>&gt; &gt; </div><div>&gt; &gt; but after that I cannot find a method like d1.update() to &quot;commit&quot;</div><div>&gt; &gt; changes of disk object, what I miss?</div><div>&gt; &gt; </div><div>&gt; &gt; Best regards</div><div>&gt; &gt; Amedeo Salvati</div><div>&gt; &gt; plain text document attachment (ATT00001)</div><div>&gt; &gt; _______________________________________________</div><div>&gt; &gt; Users mailing list</div><div>&gt; &gt; Users@ovirt.org</div><div>&gt; &gt; http://lists.ovirt.org/mailman/listinfo/users</div><div>&gt; </div><div>&gt; This is how we do it:</div><div>&gt; </div><div>&gt;         DISK_NAME = '%s_Disk1' % (VM_NAME)</div><div>&gt;         try:</div><div>&gt;             vm = api.vms.get(VM_NAME)</div><div>&gt;             vmdisk = vm.disks.list()[0]</div><div>&gt;             vmdisk.alias = '%s' % (DISK_NAME)</div><div>&gt;             vmdisk.update()</div><div>&gt;         except Exception as e:</div><div>&gt;             raise(e)</div><div>&gt; </div><div>&gt; </div><div>&gt; -- </div><div>&gt; </div><div>&gt; Med Vänliga Hälsningar</div><div>&gt; </div><div>&gt; -------------------------------------------------------------------------------</div><div>&gt; Karli Sjöberg</div><div>&gt; Swedish University of Agricultural Sciences Box 7079 (Visiting Address</div><div>&gt; Kronåsvägen 8)</div><div>&gt; S-750 07 Uppsala, Sweden</div><div>&gt; Phone:  +46-(0)18-67 15 66</div><div>&gt; karli.sjoberg@slu.se</div>
                
</div>