[ovirt-users] how to rename disk alias on python sdk
Amedeo Salvati
amedeo at oscert.net
Thu Dec 11 13:09:26 UTC 2014
Ondra, Juan, Karli and all thanks!
Best Regards
Amedeo Salvati
Da "Karli Sjöberg" karli.sjoberg at slu.se
A "Amedeo Salvati" amedeo at oscert.net
Cc "users at ovirt.org" users at ovirt.org
Data Thu, 11 Dec 2014 11:47:57 +0000
Oggetto Re: [ovirt-users] how to rename disk alias on python sdk
> On Thu, 2014-12-11 at 11:29 +0100, Amedeo Salvati wrote:
> > Hello all,
> >
> > I want to rename a disk alias using python sdk, but I cannot find an
> > update method for object returned from api.disks.get (like cdrom, vm,
> > datacenter objects).
> >
> > Simplified code is:
> >
> > d1 = api.disks.get(id="7408f728-97e5-4b10-beb7-d9a70083797e")
> > d1.get_alias()
> > 'FSBOVRHEL66TMP-1412_Disk1' <-- OLD alias
> > d1.set_alias('PIPPO_Disk1')
> > d1.get_alias()
> > 'PIPPO_Disk1' <-- NEW alias
> >
> > but after that I cannot find a method like d1.update() to "commit"
> > changes of disk object, what I miss?
> >
> > Best regards
> > Amedeo Salvati
> > plain text document attachment (ATT00001)
> > _______________________________________________
> > Users mailing list
> > Users at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/users
>
> This is how we do it:
>
> DISK_NAME = '%s_Disk1' % (VM_NAME)
> try:
> vm = api.vms.get(VM_NAME)
> vmdisk = vm.disks.list()[0]
> vmdisk.alias = '%s' % (DISK_NAME)
> vmdisk.update()
> except Exception as e:
> raise(e)
>
>
> --
>
> Med Vänliga Hälsningar
>
> -------------------------------------------------------------------------------
> Karli Sjöberg
> Swedish University of Agricultural Sciences Box 7079 (Visiting Address
> Kronåsvägen 8)
> S-750 07 Uppsala, Sweden
> Phone: +46-(0)18-67 15 66
> karli.sjoberg at slu.se
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20141211/61e62a5d/attachment-0001.html>
More information about the Users
mailing list