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(a)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(a)slu.se