Change in vdsm[master]: migration: Add incoming migration semaphore

fromani at redhat.com fromani at redhat.com
Mon Oct 5 12:03:33 UTC 2015


Francesco Romani has posted comments on this change.

Change subject: migration: Add incoming migration semaphore
......................................................................


Patch Set 5:

(2 comments)

https://gerrit.ovirt.org/#/c/45954/5/lib/vdsm/utils.py
File lib/vdsm/utils.py:

Line 1277:         yield
Line 1278: 
Line 1279: 
Line 1280: @contextmanager
Line 1281: def acquired(resource, block):
acquired vs acquire

still, I'm not happy with this code. The problem is that a context manager inherently suggests that we are going to execute some code with some resource, or with a fixed preamble/postamble.

But here we just want to make sure to release the resource on error, while on success we will have a wildly different code path.

For this reason I'm more and more convinced that a plain try/except in the calling site is clearer.
Line 1282:     success = resource.acquire(block)
Line 1283:     try:
Line 1284:         yield success
Line 1285:     except Exception:


https://gerrit.ovirt.org/#/c/45954/5/vdsm/virt/vm.py
File vdsm/virt/vm.py:

Line 2752:             fromSnapshot = self.conf.pop('restoreFromSnapshot', False)
Line 2753:             hooks.after_vm_dehibernate(self._dom.XMLDesc(0), self.conf,
Line 2754:                                        {'FROM_SNAPSHOT': fromSnapshot})
Line 2755:         elif 'migrationDest' in self.conf:
Line 2756:             migration.incomingMigrations.release()
what if waitMigration == True?

If so, we still need to transfer some data, so migration is not done yet.
Line 2757:             waitMigration = True
Line 2758:             if self.recovering:
Line 2759:                 try:
Line 2760:                     if self._isDomainRunning():


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8952f732033ed160292b11fbc0c4deac099b2b3e
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan at redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjelinek at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list