Bug 817045 - OVIRT-SDK [RFE]: functions to update object status and to wait for specific state
Summary: OVIRT-SDK [RFE]: functions to update object status and to wait for specific s...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-sdk
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Michael Pasternak
QA Contact:
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-27 13:54 UTC by Martina Kollarova
Modified: 2014-10-07 00:16 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-23 09:20:08 UTC
oVirt Team: ---
Embargoed:


Attachments (Terms of Use)

Description Martina Kollarova 2012-04-27 13:54:16 UTC
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 09:20:08 UTC
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.