Ayal Baron has posted comments on this change.

Change subject: gluster: Added gluster hooks support
......................................................................


Patch Set 23: (2 inline comments)

....................................................
File vdsm/gluster/hooks.py
Line 133: @exportToSuperVdsm
Line 134: def hookEnable(glusterCmd, hookLevel, hookName):
Line 135:     enabledFile, disabledFile = _getHookFileNames(glusterCmd,
Line 136:                                                   hookLevel.lower(), 
hookName)
Line 137:     if os.path.exists(disabledFile):
this is racy by nature.  you could check if errno == ENOENT in the except 
clause instead
Line 138:         try:
Line 139:             os.rename(disabledFile, enabledFile)
Line 140:             st = os.stat(enabledFile)
Line 141:             os.chmod(enabledFile, st.st_mode | stat.S_IEXEC)


Line 137:     if os.path.exists(disabledFile):
Line 138:         try:
Line 139:             os.rename(disabledFile, enabledFile)
Line 140:             st = os.stat(enabledFile)
Line 141:             os.chmod(enabledFile, st.st_mode | stat.S_IEXEC)
why not toggle enable/disable by just changing the executable bit on the file.  
That way you don't need to rename the file and check existence of both enabled 
and disabled and cannot reach a state where you have the same hook both enabled 
and disabled at the same time etc.
Line 142:         except OSError, e:
Line 143:             errMsg = "[Errno %s] %s: '%s'" % (e.errno, e.strerror, 
e.filename)
Line 144:             raise ge.GlusterHookEnableFailedException(err=[errMsg])
Line 145:     elif not os.path.exists(enabledFile):


--
To view, visit http://gerrit.ovirt.org/9671
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I3918aa035d90967f1297dc7fadcf14b6a9385c45
Gerrit-PatchSet: 23
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <[email protected]>
Gerrit-Reviewer: Aravinda VK <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Bala.FA <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Timothy Asir <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to