summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-11-02 16:29:22 -0600
committerDavid Lehman <dlehman@redhat.com>2009-11-03 09:56:18 -0600
commite405f718da065c5fc9ced6ac50a3e86dd8788745 (patch)
tree7846af0ba3c30534066610d947ca3a8a13748976 /storage
parent17944906ca27cd44cbbc4ea4008c89433342bd1a (diff)
downloadanaconda-e405f718da065c5fc9ced6ac50a3e86dd8788745.tar.gz
anaconda-e405f718da065c5fc9ced6ac50a3e86dd8788745.tar.xz
anaconda-e405f718da065c5fc9ced6ac50a3e86dd8788745.zip
Fix status for and consolidate handling of '-' in vg/lv names. (#527302)
Diffstat (limited to 'storage')
-rw-r--r--storage/devices.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/storage/devices.py b/storage/devices.py
index 4cce154fe..50ae804d3 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1339,10 +1339,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
@@ -1611,19 +1616,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):
@@ -2034,21 +2043,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):