[ovirt-users] Python-SDK4: Knowing snapshot status?

Ala Hino ahino at redhat.com
Mon Apr 9 12:00:18 UTC 2018


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 at 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 at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20180409/204d543f/attachment.html>


More information about the Users mailing list