Bug 817045 - OVIRT-SDK [RFE]: functions to update object status and to wait for specific state
OVIRT-SDK [RFE]: functions to update object status and to wait for specific s...
Status: CLOSED WONTFIX
Product: oVirt
Classification: Community
Component: ovirt-engine-sdk (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michael Pasternak
infra
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-27 09:54 EDT by Martina Kollarova
Modified: 2014-10-06 20:16 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-23 04:20:08 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martina Kollarova 2012-04-27 09:54:16 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:
      sleep(1)

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:
      sleep(1)
Comment 1 Itamar Heim 2012-12-23 04:20:08 EST
Closing old bugs. If this issue is still relevant/important in current version, please re-open the bug.

Note You need to log in before you can comment on or make changes to this bug.