Red Hat Bugzilla – Bug 817045
OVIRT-SDK [RFE]: functions to update object status and to wait for specific state
Last modified: 2014-10-06 20:16:10 EDT
The sdk doesn't have a nice way to update the state of an object. You have to use the 'get' method every time to find out the current state.
It would be useful to have something like object.get_new_state() and even more to have a function object.wait_for_state(), which could have an optional timeout and optional fail_state where the function would fail immediately. Example:
host.wait_for_state('up', timeout=60*5, fail_state='install failed')
Waiting for a state is currently done like this:
while api.vms.get(vm_name).status.state != state:
which is prone to errors (and ugly), because intuitively you try to do this:
vm = api.vms.get(vm_name)
while vm.status.state != state:
Closing old bugs. If this issue is still relevant/important in current version, please re-open the bug.