Eduardo has uploaded a new change for review.

Change subject: Distinguish between local and mounted SD's.
......................................................................

Distinguish between local and mounted SD's.

Remote SD's were identified like locals due to mismatched name
mangling.
This patch is a minimal emergency fix.
The /rhev/datacenter hierarchy should be revised.
The need for localFsSD's should be revised too.

Change-Id: I12b5ba80121b8e8d23a63ecc7aaab829bfc67a51
Bug-url: https://bugzilla.redhat.com/show_bug.cgi?id=886533
Signed-off-by: Eduardo <[email protected]>
---
M vdsm/storage/localFsSD.py
1 file changed, 25 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/10024/1

diff --git a/vdsm/storage/localFsSD.py b/vdsm/storage/localFsSD.py
index 198c073..d9ac3f0 100644
--- a/vdsm/storage/localFsSD.py
+++ b/vdsm/storage/localFsSD.py
@@ -94,14 +94,36 @@
     @staticmethod
     def findDomainPath(sdUUID):
         for tmpSdUUID, domainPath in fileSD.scanDomains("_*"):
-            if tmpSdUUID == sdUUID:
+            if tmpSdUUID == sdUUID and isLocalFsDomain(sdUUID):
                 return domainPath
-
-        raise se.StorageDomainDoesNotExist(sdUUID)
+        else:
+            raise se.StorageDomainDoesNotExist(sdUUID)
 
     def getRealPath(self):
         return os.readlink(self.mountpoint)
 
 
+# TODO: This function should be removed when the mangled mangling name scheme
+# of mounted (nfs, Posix) SD's and local SD's is fixed but...
+# Is better to remove completely the localFS SD's concept, but...
+# this will not fixed by now
+def isLocalFsDomain(sdUUID):
+    """This ancillary function differentiates local and mounted SD's.
+
+    Assumed that a local SD can't be mounted.
+    mounted: nfs, posixFS
+    local: a link to a local dir in the /rhev/datacenter
+    """
+    mtab = open("/etc/mtab", "r").readlines()
+    for mEntry in mtab:
+        if sdUUID in mEntry:
+            # This is a mounted domain therefore not exists as a local SD.
+            isLocal = False
+            break
+    else:
+        isLocal = True
+    return isLocal
+
+
 def findDomain(sdUUID):
     return LocalFsStorageDomain(LocalFsStorageDomain.findDomainPath(sdUUID))


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12b5ba80121b8e8d23a63ecc7aaab829bfc67a51
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to