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

Will Woods wwoods at redhat.com
Fri Sep 26 17:28:42 UTC 2014


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:
-- 
1.9.3



More information about the anaconda-patches mailing list