[PATCH] [master] Enable method/repo nfs options in stage2.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In stage 2, the nfs options given in repo= boot parameter were malparsed, in UI
they were ignored.

Note that now the options can get to stage 2 only via method=/repo= boot
parameter.  Ks nfs option --opts works only when its url specifies stage2 (i.e.
ends with images/install.img).  In cases when method (--repo parameter for
anaconda python script) is inferred from stage2, nfs options of stage2
"nfs:..." url aren't passed to stage 2.

---
 isys/isys.py   |    5 +++--
 iutil.py       |   15 +++++++++++++++
 iw/task_gui.py |   24 ++++++++++++++----------
 yuminstall.py  |    3 ++-
 4 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/isys/isys.py b/isys/isys.py
index 338ca26..d059db6 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -120,10 +120,11 @@ def unlosetup(device):
 # @param remount Are we mounting an already mounted filesystem?
 # @return The return value from the mount system call.
 def mount(device, location, fstype = "ext2", readOnly = False,
-          bindMount = False, remount = False, options = "defaults"):
+          bindMount = False, remount = False, options = None):
     flags = None
     location = os.path.normpath(location)
-    opts = string.split(options)
+    options = options or "defaults"
+    opts = options.split(",")
 
     # We don't need to create device nodes for devices that start with '/'
     # (like '/usbdevfs') and also some special fake devices like 'proc'.
diff --git a/iutil.py b/iutil.py
index 7912bbf..ca3080d 100644
--- a/iutil.py
+++ b/iutil.py
@@ -1028,3 +1028,18 @@ def resetRpmDb(rootdir):
             os.unlink(rpmfile)
         except Exception, e:
             log.debug("error %s removing file: %s" %(e,rpmfile))
+
+def parseNfsUrl(nfsurl):
+    options = ''
+    host = ''
+    path = ''
+    if nfsurl:
+        s = nfsurl.split(":")
+        s.pop(0)
+        if len(s) >= 3:
+            (options, host, path) = s[:3]
+        elif len(s) == 2:
+            (host, path) = s
+        else:
+            host = s[0]
+    return (options, host, path)
diff --git a/iw/task_gui.py b/iw/task_gui.py
index 067e6cd..6dc16ee 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -32,6 +32,7 @@ import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 
 import network
+import iutil
 
 from yuminstall import AnacondaYumRepo
 import yum.Errors
@@ -204,13 +205,10 @@ class RepoEditor:
                     self.proxyCheckbox.set_active(False)
                     self.proxyTable.set_sensitive(False)
             elif url.startswith("nfs"):
-                method_server_dir = url.split(":")
-                try:
-                    self.nfsServerEntry.set_text(method_server_dir[1])
-                    self.nfsPathEntry.set_text(method_server_dir[2])
-                except IndexError:
-                    pass
-                self.nfsOptionsEntry.set_text("")
+                (opts, server, path) = iutil.parseNfsUrl(url)
+                self.nfsServerEntry.set_text(server)
+                self.nfsPathEntry.set_text(path)
+                self.nfsOptionsEntry.set_text(opts)
             elif url.startswith("cdrom:"):
                 pass
             elif url.startswith("hd:"):
@@ -301,6 +299,9 @@ class RepoEditor:
         path = self.nfsPathEntry.get_text()
         path.strip()
 
+        options = self.nfsOptionsEntry.get_text()
+        options.strip()
+
         repo.name = self.nameEntry.get_text()
 
         if not server or not path:
@@ -312,7 +313,7 @@ class RepoEditor:
         dest = tempfile.mkdtemp("", repo.name.replace(" ", ""), "/mnt")
 
         try:
-            isys.mount("%s:%s" % (server, path), dest, "nfs")
+            isys.mount("%s:%s" % (server, path), dest, "nfs", options=options)
         except Exception as e:
             self.intf.messageWindow(_("Error Setting Up Repository"),
                 _("The following error occurred while setting up the "
@@ -320,7 +321,7 @@ class RepoEditor:
             return False
 
         repo.baseurl = "file://%s" % dest
-        repo.anacondaBaseURLs = ["nfs:%s:%s" % (server,path)]
+        repo.anacondaBaseURLs = ["nfs:%s:%s:%s" % (options,server,path)]
         return True
 
     def _applyHd(self, repo):
@@ -438,12 +439,15 @@ class RepoMethodstrEditor(RepoEditor):
         path = self.nfsPathEntry.get_text()
         path.strip()
 
+        options = self.nfsOptionsEntry.get_text()
+        options.strip()
+
         if not server or not path:
             self.intf.messageWindow(_("Error"),
                                     _("Please enter an NFS server and path."))
             return False
 
-        return "nfs:%s:%s" % (server, path)
+        return "nfs:%s:%s:%s" % (options, server, path)
 
     def _applyHd(self):
         return None
diff --git a/yuminstall.py b/yuminstall.py
index 0eb428a..ce9c02c 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -455,7 +455,8 @@ class AnacondaYum(YumSorter):
                     if not self.anaconda.intf.enableNetwork():
                         self._baseRepoURL = None
 
-                isys.mount(m[4:], self.tree, "nfs")
+                (opts, server, path) = iutil.parseNfsUrl(m)
+                isys.mount(server+":"+path, self.tree, "nfs", options=opts)
 
                 # This really should be fixed in loader instead but for now see
                 # if there's images and if so go with this being an NFSISO
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux