[PATCH 2/3] Move mediaPresent out of Device and into StorageDevice.
David Lehman
dlehman at redhat.com
Fri Jun 26 21:54:55 UTC 2015
mediaPresent indicates whether a device node is backed by
readable/writeable media. It is generally only meaningful for root devices
(devices with no parents). There are only a few instances in which this
is relevant: cdrom/dvd, card readers, md containers, and some goofy raid
hardware that creates a zero-size block device node. If you need a general-
purpose property to tell you if a device is available for general use, what
you want is the device's status attribute.
(cherry picked from commit 0d7c5749f4a48700ccfb2294fcaa7feab9e7dd49)
Related: rhbz#1069597
---
blivet/devices/device.py | 5 -----
blivet/devices/md.py | 5 -----
blivet/devices/storage.py | 5 +++++
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/blivet/devices/device.py b/blivet/devices/device.py
index 1824f8c..98db834 100644
--- a/blivet/devices/device.py
+++ b/blivet/devices/device.py
@@ -298,11 +298,6 @@ class Device(util.ObjectID):
return services
- @property
- def mediaPresent(self):
- """ True if this device contains usable media. """
- return True
-
@classmethod
def isNameValid(cls, name): # pylint: disable=unused-argument
"""Is the device name valid for the device type?"""
diff --git a/blivet/devices/md.py b/blivet/devices/md.py
index 33d91b5..096975a 100644
--- a/blivet/devices/md.py
+++ b/blivet/devices/md.py
@@ -558,11 +558,6 @@ class MDRaidArrayDevice(ContainerDevice):
# (the device node does not allow read / write calls)
if self.type == "mdcontainer":
return False
- # BIOS RAID sets should show as present even when teared down
- elif self.type == "mdbiosraidarray":
- return True
- elif flags.testing:
- return True
else:
return super(MDRaidArrayDevice, self).mediaPresent
diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
index 6128886..b6ee4dc 100644
--- a/blivet/devices/storage.py
+++ b/blivet/devices/storage.py
@@ -582,6 +582,11 @@ class StorageDevice(Device):
return self.alignTargetSize(self.format.maxSize) if self.resizable else self.currentSize
@property
+ def mediaPresent(self):
+ """ True if this device contains usable media. """
+ return True
+
+ @property
def status(self):
""" This device's status.
--
2.4.3
More information about the anaconda-patches
mailing list