New patch submitted by Saggi Mizrahi (smizrahi(a)redhat.com)
You can review this change at:
http://gerrit.usersys.redhat.com/761
commit 1c34b5109a8b53aaa5d6a97d22450601609df6e6
Author: Saggi Mizrahi <smizrahi(a)redhat.com>
Date: Thu Jul 28 16:51:10 2011 +0300
BZ#726410 - Ignore patitioned device (again)
Change-Id: I165dd0c867e155bde3971a3600cb20429095f05b
diff --git a/vdsm/storage/devicemapper.py b/vdsm/storage/devicemapper.py
index bf155bc..bb6b7e0 100644
--- a/vdsm/storage/devicemapper.py
+++ b/vdsm/storage/devicemapper.py
@@ -60,6 +60,11 @@ def getDevName(dmId):
with open(nameFilePath, "r") as f:
return f.readline().rstrip("\n")
+def getDevUuid(dmId):
+ nameFilePath = os.path.join(getSysfsPath(dmId), "dm", "uuid")
+ with open(nameFilePath, "r") as f:
+ return f.readline().rstrip("\n")
+
def resolveDevName(devName):
try:
if os.path.exists(getSysfsPath(devName)):
@@ -83,6 +88,9 @@ def isBlockDevice(devName):
except OSError:
return False
+def isPartitioned(devName):
+ devName = resolveDevName(devName)
+ return (len(getHolders(devName)) > 0)
def getAllSlaves():
deps = {}
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 558e162..92255e0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -719,6 +719,15 @@ class HSM:
if not typeFilter(dev):
continue
+ partitioned = devicemapper.isPartitioned(dev['guid'])
+ # One day we'll stop hiding partitioned devices and let
+ # the gui grey them out so users would not just wonder
+ # where is the device. Until that glorious day leave this
+ # here.
+ if partitioned:
+ self.log.warning("Ignoring partitioned device %s", dev)
+ continue
+
pvuuid = ""
vguuid = ""
@@ -727,11 +736,16 @@ class HSM:
pvuuid = pv.uuid
vguuid = pv.vg_uuid
- devInfo = {'GUID': dev.get("guid", ""),
'pvUUID': pvuuid, 'vgUUID': vguuid,
- 'vendorID': dev.get("vendor", ""),
'productID': dev.get("product", ""),
- 'fwrev': dev.get("fwrev", ""),
"serial" : dev.get("serial", ""),
- 'capacity': dev.get("capacity", "0"),
'devtype': dev.get("devtype", ""),
- 'pathstatus': dev.get("paths", []),
'pathlist': dev.get("connections", [])}
+ devInfo = {'GUID': dev.get("guid", ""),
'pvUUID': pvuuid,
+ 'vgUUID': vguuid, 'vendorID':
dev.get("vendor", ""),
+ 'productID': dev.get("product", ""),
+ 'fwrev': dev.get("fwrev", ""),
+ "serial" : dev.get("serial", ""),
+ 'capacity': dev.get("capacity",
"0"),
+ 'devtype': dev.get("devtype", ""),
+ 'pathstatus': dev.get("paths", []),
+ 'pathlist': dev.get("connections", []),
+ 'partitioned': partitioned}
for path in devInfo["pathstatus"]:
path["lun"] = path["hbtl"].lun
del path["hbtl"]
@@ -739,8 +753,6 @@ class HSM:
devices.append(devInfo)
except se.InvalidPhysDev:
pass
- except se.PartitionedPhysDev:
- self.log.warning("Ignore partitioned device %s", dev)
return devices