[PATCH 4/4] Allow the use of "-" in the lvm names. (495329)

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

 



---
 partIntfHelpers.py    |    2 +-
 storage/devices.py    |   32 ++++++++++++++++++++++++++++++++
 storage/devicetree.py |    4 ++++
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index ed9dfe5..bd1ddbb 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -48,7 +48,7 @@ def sanityCheckVolumeGroupName(volname):
 	return _("Error - the volume group name %s is not valid." % (volname,))
 
     for i in range(0, len(volname)):
-	rc = string.find(string.letters + string.digits + '.' + '_', volname[i])
+	rc = string.find(string.letters + string.digits + '.' + '_' + '-', volname[i])
 	if rc == -1:
 	    return _("Error - the volume group name contains illegal "
 		     "characters or spaces.  Acceptable characters "
diff --git a/storage/devices.py b/storage/devices.py
index aef8e6f..91fa40c 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1576,6 +1576,21 @@ class LVMVolumeGroupDevice(DMDevice):
             raise DeviceError("device has not been created")
 
     @property
+    def path(self):
+        """ Device node representing this device. """
+        # Thank you lvm for this lovely hack.
+        return "%s/%s" % (self._devDir, self.name.replace("-","--"))
+
+    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")
+
+        return dm.dm_node_from_name(self.name.replace("-","--"))
+
+    @property
     def status(self):
         """ The device's status (True means active). """
         if not self.exists:
@@ -1938,6 +1953,23 @@ class LVMLogicalVolumeDevice(DMDevice):
         return self.parents[0]
 
     @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("-","--"))
+
+    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")
+
+        return dm.dm_node_from_name("%s-%s" % (self.vg.name.replace("-","--"), \
+                self._name.replace("-","--")))
+
+    @property
     def name(self):
         """ This device's name. """
         return "%s-%s" % (self.vg.name, self._name)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 319c5af..dc8ac6c 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1676,6 +1676,10 @@ class DeviceTree(object):
             if device.name == name:
                 found = device
                 break
+            elif (device.type == "lvmlv" or device.type == "lvmvg") and \
+                    device.name == name.replace("--","-"):
+                found = device
+                break
 
         log.debug("found %s" % found)
         return found
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux