[PATCH] (take III/^#!@*?) Use existing partitions when --onpart is used for PVs (#493065)

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

 



Store mapping from pv names used in ks (e.g. pv.1) to existing
partitions in ks handler and use it when processing ks commands
referring to the names.
Also fix some attribute references.
---
 kickstart.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index 844e58c..01e7b0d 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -619,6 +619,9 @@ class Partition(commands.partition.F9_Partition):
             if devicetree.getDeviceByName(kwargs["name"]):
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="PV partition defined multiple times")
 
+            # store mapping for other ks partitioning commands
+            if pd.onPart:
+                self.handler.onPart[kwargs["name"]] = pd.onPart
             pd.mountpoint = ""
         elif pd.mountpoint == "/boot/efi":
             type = "EFI System Partition"
@@ -879,6 +882,8 @@ class VolGroup(commands.volgroup.FC3_VolGroup):
 
         # Get a list of all the physical volume devices that make up this VG.
         for pv in vgd.physvols:
+            # if pv is using --onpart, use original device
+            pv = self.handler.onPart.get(pv, pv)
             dev = devicetree.getDeviceByName(pv)
             if not dev:
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in Volume Group specification" % pv)
@@ -893,12 +898,12 @@ class VolGroup(commands.volgroup.FC3_VolGroup):
 
         # If --noformat was given, there's really nothing to do.
         if not vgd.format:
-            if not vgd.name:
+            if not vgd.vgname:
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="--noformat used without giving a name")
 
-            dev = devicetree.getDeviceByName(vgd.name)
+            dev = devicetree.getDeviceByName(vgd.vgname)
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting VG with the name \"%s\" was found." % vgd.name)
+                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting VG with the name \"%s\" was found." % vgd.vgname)
 
             return vgd
 
@@ -907,9 +912,9 @@ class VolGroup(commands.volgroup.FC3_VolGroup):
         # Also, we only support a subset of all the options on pre-existing
         # VGs.
         if vgd.preexist:
-            device = devicetree.getDeviceByName(vgd.name)
+            device = devicetree.getDeviceByName(vgd.vgname)
             if not device:
-                raise KicsktartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent VG %s in volgroup command" % vgd.name)
+                raise KicsktartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent VG %s in volgroup command" % vgd.vgname)
 
             devicetree.registerAction(ActionCreateFormat(device))
         else:
@@ -1027,6 +1032,7 @@ class AnacondaKSHandler(superclass):
         self.showSteps = []
         self.anaconda = anaconda
         self.id = self.anaconda.id
+        self.onPart = {}
 
 class EarlyKSHandler(superclass):
     # This handler class only processes a couple kickstart commands.  It is
-- 
1.5.4.3

_______________________________________________
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