[PATCH 1/2] Validate and correct vg names as needed.
David Lehman
dlehman at redhat.com
Wed Dec 12 20:29:24 UTC 2012
Related: rhbz#747278
---
kickstart.py | 7 ++++++-
storage/__init__.py | 5 +++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/kickstart.py b/kickstart.py
index ec9ca90..7cc8f22 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -478,6 +478,9 @@ class LogVolData(commands.logvol.RHEL6_LogVolData):
storage.doAutoPart = False
+ # we might have truncated or otherwise changed the specified vg name
+ vgname = anaconda.id.ksdata.onPart.get(self.vgname, self.vgname)
+
if self.mountpoint == "swap":
type = "swap"
self.mountpoint = ""
@@ -495,7 +498,7 @@ class LogVolData(commands.logvol.RHEL6_LogVolData):
raise KickstartValueError, formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (self.mountpoint,))
# Check that the VG this LV is a member of has already been specified.
- vg = devicetree.getDeviceByName(self.vgname)
+ vg = devicetree.getDeviceByName(vgname)
if not vg:
raise KickstartValueError, formatErrorMsg(self.lineno, msg="No volume group exists with the name \"%s\". Specify volume groups before logical volumes." % self.vgname)
@@ -1163,6 +1166,8 @@ class VolGroupData(commands.volgroup.F16_VolGroupData):
elif self.reserved_percent:
request.reserved_percent = self.reserved_percent
+ anaconda.id.ksdata.onPart[self.vgname] = request.name
+
class XConfig(commands.xconfig.F10_XConfig):
def execute(self, anaconda):
if self.startX:
diff --git a/storage/__init__.py b/storage/__init__.py
index cd70cfa..7c62824 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -808,6 +808,11 @@ class Storage(object):
if kwargs.has_key("name"):
name = kwargs.pop("name")
+ safe_name = safeLvmName(name)
+ if safe_name != name:
+ log.warning("using '%s' instead of specified name '%s'"
+ % (safe_name, name))
+ name = safe_name
else:
name = self.createSuggestedVGName(self.anaconda.id.network)
--
1.7.7.6
More information about the anaconda-patches
mailing list