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

mpolednik at redhat.com mpolednik at redhat.com
Sun Sep 13 14:47:37 UTC 2015


Martin Polednik has posted comments on this change.

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


Patch Set 3:

(3 comments)

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

Line 1272:         yield
Line 1273: 
Line 1274: 
Line 1275: @contextmanager
Line 1276: def acquired(resource, block):
> still not sure it is a good approach.
simulates standard lock quite nice (do you know why acquire has no contextmgr by default?)
Line 1277:     success = resource.acquire(block)
Line 1278:     try:
Line 1279:         yield success
Line 1280:     except Exception:


Line 1273: 
Line 1274: 
Line 1275: @contextmanager
Line 1276: def acquired(resource, block):
Line 1277:     success = resource.acquire(block)
> success is not a good name here. (And now I lack suggestions!)
imho lock (since in this context it really is a lock to resource)
Line 1278:     try:
Line 1279:         yield success
Line 1280:     except Exception:
Line 1281:         resource.release()


https://gerrit.ovirt.org/#/c/45954/3/vdsm/API.py
File vdsm/API.py:

Line 571:         :type params: dict
Line 572:         """
Line 573:         self.log.debug('Migration create')
Line 574: 
Line 575:         with utils.acquire(migration.incomingMigrations,
> acquire or acquired? (see utils.py)
I'd say it's acquired - the conditional sounds very nice then (if acquired or if not acquired)
Line 576:                            block=False) as acquired:
Line 577:             if not acquired:
Line 578:                 return response.error('migrationLimit')
Line 579: 


-- 
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: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
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