On Wed, 2015-09-16 at 10:06 +0200, Vratislav Podzimek wrote:
Looks like this will be a common mistake in kickstart and we should
catch it
early instead of ending up with a traceback when trying to create the cached LV.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/kickstart.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index e3f956a..8f31b26 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -860,6 +860,13 @@ class LogVolData(commands.logvol.RHEL7_LogVolData):
raise KickstartValueError(formatErrorMsg(self.lineno,
msg=_("No volume group exists with the name \"%s\".
Specify volume groups before logical volumes.") % self.vgname))
+ # If cache PVs specified, check that they belong to the same VG this LV is a
member of
+ if self.cache_pvs:
+ pv_devices = (lookupAlias(devicetree, pv) for pv in self.cache_pvs)
+ if not all(pv in vg.pvs for pv in pv_devices):
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg=_("Cache PVs must belong to the same VG as the cached
LV")))
+
pool = None
if self.thin_volume:
pool = devicetree.getDeviceByName("%s-%s" % (vg.name,
self.pool_name))
Anybody sees something wrong in the above change?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic