Hi,

After issuing the remove operation, you can fetch the VM snapshots and check the status of the snapshot.
Here is an example how to fetch VM snapshots:

https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/list_vm_snapshots.py

You'd want to wait until the status is OK.

On Mon, Apr 9, 2018 at 2:42 PM, <nicolas@devels.es> wrote:
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.
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users