You can do that using something like:
snapshot_service = snapshots_service.snapshot_service(
snapshot.id)
snapshot = snapshot_service.get()
if snapshot.snapshot_status == types.SnapshotStatus.OK:
...
But counting on the snapshot status is race prone, so in 4.2 a search by correlation id was introduced and you can do something like this (taken from ovirt-system-tests[1]):
correlation_id = uuid.uuid4()
vm1_snapshots_service.add(dead_snap1_params,
query={'correlation_id': correlation_id})
testlib.assert_true_within_long(
lambda:
test_utils.all_jobs_finished(engine, correlation_id)
)
Where all jobs finished does:
try:
jobs = engine.jobs_service().list(
search='correlation_id=%s' % correlation_id
)
except:
jobs = engine.jobs_service().list()
return all(job.status != types.JobStatus.STARTED for job in jobs)