[PATCH 2/2] Validate and correct vg names as needed.
David Lehman
dlehman at redhat.com
Wed Dec 12 20:25:07 UTC 2012
Related: rhbz#747278
---
pyanaconda/kickstart.py | 8 +++++++-
pyanaconda/storage/__init__.py | 10 ++++++++++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 1ec294a..42ec574 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -597,6 +597,9 @@ class LogVolData(commands.logvol.F18_LogVolData):
storage.doAutoPart = False
+ # we might have truncated or otherwise changed the specified vg name
+ vgname = ksdata.onPart.get(self.vgname, self.vgname)
+
if self.mountpoint == "swap":
type = "swap"
self.mountpoint = ""
@@ -614,7 +617,7 @@ class LogVolData(commands.logvol.F18_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)
@@ -1266,6 +1269,9 @@ class VolGroupData(commands.volgroup.FC16_VolGroupData):
elif self.reserved_percent:
request.reserved_percent = self.reserved_percent
+ # in case we had to truncate or otherwise adjust the specified name
+ ksdata.onPart[self.vgname] = request.name
+
class XConfig(commands.xconfig.F14_XConfig):
def execute(self, *args):
desktop = Desktop()
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index c914eef..f76a7b4 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1071,6 +1071,11 @@ class Storage(object):
if kwargs.has_key("name"):
name = kwargs.pop("name")
+ safe_name = self.safeDeviceName(name)
+ if safe_name != name:
+ log.warning("using '%s' instead of specified name '%s'"
+ % (safe_name, name))
+ name = safe_name
else:
swap = getattr(kwargs.get("format"), "type", None) == "swap"
mountpoint = getattr(kwargs.get("format"), "mountpoint", None)
@@ -1089,6 +1094,11 @@ class Storage(object):
if kwargs.has_key("name"):
name = kwargs.pop("name")
+ safe_name = self.safeDeviceName(name)
+ if safe_name != name:
+ log.warning("using '%s' instead of specified name '%s'"
+ % (safe_name, name))
+ name = safe_name
else:
hostname = ""
if self.data and self.data.network.hostname is not None:
--
1.7.7.6
More information about the anaconda-patches
mailing list