[NEW PATCH] BZ#720981 - Sometimes devices have whitespace in their name file (via gerrit-bot)
Saggi Mizrahi
smizrahi at redhat.com
Wed Jul 27 11:49:17 UTC 2011
New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/751
commit bf5f1e5ade74fd98af44c4663926929bc66443cf
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date: Wed Jul 27 12:37:39 2011 +0300
BZ#720981 - Sometimes devices have whitespace in their name file
Change-Id: Id99ab9b8b210616ef13b8acc7ddf2d5ce3f14553
diff --git a/vdsm/storage/devicemapper.py b/vdsm/storage/devicemapper.py
index 76d31a3..bf155bc 100644
--- a/vdsm/storage/devicemapper.py
+++ b/vdsm/storage/devicemapper.py
@@ -21,7 +21,7 @@ def getDmId(deviceMultipathName):
for nameFile in glob("/sys/block/dm-*/dm/name"):
try:
with open(nameFile, "r") as f:
- if f.read() == deviceMultipathName:
+ if f.read().rstrip("\n") == deviceMultipathName:
return nameFile.split("/")[3]
except (IOError, OSError):
pass
@@ -58,7 +58,7 @@ def getSlaves(deviceName):
def getDevName(dmId):
nameFilePath = os.path.join(getSysfsPath(dmId), "dm", "name")
with open(nameFilePath, "r") as f:
- return f.readline().strip()
+ return f.readline().rstrip("\n")
def resolveDevName(devName):
try:
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index 756a2ad..d2ad4ec 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -310,7 +310,7 @@ def getMPDevsIter():
nameFile = os.path.join(dmInfoDir, "name")
try:
with open(nameFile, "r") as nf:
- guid = nf.read().strip()
+ guid = nf.read().rstrip("\n")
except (OSError, IOError):
continue
More information about the vdsm-patches
mailing list