Change in vdsm[master]: storage: mount.isMounted input refactor

ishaby at redhat.com ishaby at redhat.com
Wed Apr 27 14:36:03 UTC 2016


Idan Shaby has uploaded a new change for review.

Change subject: storage: mount.isMounted input refactor
......................................................................

storage: mount.isMounted input refactor

When calling mount.isMounted from Mount.py, in order to get the
directory of a given path, there were two places that used
os.path.join(path, "..") and counted on mount.isMounted to normalize its
input.
This patch replaces this approach by simply using os.path.dirname.

Change-Id: Id1d8b8fb7851dd4f6b18e7804518227760a3e277
Signed-off-by: Idan Shaby <ishaby at redhat.com>
---
M vdsm/storage/glusterSD.py
M vdsm/storage/nfsSD.py
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/56706/1

diff --git a/vdsm/storage/glusterSD.py b/vdsm/storage/glusterSD.py
index ae4711c..1a0f092 100644
--- a/vdsm/storage/glusterSD.py
+++ b/vdsm/storage/glusterSD.py
@@ -43,8 +43,8 @@
     def findDomainPath(sdUUID):
         glusterDomPath = os.path.join(sd.GLUSTERSD_DIR, "*")
         for tmpSdUUID, domainPath in fileSD.scanDomains(glusterDomPath):
-            if tmpSdUUID == sdUUID and mount.isMounted(os.path.join(domainPath,
-                                                       "..")):
+            if (tmpSdUUID == sdUUID and
+                    mount.isMounted(os.path.dirname(domainPath))):
                 return domainPath
 
         raise se.StorageDomainDoesNotExist(sdUUID)
diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py
index ece3f50..de56cb5 100644
--- a/vdsm/storage/nfsSD.py
+++ b/vdsm/storage/nfsSD.py
@@ -107,7 +107,7 @@
     def findDomainPath(sdUUID):
         for tmpSdUUID, domainPath in fileSD.scanDomains("*"):
             if tmpSdUUID == sdUUID and mount.isMounted(
-                    os.path.join(domainPath, "..")):
+                    os.path.dirname(domainPath)):
                 return domainPath
 
         raise se.StorageDomainDoesNotExist(sdUUID)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1d8b8fb7851dd4f6b18e7804518227760a3e277
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Idan Shaby <ishaby at redhat.com>


More information about the vdsm-patches mailing list