[ovirt-users] Python-SDK4: Knowing snapshot status?
nicolas at devels.es
nicolas at devels.es
Mon Apr 9 11:42:45 UTC 2018
Hi,
I'm running ovirt-engine-sdk-python 4.2.4 and I'm performing some
snapshot-related tasks. I'd like to somehow control the status of the
snapshot in order to know when I'll be able to run the next
snapshot-related operation.
For example, I'd like to create a new snapshot and then delete X oldest
snapshots. After creating the snapshot I have to make sure the snapshot
operation has concluded to run the deletion.
However, I'm unable to find a native way to get the status of a
snapshot.
In [1]: snap = conn.follow_link(vm.snapshots)[3] # This returns
one snapshot
In [2]: snap.status
In [3]: snap.status_detail
So both status-related properties return None. I've managed to find a
"poorman's" way by doing this:
while True:
try:
snaps_service.service(snap.id).remove()
except Error, e:
if e.code == 409:
sleep(30)
continue
else:
break
Which works but is quite "tricky".
Is there a better way to do this?
Thanks.
More information about the Users
mailing list