Chris Lumens wrote:
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)
I think you are on the right track here. I wonder if we will need
similar mappings for when we use --useexisting on the logvol or raid
commands. I don't think so, but I have not been able to convince myself
of that.
Me don't think so either, but we'll need the mapping also for raid.*
ks references, I've updated and tested the patch.
>From 4387d28bb4a0c010eca655e9f6c431be078122fc Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@xxxxxxxxxx>
Date: Wed, 1 Apr 2009 16:26:29 +0200
Subject: [PATCH] Use existing partitions when --onpart is used for PVs or raid members (#493065)
Store mapping from pv names used in ks (e.g. pv.1, raid.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 | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/kickstart.py b/kickstart.py
index 844e58c..8721adc 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -611,6 +611,9 @@ class Partition(commands.partition.F9_Partition):
if devicetree.getDeviceByName(kwargs["name"]):
raise KickstartValueError, formatErrorMsg(self.lineno, msg="RAID 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.startswith("pv."):
type = "lvmpv"
@@ -619,6 +622,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"
@@ -762,6 +768,8 @@ class Raid(commands.raid.F9_Raid):
# Get a list of all the RAID members.
for member in rd.members:
+ # if member is using --onpart, use original device
+ member = self.handler.onPart.get(member, member)
dev = devicetree.getDeviceByName(member)
if not dev:
raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in RAID specification" % member)
@@ -879,6 +887,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 +903,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 +917,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 +1037,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