summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-11-02 16:29:22 -0600
committerDavid Lehman <dlehman@redhat.com>2009-11-02 16:29:22 -0600
commit0e2d60004baabe471ee0bbb47a43eababeaecdc4 (patch)
tree673f71f3e267f74e078ecc87b6b5b4a1dc2ce812
parent94b6e00515ac5a5d0d49dd1e5969fe7cadc62e8e (diff)
downloadanaconda-0e2d60004baabe471ee0bbb47a43eababeaecdc4.tar.gz
anaconda-0e2d60004baabe471ee0bbb47a43eababeaecdc4.tar.xz
anaconda-0e2d60004baabe471ee0bbb47a43eababeaecdc4.zip
Fix status for and consolidate handling of '-' in vg/lv names. (#527302)
-rw-r--r--storage/devices.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/storage/devices.py b/storage/devices.py
index 643e74e61..0bf9c6c69 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1337,10 +1337,15 @@ class DMDevice(StorageDevice):
return self.path
@property
+ def mapName(self):
+ """ This device's device-mapper map name """
+ return self.name
+
+ @property
def status(self):
_status = False
for map in block.dm.maps():
- if map.name == self.name:
+ if map.name == self.mapName:
_status = map.live_table and not map.suspended
break
@@ -1609,19 +1614,23 @@ class LVMVolumeGroupDevice(DMDevice):
raise DeviceError("device has not been created", self.name)
@property
+ def mapName(self):
+ """ This device's device-mapper map name """
+ # Thank you lvm for this lovely hack.
+ return self.name.replace("-","--")
+
+ @property
def path(self):
""" Device node representing this device. """
- # Thank you lvm for this lovely hack.
- return "%s/%s" % (self._devDir, self.name.replace("-","--"))
+ return "%s/%s" % (self._devDir, self.mapName)
def getDMNode(self):
""" Return the dm-X (eg: dm-0) device node for this device. """
- # Thank you lvm for this lovely hack.
log_method_call(self, self.name, status=self.status)
if not self.exists:
raise DeviceError("device has not been created", self.name)
- return dm.dm_node_from_name(self.name.replace("-","--"))
+ return dm.dm_node_from_name(self.mapName)
@property
def status(self):
@@ -2032,21 +2041,23 @@ class LVMLogicalVolumeDevice(DMDevice):
return self.parents[0]
@property
+ def mapName(self):
+ """ This device's device-mapper map name """
+ # Thank you lvm for this lovely hack.
+ return "%s-%s" % (self.vg.mapName, self._name.replace("-","--"))
+
+ @property
def path(self):
""" Device node representing this device. """
- # Thank you lvm for this lovely hack.
- return "%s/%s-%s" % (self._devDir, self.vg.name.replace("-","--"),
- self._name.replace("-","--"))
+ return "%s/%s" % (self._devDir, self.mapName)
def getDMNode(self):
""" Return the dm-X (eg: dm-0) device node for this device. """
- # Thank you lvm for this lovely hack.
log_method_call(self, self.name, status=self.status)
if not self.exists:
raise DeviceError("device has not been created", self.name)
- return dm.dm_node_from_name("%s-%s" % (self.vg.name.replace("-","--"), \
- self._name.replace("-","--")))
+ return dm.dm_node_from_name(self.mapName)
@property
def name(self):