[Users] Unable to get latest resource status
Juan Hernandez
jhernand at redhat.com
Fri Apr 27 07:57:41 UTC 2012
On 04/26/2012 05:49 PM, Alex Jia wrote:
> I built ovirt-engine-sdk rpm based on git repo 'http://gerrit.ovirt.org/p/ovirt-engine-sdk.git',
> then the ovirt-engine-sdk works well for me, I can get resource information from Ovirt/RHEVM(3.0)
> on the rhel6.2.
>
> The only question is I can't get latest resource status when I changed VM from 'suspended' to 'up'
> status, the api.vms.get(vm_name).status.state is always 'suspended' status, I can get a correct
> VM status unless I reconnect Ovirt/RHEVM, it's not convenient for users, I remember there are reload
> and wait_for_status method in old python binding API of RHEV(python-rhev), the wait_for_status method
> will reload resource then get current resource status, however, I haven't found similar method in
> ovirt-engine-sdk.
Are you sure you are calling api.vms.get(vm_name) each time? Or are you
doing something like this:
vm = api.vms.get(vm_name)
while vm.status.state == "suspended":
sleep(10)
If you are doing that the vm information is retrieved only once, not
each time. If this is the case try something like this:
while api.vms.get(VM_NAME).status.state == "suspended":
sleep(1)
Can you share that snippet of code so that I can try to reproduce it?
--
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.
More information about the Users
mailing list