[rhel7-branch] Check that cache PVs (if any) are in the VG the LV belongs to (#1263258)
Vratislav Podzimek
vpodzime at redhat.com
Tue Oct 27 06:26:58 UTC 2015
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 at 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
More information about the anaconda-patches
mailing list