Change in vdsm[master]: storage: mount.isMounted input refactor
nsoffer at redhat.com
nsoffer at redhat.com
Thu Apr 28 00:52:56 UTC 2016
Nir Soffer has posted comments on this change.
Change subject: storage: mount.isMounted input refactor
......................................................................
Patch Set 1:
(4 comments)
https://gerrit.ovirt.org/#/c/56706/1//COMMIT_MSG
Commit Message:
Line 3: AuthorDate: 2016-04-27 17:00:57 +0300
Line 4: Commit: Idan Shaby <ishaby at redhat.com>
Line 5: CommitDate: 2016-04-27 17:26:24 +0300
Line 6:
Line 7: storage: mount.isMounted input refactor
I would call this "Streamline getting domain mountpoint.
Line 8:
Line 9: When calling mount.isMounted from Mount.py, in order to get the
Line 10: directory of a given path, there were two places that used
Line 11: os.path.join(path, "..") and counted on mount.isMounted to normalize its
Line 9: When calling mount.isMounted from Mount.py, in order to get the
Line 10: directory of a given path, there were two places that used
Line 11: os.path.join(path, "..") and counted on mount.isMounted to normalize its
Line 12: input.
Line 13: This patch replaces this approach by simply using os.path.dirname.
And replace this unclear text with:
When checking if domain mountpoint is mounted, code used to add "/.." to the domain path counting on mount.isMounted() to normalize the path. Replace with os.path.dirname().
Line 14:
Line 15: Change-Id: Id1d8b8fb7851dd4f6b18e7804518227760a3e277
https://gerrit.ovirt.org/#/c/56706/1/vdsm/storage/glusterSD.py
File vdsm/storage/glusterSD.py:
Line 43: def findDomainPath(sdUUID):
Line 44: glusterDomPath = os.path.join(sd.GLUSTERSD_DIR, "*")
Line 45: for tmpSdUUID, domainPath in fileSD.scanDomains(glusterDomPath):
Line 46: if (tmpSdUUID == sdUUID and
Line 47: mount.isMounted(os.path.dirname(domainPath))):
Please avoid long lines, and multiple operations per line - do:
if tmpSdUUID == sdUUID:
mountpoint = os.path.dirname(domainPath)
if mount.isMounted(mountpoint):
return domainPath
Line 48: return domainPath
Line 49:
Line 50: raise se.StorageDomainDoesNotExist(sdUUID)
Line 51:
https://gerrit.ovirt.org/#/c/56706/1/vdsm/storage/nfsSD.py
File vdsm/storage/nfsSD.py:
Line 106: @staticmethod
Line 107: def findDomainPath(sdUUID):
Line 108: for tmpSdUUID, domainPath in fileSD.scanDomains("*"):
Line 109: if tmpSdUUID == sdUUID and mount.isMounted(
Line 110: os.path.dirname(domainPath)):
Same, no long and twisted lines.
Line 111: return domainPath
Line 112:
Line 113: raise se.StorageDomainDoesNotExist(sdUUID)
Line 114:
--
To view, visit https://gerrit.ovirt.org/56706
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id1d8b8fb7851dd4f6b18e7804518227760a3e277
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list