[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Report no media present for cpqarray controllers with no disks attached



Some drivers (cpqarray <blegh>) make block device nodes for
controllers with no disks attached and then report a 0 size,
treat this as no media present.
---
 storage/devices.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 5049765..5a74dfa 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -747,7 +747,13 @@ class DiskDevice(StorageDevice):
 
     @property
     def mediaPresent(self):
-        return self.partedDevice is not None
+        if not self.partedDevice:
+            return False
+
+        # Some drivers (cpqarray <blegh>) make block device nodes for
+        # controllers with no disks attached and then report a 0 size,
+        # treat this as no media present
+        return self.partedDevice.getSize() != 0
 
     @property
     def model(self):
-- 
1.6.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]