[PATCH rhel7-branch] yumpayload: correctly handle new NFS installation source when using inst.stage2=nfs:...

David Lehman dlehman at redhat.com
Fri Sep 26 19:47:02 UTC 2014


On 09/26/2014 12:28 PM, Will Woods wrote:
> This block of code runs when you're setting up a new NFS installation
> source (i.e. method.method is 'nfs'). At this point 'device' is the
> mount device for DRACUT_REPODIR.
>
> If you have "inst.stage2=nfs:host:/path", 'device' is going to be
> "host:/path", and iutil.parseNfsUrl('nfs:%s' % device) yields
> host="host" and path="/path".
>
> (If you have "inst.stage2=hd:sdX:..." you'll get host="sdX" and
> path="path"; otherwise you probably won't have DRACUT_REPODIR mounted
> and thus no 'device'.)
>
> The problem, then, is this: if you have 'path', then 'path in device' is
> always true, because 'path' was just split out of 'device'. Which means
> we'll always assume that DRACUT_REPODIR is the mount we want, even if
> it's not!
>
> To fix this, we need to actually check to see if the thing mounted at
> DRACUT_REPODIR is actually the same as the thing in our 'method' object.
> If we have the same host and path, we can just use the mount as-is,
> otherwise we should mount the newly-provided source.
>
> Resolves: rhbz#1001638
> ---
>   pyanaconda/packaging/yumpayload.py | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
> index 1516cbb..d5ee8f3 100644
> --- a/pyanaconda/packaging/yumpayload.py
> +++ b/pyanaconda/packaging/yumpayload.py
> @@ -746,7 +746,8 @@ reposdir=%s
>                   needmount = True
>                   if device:
>                       _options, host, path = iutil.parseNfsUrl('nfs:%s' % device)
> -                    if path and path in device:
> +                    if method.server and method.server == host and \
> +                       method.dir and method.dir == path:
>                           needmount = False
>                           path = DRACUT_REPODIR
>                   if needmount:
>

It certainly seems more stringent than the previous check. It's been a 
long time since I really thought about this code, but this looks correct.

David



More information about the anaconda-patches mailing list