From Dan Kenigsberg <[email protected]>:

Dan Kenigsberg has submitted this change and it was merged.

Change subject: virt: Added 'prepared' context manager
......................................................................


virt: Added 'prepared' context manager

Added context manager to prepare a group of objects (for example, disk images)
for an operation. Each images must implement prepare() and teardown() methods.

When entering the context, all images are prepared in the order they are
passed. When exiting the context (or upon error) the images are torn
down in reverse order. If an exception was raised inside the context,
that exception will be propagated regardless of any exceptions that may
be thrown by teardown() methods.

Usage example:

with prepared(images):
    do_some_operation(images)

Change-Id: Ibe9d04599dfc1700f215a7765775d60cb314ff0a
Signed-off-by: Shmuel Melamud <[email protected]>
---
M lib/vdsm/virt/utils.py
A tests/virttests/prepared_test.py
2 files changed, 220 insertions(+), 1 deletion(-)

Approvals:
  Jenkins CI: Passed CI tests
  Shmuel Leib Melamud: Verified
  Francesco Romani: Looks good to me, approved



-- 
To view, visit https://gerrit.ovirt.org/71358
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe9d04599dfc1700f215a7765775d60cb314ff0a
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shmuel Leib Melamud <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Shmuel Leib Melamud <[email protected]>
Gerrit-Reviewer: gerrit-hooks <[email protected]>
_______________________________________________
vdsm-patches mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to