On 12/11/2014 11:29 AM, 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
>
The problem is that the top level disks collection doesn't support the
"update" operation, thus it isn't available in the SDK. You will have to
do it via the VM disks collection:
vm = api.vms.get(name="myvm")
disk = vm.disks.get(id="...")
disk.set_alias("newalias")
disk.update()
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
_______________________________________________
Users mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/users