API auto delete vms snapshot

Hi, i'm playing with ovirt sdk, to automatically manage snapshots. My script is for now very basic step 1) list all vm of cluster step 2) for each vm create a snapshot if needed step 3) for each vm delete oldest snapshot No problem for step 1 and 2. But step 3 is harder. If i launch snap remove with command "snapshots_service.snapshot_service(snap.id).remove()", python tell me snapshot operation already in progress (creation of snapshot in step2). If i launch snap remove with parameter "async=true" the snapshot to delete is locked by ovirt, but never deleted. So how can i do? Also there is some way to monitor running task about snapshot (ovirt-shell ...)? -- Lionel

Lionel hi, You should wait until the operation is done. Take a look at this example [1]. Regards, Fred [1] https://github.com/oVirt/ovirt-engine-sdk/blob/e4ef67041a639cddbae82b172572a... On Fri, Sep 15, 2017 at 5:28 PM, Lionel Caignec <caignec@cines.fr> wrote:
Hi,
i'm playing with ovirt sdk, to automatically manage snapshots. My script is for now very basic step 1) list all vm of cluster step 2) for each vm create a snapshot if needed step 3) for each vm delete oldest snapshot No problem for step 1 and 2.
But step 3 is harder. If i launch snap remove with command "snapshots_service.snapshot_service( snap.id).remove()", python tell me snapshot operation already in progress (creation of snapshot in step2).
If i launch snap remove with parameter "async=true" the snapshot to delete is locked by ovirt, but never deleted.
So how can i do? Also there is some way to monitor running task about snapshot (ovirt-shell ...)?
-- Lionel _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (2)
-
Fred Rolland
-
Lionel Caignec