Skip to content

Commit

Permalink
merged the tmp/SLE-11-SP1-Stash branch
Browse files Browse the repository at this point in the history
svn path=/branches/SuSE-Code-11-SP1-Branch/nfs-client/; revision=58763
  • Loading branch information
jsrain committed Sep 25, 2009
1 parent 3bd8fbe commit 9ce4311
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.17.11
2.17.12
7 changes: 7 additions & 0 deletions package/yast2-nfs-client.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Apr 8 16:37:35 CEST 2009 - kmachalkova@suse.cz

- Do not use ag_showexports to show nfsv4-shared dirs on a server,
use Nfs::Mount and show directory listing instead (bnc#466454)
- 2.17.12

-------------------------------------------------------------------
Tue Dec 16 13:37:37 CET 2008 - kmachalkova@suse.cz

Expand Down
9 changes: 6 additions & 3 deletions src/Nfs.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,11 @@ the NFS client configuration.\n"));
* @param share name of the exported directory
* @param mpoint mount point (can be empty or nil, in this case it will be mounted in temporary directory)
* @param options mount options - e.g. "ro,hard,intr", see man nfs
* @param type nfs type (nfs vs. nfsv4) - if empty, 'nfs' is used
* @return string directory where volume was mounted or nil if mount failed
*/

global define string Mount(string server, string share, string mpoint, string options) ``{
global define string Mount(string server, string share, string mpoint, string options, string type) ``{

if (size(server) == 0 || size(share) == 0)
{
Expand Down Expand Up @@ -525,7 +526,9 @@ the NFS client configuration.\n"));
}

// build mount command
string command = sformat("/bin/mount %1 %2:%3 %4", (size(options) > 0) ? "-o " + options : "", server, share, mpoint);
string command = sformat("/bin/mount %1 %2 %3:%4 %5", (size(options) > 0) ? "-o " + options : "",
"-t " + (size(type) > 0 ? type : "nfs"),
server, share, mpoint);

// execute mount command
return (SCR::Execute(.target.bash, command) == 0) ? mpoint : nil;
Expand All @@ -551,7 +554,7 @@ the NFS client configuration.\n"));
string type = (string) (m["vfstype"]:nil);
string file = (string) (m["file"]:nil);

if (type == "nfs" && file == mpoint)
if ( (type == "nfs" || type == "nfs4") && file == mpoint)
{
found = true;
}
Expand Down
32 changes: 30 additions & 2 deletions src/ui.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
`PushButton (`id (`pathent_list), _("&Select"))
)
),
`Left( `CheckBox(`id(`nfs4), _("NFS&v4 Share"), nfs4)),
`Left(
TextAndButton (
`TextEntry(`id(`mountent),
Expand All @@ -255,7 +256,6 @@
),
// textentry label
`VSpacing(0.2),
`Left( `CheckBox(`id(`nfs4), _("NFS&v4 Share"), nfs4)),
`TextEntry(`id(`optionsent), _("O&ptions"), options),
`VSpacing(0.2),
`HBox(
Expand Down Expand Up @@ -323,13 +323,41 @@ which probably blocks the network scanning.");
else if (ret == `pathent_list)
{
string server = (string) UI::QueryWidget(`id(`serverent), `Value);
boolean v4 = (boolean) UI::QueryWidget(`id(`nfs4), `Value);

if (!CheckHostName (server))
{
UI::SetFocus (`id (`serverent));
continue;
}

UI::OpenDialog (
`Label (
// Popup dialog, %1 is a host name
sformat (_("Getting directory list for \"%1\"..."),
server)
));
list<string> dirs = (list<string>) SCR::Read (.net.showexports, server);
list<string> dirs = [];

// showmounts does not work for nfsv4 (#466454)
if (v4)
{
string tmpdir = Nfs::Mount(server, "/", nil, "ro", "nfs4");

// This is completely stupid way how to explore what can be mounted
// and I even don't know if it is correct. Maybe 'find tmpdir -xdev -type d'
// should be used instead. No clue :(
dirs = maplist( string dirent, (list <string> ) SCR::Read(.target.dir, tmpdir), {
return "/" + dirent;
});
dirs = prepend(dirs, "/");
Nfs::Unmount( tmpdir );
}
else
{
dirs = (list<string>) SCR::Read (.net.showexports, server);
}

if (dirs == nil)
{
dirs = ["internal error"];
Expand Down

0 comments on commit 9ce4311

Please sign in to comment.