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

[PATCH rhel5] Find LVs specified by label in /etc/fstab. (#502178)



I modified patch by Masahiro Matsuya. Tested both for rescue and upgrade,
both for encrypted/non-encrypted logical volume.
---
 partedUtils.py |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/partedUtils.py b/partedUtils.py
index 9c9cd33..1f7238d 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -764,6 +764,32 @@ class DiskSet:
             if crypto:
                 crypto.closeDevice()
 
+        for (vg, lv, size, lvorigin) in lvm.lvlist():
+            if lvorigin:
+                continue
+            prefix = "/dev/"
+            dev = "%s/%s" % (vg, lv)
+            dmnode = "mapper/%s-%s" % (vg, lv)
+            crypto = self.anaconda.id.partitions.encryptedDevices.get(dmnode)
+            if crypto and not crypto.openDevice():
+                dev = crypto.getDevice()
+            found = 0
+            for fs in fsset.getFStoTry(prefix + dev):
+                try:
+                    isys.mount(prefix + dev, self.anaconda.rootPath, fs, readOnly = 1)
+                    found = 1
+                    break
+                except SystemError:
+                    pass
+            if found:
+                label = isys.readFSLabel(prefix + dev, makeDevNode = 0)
+                if label:
+                    labels[dev] = label
+                isys.umount(self.anaconda.rootPath)
+
+            if crypto:
+                crypto.closeDevice()
+
         return labels
 
     def findExistingRootPartitions(self, upgradeany = 0):
-- 
1.6.0.6


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