Author: fehr
Date: Thu Jul 26 14:33:41 2007
New Revision: 39709
URL: http://svn.opensuse.org/viewcvs/yast?rev=39709&view=rev
Log:
- NFS support should now be working (feature #300779)
- version 2.15.19
Added:
trunk/storage/storage/src/include/nfs.ycp
Modified:
trunk/storage/VERSION
trunk/storage/libstorage/src/AppUtil.cc
trunk/storage/libstorage/src/AppUtil.h
trunk/storage/libstorage/src/DmPartCo.cc
trunk/storage/libstorage/src/DmraidCo.cc
trunk/storage/libstorage/src/Nfs.cc
trunk/storage/libstorage/src/Nfs.h
trunk/storage/libstorage/src/NfsCo.cc
trunk/storage/libstorage/src/NfsCo.h
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/StorageInterface.h
trunk/storage/libstorage/src/Volume.cc
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/include/custom_part_check_generated.ycp
trunk/storage/storage/src/include/custom_part_lib.ycp
trunk/storage/storage/src/inst_custom_part.ycp
trunk/storage/storage/src/modules/FileSystems.ycp
trunk/storage/storage/src/modules/Storage.ycp
Modified: trunk/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/VERSION (original)
+++ trunk/storage/VERSION Thu Jul 26 14:33:41 2007
@@ -1 +1 @@
-2.15.18
+2.15.19
Modified: trunk/storage/libstorage/src/AppUtil.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AppUtil.cc (original)
+++ trunk/storage/libstorage/src/AppUtil.cc Thu Jul 26 14:33:41 2007
@@ -390,9 +390,15 @@
return( ret );
}
+bool isNfsDev( const string& dev )
+ {
+ return( !dev.empty() && dev[0]!='/' &&
+ dev.find( ':' )!=string::npos );
+ }
+
void normalizeDevice( string& dev )
{
- if( dev.find( "/dev/" )!=0 )
+ if( dev.find( "/dev/" )!=0 && !isNfsDev(dev) )
dev = "/dev/" + dev;
}
Modified: trunk/storage/libstorage/src/AppUtil.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.h?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AppUtil.h (original)
+++ trunk/storage/libstorage/src/AppUtil.h Thu Jul 26 14:33:41 2007
@@ -48,6 +48,7 @@
void normalizeDevice( string& dev );
string undevDevice( const string& dev );
void undevDevice( string& dev );
+bool isNfsDev( const string& dev );
bool runningFromSystem();
void delay(int Microsec_iv);
unsigned getMajorDevices( const string& driver );
Modified: trunk/storage/libstorage/src/DmPartCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPartCo.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmPartCo.cc (original)
+++ trunk/storage/libstorage/src/DmPartCo.cc Thu Jul 26 14:33:41 2007
@@ -920,6 +920,8 @@
s << *((PeContainer*)&d);
s << " DmNr:" << d.mnr
<< " PNum:" << d.num_part;
+ if( !d.udev_id.empty() )
+ s << " UdevId:" << d.udev_id;
if( d.del_ptable )
s << " delPT";
if( !d.active )
Modified: trunk/storage/libstorage/src/DmraidCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmraidCo.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmraidCo.cc (original)
+++ trunk/storage/libstorage/src/DmraidCo.cc Thu Jul 26 14:33:41 2007
@@ -75,6 +75,8 @@
y2milestone( "disk %s id %s", nm.c_str(), id.c_str() );
udev_id.clear();
udev_id = splitString( id );
+ udev_id.erase( remove_if(udev_id.begin(), udev_id.end(),
+ find_begin("dm-uuid-dmraid")));
udev_id.sort();
y2mil( "id:" << udev_id );
DmraidPair pp = dmraidPair();
Modified: trunk/storage/libstorage/src/Nfs.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Nfs.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Nfs.cc (original)
+++ trunk/storage/libstorage/src/Nfs.cc Thu Jul 26 14:33:41 2007
@@ -33,9 +33,27 @@
y2debug( "destructed nfs %s", dev.c_str() );
}
+string Nfs::removeText( bool doing ) const
+ {
+ string txt;
+ if( doing )
+ {
+ // displayed text during action, %1$s is replaced by volume name e.g. hilbert:/work
+ txt = sformat( _("Removing nfs volume %1$s"), dev.c_str() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by volume name e.g. hilbert:/work
+ txt = sformat( _("Remove nfs volume %1$s"), dev.c_str() );
+ }
+ return( txt );
+ }
+
void
Nfs::init()
{
+ numeric = false;
+ nm = dev;
setFs(NFS);
}
Modified: trunk/storage/libstorage/src/Nfs.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Nfs.h?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Nfs.h (original)
+++ trunk/storage/libstorage/src/Nfs.h Thu Jul 26 14:33:41 2007
@@ -16,6 +16,7 @@
friend std::ostream& operator<< (std::ostream& s, const Nfs& l );
static string canonicalName( const string& dev );
+ static bool notDeleted( const Nfs& l ) { return( !l.deleted() ); }
virtual void print( std::ostream& s ) const { s << *this; }
@@ -23,6 +24,8 @@
bool equalContent( const Nfs& rhs ) const;
void logDifference( const Nfs& d ) const;
+ string removeText( bool doing=true ) const;
+
protected:
void init();
Nfs& operator=( const Nfs& );
Modified: trunk/storage/libstorage/src/NfsCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/NfsCo.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/NfsCo.cc (original)
+++ trunk/storage/libstorage/src/NfsCo.cc Thu Jul 26 14:33:41 2007
@@ -55,12 +55,68 @@
}
int
+NfsCo::removeVolume( Volume* v )
+ {
+ y2mil( "v:" << *v );
+ int ret = 0;
+ NfsIter nfs;
+ if( !findNfs( v->device(), nfs ))
+ {
+ ret = NFS_VOLUME_NOT_FOUND;
+ }
+ if( readonly() )
+ {
+ ret = NFS_CHANGE_READONLY;
+ }
+ if( ret==0 )
+ {
+ if( nfs->created() )
+ {
+ if( !removeFromList( &(*nfs) ))
+ ret = NFS_REMOVE_VOLUME_CREATE_NOT_FOUND;
+ }
+ else
+ nfs->setDeleted();
+ }
+ y2milestone( "ret:%d", ret );
+ return( ret );
+ }
+
+int
+NfsCo::doRemove( Volume* v )
+ {
+ Nfs * p = dynamic_cast(v);
+ int ret = 0;
+ if( p != NULL )
+ {
+ if( !silent )
+ {
+ getStorage()->showInfoCb( p->removeText(true) );
+ }
+ y2milestone( "doRemove container %s name %s", name().c_str(),
+ p->name().c_str() );
+ ret = v->prepareRemove();
+ if( ret==0 )
+ {
+ if( !removeFromList( p ) )
+ ret = NFS_REMOVE_VOLUME_LIST_ERASE;
+ }
+ }
+ else
+ {
+ ret = NFS_REMOVE_INVALID_VOLUME;
+ }
+ y2milestone( "ret:%d", ret );
+ return( ret );
+ }
+
+int
NfsCo::addNfs( const string& nfsDev, unsigned long long sizeK,
const string& mp )
{
y2mil( "nfsDev:" << nfsDev << " sizeK:" << sizeK << " mp:" << mp );
Nfs *n = new Nfs( *this, nfsDev );
- n->setMount( mp );
+ n->changeMount( mp );
n->setSize( sizeK );
addToList( n );
return( 0 );
Modified: trunk/storage/libstorage/src/NfsCo.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/NfsCo.h?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/NfsCo.h (original)
+++ trunk/storage/libstorage/src/NfsCo.h Thu Jul 26 14:33:41 2007
@@ -22,6 +22,8 @@
const string& mp );
static bool isNfsDev( const string& dev );
+ int removeVolume( Volume* v );
+ int doRemove( Volume* );
bool equalContent( const Container& rhs ) const;
void logDifference( const Container& d ) const;
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Thu Jul 26 14:33:41 2007
@@ -3539,6 +3539,8 @@
}
if( ret==0 && co!=NULL )
{
+ if( sizeK==0 )
+ checkNfsDevice( nfsDev, sizeK );
ret = co->addNfs( nfsDev, sizeK, mp );
}
if( !have )
@@ -3565,6 +3567,7 @@
string mdir = tmpDir() + "/tmp_mp";
unlink( mdir.c_str() );
rmdir( mdir.c_str() );
+ createPath( mdir );
ret = co.addNfs( nfsDev, 0, "" );
if( ret==0 && (ret=co.vBegin()->mount( mdir ))==0 )
{
@@ -4668,7 +4671,7 @@
int ret = 0;
plist.clear();
assertInit();
- ConstNfsPair p = nfsPair();
+ ConstNfsPair p = nfsPair(Nfs::notDeleted);
for( ConstNfsIterator i = p.begin(); i != p.end(); ++i )
{
plist.push_back( NfsInfo() );
@@ -5650,6 +5653,11 @@
{
if( haveMd(md) )
md->syncRaidtab();
+ if( instsys() )
+ {
+ string path = root()+"/etc/fstab";
+ unlink( path.c_str() );
+ }
int ret = fstab->changeRootPrefix( root()+"/etc" );
if( ret!=0 )
y2error( "changeRootPrefix returns %d", ret );
Modified: trunk/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageInterface.h?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageInterface.h (original)
+++ trunk/storage/libstorage/src/StorageInterface.h Thu Jul 26 14:33:41 2007
@@ -657,6 +657,12 @@
DMRAID_REMOVE_FAILED = -13001,
+ NFS_VOLUME_NOT_FOUND = -14001,
+ NFS_CHANGE_READONLY = -14002,
+ NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
+ NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
+ NFS_REMOVE_INVALID_VOLUME = -14005,
+
CONTAINER_INTERNAL_ERROR = -99000,
CONTAINER_INVALID_VIRTUAL_CALL = -99001,
Modified: trunk/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Thu Jul 26 14:33:41 2007
@@ -1121,8 +1121,11 @@
}
if( ret==0 && !mp.empty() && !cont->getStorage()->test() )
{
- cont->getStorage()->removeDmTableTo( *this );
- ret = checkDevice(mountDevice());
+ if( fs!=NFS )
+ {
+ cont->getStorage()->removeDmTableTo( *this );
+ ret = checkDevice(mountDevice());
+ }
if( ret==0 )
ret = mount( lmount );
}
@@ -2374,7 +2377,7 @@
{
changed = true;
che.fs = fs_names[fs];
- if( fs==SWAP )
+ if( fs==SWAP || fs==NFS )
che.freq = che.passno = 0;
else
{
@@ -2716,7 +2719,7 @@
if( v.num>0 )
s << " Nr:" << v.num;
}
- else
+ else if( v.nm!=v.dev )
s << " Name:" << v.nm;
s << " SizeK:" << v.size_k;
if( v.size_k != v.orig_size_k )
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Thu Jul 26 14:33:41 2007
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Jul 26 14:32:49 CEST 2007 - fehr@suse.de
+
+- NFS support should now be working (feature #300779)
+- version 2.15.19
+
+-------------------------------------------------------------------
Wed Jul 25 11:36:04 CEST 2007 - fehr@suse.de
- move all autodoc files to yast2-storage-devel (feature #302461)
Modified: trunk/storage/storage/src/include/custom_part_check_generated.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_check_generated.ycp?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_check_generated.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_check_generated.ycp Thu Jul 26 14:33:41 2007
@@ -333,7 +333,7 @@
whole_disk = false;
}
- if( !part["format"]:false &&
+ if( !part["format"]:false && part["used_fs"]:`unknown!=`nfs &&
FileSystems::IsSystemMp( part["mount"]:"", false ) )
{
partition_mounted_but_not_formated = true;
@@ -647,7 +647,7 @@
if (ret == true) retval = `again;
}
- if ( (!have_swap && Stage::initial ()) || show_all_popups )
+ if ( (!have_swap && Stage::initial() && root_fs!=`nfs) || show_all_popups )
{
// popup text
boolean ret = Popup::YesNo(_("
Modified: trunk/storage/storage/src/include/custom_part_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_lib.ycp?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_lib.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_lib.ycp Thu Jul 26 14:33:41 2007
@@ -676,8 +676,9 @@
UI::ChangeWidget( `id(`fstab_options), `Enabled,
size(new["mount"]:"")>0 );
- UI::ChangeWidget(`id(`fs_options), `Enabled,
- new["format"]:false && selected_fs[`options]:[]!=[] );
+ if( UI::WidgetExists( `id(`fs_options) ))
+ UI::ChangeWidget(`id(`fs_options), `Enabled,
+ new["format"]:false && selected_fs[`options]:[]!=[] );
string fstopt = FileSystems::DefaultFstabOptions( new );
if( size(fstopt)>0 && size(new["fstopt"]:"")==0 )
new["fstopt"] = fstopt;
@@ -726,12 +727,14 @@
new = filter(string key, any value, new, ``( key != "fstopt"));
}
}
- if( !init && ret == `mount_point )
+ if( !init && ret == `mount_point &&
+ UI::WidgetExists( `id(`fstab_options) ))
{
string mp = (string)UI::QueryWidget(`id(`mount_point), `Value);
UI::ChangeWidget( `id(`fstab_options), `Enabled, size(mp)>0 );
}
- if( init || ret == `format_true || ret == `format_false )
+ if( (init && UI::WidgetExists( `id(`format))) ||
+ ret == `format_true || ret == `format_false)
{
boolean format = UI::QueryWidget(`id(`format), `CurrentButton) ==
`format_true;
@@ -742,11 +745,15 @@
// format partition
new["format"] = format;
- ////////////////////////////////////////////////
- // modify widgets
- UI::ChangeWidget( `id(`fs), `Enabled, format );
- UI::ChangeWidget( `id(`fs_options), `Enabled,
- format && selected_fs[`options]:[] != [] );
+ if( UI::WidgetExists( `id(`fs) ))
+ {
+ UI::ChangeWidget( `id(`fs), `Enabled, format );
+ }
+ if( UI::WidgetExists( `id(`fs_options) ))
+ {
+ UI::ChangeWidget( `id(`fs_options), `Enabled,
+ format && selected_fs[`options]:[] != [] );
+ }
if( UI::WidgetExists( `id(`crypt_fs) ))
{
UI::ChangeWidget( `id(`crypt_fs), `Enabled,
@@ -818,7 +825,9 @@
}
if( init || ret == `fs )
{
- symbol new_fs = (symbol)UI::QueryWidget(`id(`fs), `Value);
+ symbol new_fs = used_fs;
+ if( UI::WidgetExists( `id(`fs) ))
+ new_fs = (symbol)UI::QueryWidget(`id(`fs), `Value);
if( init )
{
if( !new["format"]:false && new["detected_fs"]:`unknown != `unknown )
@@ -828,8 +837,6 @@
if( used_fs != new_fs )
UI::ChangeWidget(`id(`fs), `Value, new_fs );
}
- y2milestone( "HandlePartWidgetChanges new_fs %1",
- UI::QueryWidget(`id(`fs), `Value) );
y2milestone( "HandlePartWidgetChanges init=%1 used_fs:%2 new_fs:%3",
init, used_fs, new_fs );
if( init || used_fs != new_fs )
Added: trunk/storage/storage/src/include/nfs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/nfs.ycp?rev=39709&view=auto
==============================================================================
--- trunk/storage/storage/src/include/nfs.ycp (added)
+++ trunk/storage/storage/src/include/nfs.ycp Thu Jul 26 14:33:41 2007
@@ -0,0 +1,299 @@
+/**
+ * File:
+ * nfs.ycp
+ *
+ * Module:
+ * Configuration nfs mounts setup
+ *
+ * Summary:
+ * Functions for nfs mounts file setup
+ *
+ * Authors:
+ * Thomas Fehr
+ *
+ * $Id:$
+ *
+ */
+
+{
+
+ textdomain "storage";
+
+ import "Wizard";
+ import "Storage";
+ import "FileSystems";
+ import "Partitions";
+ import "Label";
+
+ include "partitioning/partition_defines.ycp";
+ include "partitioning/custom_part_dialogs.ycp";
+ include "partitioning/custom_part_lib.ycp";
+
+/**
+ * NfsDlgHelp
+ * @return string
+ */
+define string NfsDlgHelp( string sv, string sp )
+ ``{
+ // help text richtext format
+ // %1 is replaced by description text for server name
+ string helptext = sformat( _("
+<p><b>%1:</b><br>This must be the name of a nfs server.
+The server needs to be accessible.</p>
+"), sv );
+
+ // help text richtext format, continued
+ // %1 is replaced by description text for nfs path
+ helptext = helptext + sformat( _("
+<p><b>%1:</b><br>This is the absolute path exported on the
+nfs server.
+"), sp );
+
+ return helptext;
+ };
+
+
+define term NfsOptionsDlg( string sv, list<string> sl, string sp, list<string> spl )
+ {
+ term widget =
+ `VBox(
+ `VSpacing(),
+ `MinWidth( 56, `ComboBox( `id(`nfs_server), `opt(`editable), sv, sl )),
+ `VSpacing(1),
+ `MinWidth( 56, `ComboBox( `id(`nfs_path), `opt(`editable), sp, spl )),
+ `VSpacing()
+ );
+ return widget;
+ };
+
+
+/**
+ * NfsExpertDlg dialog
+ * edit nfs options
+ */
+define map NfsExpertDlg( boolean edit, map part, list<string> dlist )
+ ``{
+ y2milestone( "NfsExpertDlg edit:%1 oart:%2", edit, part );
+ y2milestone( "NfsExpertDlg dlist:%1", dlist );
+ string caption = "";
+ if( edit )
+ {
+ // heading text
+ caption = _("Change NFS Path Setup");
+ }
+ else
+ {
+ // heading text
+ caption = _("Add New NFS Path");
+ }
+
+ // label text
+ string sv = _("&Name of NFS Server");
+ // label text
+ string sp = _("Absolute &Path on NFS Server");
+
+ list<string> slp = maplist( string s, dlist, ``(substring(s,search(s,":")+1)));
+ slp = toset(slp);
+ list<string> sl = maplist( string s, dlist, ``(substring(s,0,search(s,":"))));
+ sl = toset(sl);
+ y2milestone( "NfsExpertDlg sl:%1", sl );
+ y2milestone( "NfsExpertDlg sp:%1", slp );
+
+ term contents = `VBox( `HSpacing( 60 ),
+ `HBox( `HSpacing(2),
+ NfsOptionsDlg(sv,sl,sp,slp),
+ `HSpacing(2)
+ ),
+ `VSpacing(1),
+ `HBox( `HSpacing(2),
+ `Top(`ReplacePoint( `id(`mount_dlg_rp),
+ MountDlg( part, [] ))),
+ `HSpacing(30)),
+ `VSpacing(3)
+ );
+
+ contents = `VBox(
+ `Heading(caption),
+ `VSpacing(1),
+ `VStretch(),
+ contents,
+ `VSpacing(1),
+ `VStretch(),
+ `HBox(
+ `PushButton(`id(`ok), `opt(`default),
+ Label::OKButton() ),
+ `PushButton(`id(`cancel), Label::CancelButton() )
+ ));
+
+
+
+ string ht = NfsDlgHelp( deletechars(sv,"&"),
+ deletechars(sp,"&"));
+ UI::OpenDialog( `opt(`decorated ),
+ `HBox( `HWeight(30,`RichText(ht)),
+ `HStretch(),
+ `HSpacing(1),
+ `HWeight(70, contents ),
+ `HSpacing(1),
+ `HStretch()
+ ));
+
+ ////////////////////////////////////////////////////////////////
+ // configure main dialog for the first call
+ string lsize = ByteToHumanStringWithZero(part["size_k"]:0*1024);
+
+ sl = splitstring( part["device"]:"", ":" );
+
+ UI::ChangeWidget( `id(`nfs_server), `Value, sl[0]:"" );
+ UI::ChangeWidget( `id(`nfs_server), `ValidChars,
+ FileSystems::nchars + "-._" );
+ UI::ChangeWidget( `id(`nfs_server), `Enabled, !edit );
+ UI::ChangeWidget( `id(`nfs_path), `Value, sl[1]:"" );
+ UI::ChangeWidget( `id(`nfs_path), `ValidChars,
+ FileSystems::nchars + "-._/" );
+ UI::ChangeWidget( `id(`nfs_path), `Enabled, !edit );
+
+ map retval = part;
+ symbol ret = `ok;
+
+ retval = HandlePartWidgetChanges( true, ret, $[], part, retval );
+
+ repeat
+ {
+ ret = (symbol)UI::UserInput();
+ y2milestone( "NfsExpertDlg %1", ret);
+
+ ////////////////////////////////////////////////////////////
+ if( ret != `cancel )
+ {
+ retval = HandlePartWidgetChanges( false, ret, $[], part, retval );
+ }
+
+ if( ret == `ok )
+ {
+ if( !edit )
+ {
+ string server = (string)UI::QueryWidget( `id(`nfs_server), `Value);
+ string spath = (string)UI::QueryWidget( `id(`nfs_path), `Value);
+ y2milestone( "NfsExpertDlg server:%1 path:%2", server, spath );
+ if( size(server)==0 )
+ {
+ Popup::Error( sformat(_("The NFS server name \'%1\' is invalid."),server));
+ ret = `again;
+ UI::SetFocus(`id(`nfs_server));
+ continue;
+ }
+ if( size(spath)==0 || substring( spath, 0, 1 )!= "/" )
+ {
+ Popup::Error( sformat(_("The NFS path name \"%1\" is invalid.
+It must not be empty and must start with a \"/\".
+"), spath ));
+ ret = `again;
+ UI::SetFocus(`id(`nfs_path));
+ continue;
+ }
+ string dev = server + ":" + spath;
+ integer sizeK = Storage::CheckNfsVolume( dev );
+ if( sizeK<=0 )
+ {
+ Popup::Error( sformat(_("The NFS mount
+ \"%1\"
+is not accessible.
+"), dev ));
+ ret = `again;
+ UI::SetFocus(`id(`nfs_server));
+ continue;
+ }
+ retval["device"] = dev;
+ retval["size_k"] = sizeK;
+ }
+ y2milestone( "NfsExpertDlg retval:%1", retval );
+ map ret_mp = CheckOkMount( part["device"]:"", part, retval );
+ retval = ret_mp["map"]:$[];
+ y2milestone( "NfsExpertDlg ret_mp %1 part %2", ret_mp, part );
+ if( !ret_mp["ok"]:false )
+ {
+ if( ret_mp["field"]:`none != `none )
+ UI::SetFocus(`id( ret_mp["field"]:`none ));
+ ret = `again;
+ continue;
+ }
+
+ ret_mp = CheckDeviceFinalOk( retval );
+ if( !ret_mp["ok"]:false )
+ {
+ ret = `again;
+ }
+ else
+ {
+ retval = ret_mp["map"]:$[];
+ }
+ }
+ } until( ret == `ok || ret == `cancel || ret == `next ||
+ ret == `back || ret == `abort );
+
+ retval["symbol"] = ret;
+ y2milestone( "NfsExpertDlg ret:%1 retval=%2", ret, retval );
+ UI::CloseDialog();
+ return retval;
+ }
+
+
+/**
+ * NfsSetup dialog
+ *
+ * Provide dialog for settings of nfs related parameters
+ */
+define symbol NfsSetup( boolean edit )
+ ``{
+ string id = Storage::GetWizardKey();
+ string key = "/dev/nfs";
+ y2milestone( "NfsSetup edit %1 id %2", edit, id );
+ map part = $[];
+ map tg = Storage::GetTargetMap();
+ if( edit )
+ {
+ part = Storage::GetPartition( tg, id );
+ }
+ else
+ {
+ part["type"] = `nfs;
+ part["used_fs"] = `nfs;
+ part["detected_fs"] = `nfs;
+ part["create"] = true;
+ }
+ y2milestone( "NfsSetup part %1", part );
+
+ list<string> l = maplist( map p, tg["/dev/nfs","partitions"]:[],
+ ``(p["device"]:""));
+ part = NfsExpertDlg( edit, part, l );
+
+ symbol ret = part["symbol"]:`next;
+ // remove symbol key from data
+ part = filter( string key, any value, part, ``( key != "symbol" ));
+
+ if( ret == `ok )
+ {
+ if( !haskey( tg, "/dev/nfs" ) )
+ tg["/dev/nfs"] = $[ "type" : `CT_NFS, "partitions" : [] ];
+ list<map> pl = tg["/dev/nfs","partitions"]:[];
+ if( edit )
+ {
+ integer idx = 0;
+ foreach( map p, pl,
+ ``{
+ if( p["device"]:"" == part["device"]:"" )
+ pl[idx] = part;
+ idx = idx + 1;
+ });
+ }
+ else
+ pl = add( pl, part );
+ tg["/dev/nfs","partitions"] = pl;
+ Storage::SetTargetMap( tg );
+ }
+ y2milestone( "NfsSetup ret = %1", ret );
+ return ret;
+ }
+
+}
Modified: trunk/storage/storage/src/inst_custom_part.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_custom_part.ycp?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/storage/src/inst_custom_part.ycp (original)
+++ trunk/storage/storage/src/inst_custom_part.ycp Thu Jul 26 14:33:41 2007
@@ -54,6 +54,7 @@
include "partitioning/partition_defines.ycp";
include "partitioning/loop.ycp";
+ include "partitioning/nfs.ycp";
include "partitioning/lvm_ui_dialogs.ycp";
include "partitioning/lvm_pv_lib.ycp";
include "partitioning/raid_lib.ycp";
@@ -93,6 +94,7 @@
boolean button_reread = true; // Should the "Reread Partition"-Button be shown in Expert menu
boolean button_raid = true; // Should the "RAID" -Button be shown in main window
boolean button_loop = true; // Should the "LOOP" -Button be shown in main window
+ boolean button_nfs = true; // Should the "NFS" -Button be shown in main window
boolean button_lvm = true; // Should the "LVM" -Button be shown in main window
// Should the "EVMS" -Button be shown in main window
boolean button_evms = ProductFeatures::GetBooleanFeature ("partitioning", "evms_config");
@@ -934,13 +936,13 @@
// order should be md, then loop, then LVM, then EVMS
map disk_order = $[ `CT_DMRAID : 0, `CT_DISK : 1, `CT_MD : 2, `CT_LOOP : 3,
- `CT_LVM : 4, `CT_EVMS : 5, `CT_DM : 6 ];
+ `CT_LVM : 4, `CT_EVMS : 5, `CT_DM : 6, `CT_NFS : 7 ];
list<string> keys = maplist( string dev, map disk, targets,
``{return(dev);} );
keys = sort( string a, string b, keys,
``{
- integer oa = disk_order[targets[a,"type"]:`CT_UNKNOWN]:6;
- integer ob = disk_order[targets[b,"type"]:`CT_UNKNOWN]:6;
+ integer oa = disk_order[targets[a,"type"]:`CT_UNKNOWN]:8;
+ integer ob = disk_order[targets[b,"type"]:`CT_UNKNOWN]:8;
return( (oa==ob) ? (ahttp://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/FileSystems.ycp?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/FileSystems.ycp (original)
+++ trunk/storage/storage/src/modules/FileSystems.ycp Thu Jul 26 14:33:41 2007
@@ -39,6 +39,7 @@
LibStorage::HFS() : `hfs,
LibStorage::NTFS() : `ntfs,
LibStorage::SWAP() : `swap,
+ LibStorage::NFS() : `nfs,
LibStorage::FSNONE() : `none
]
];
Modified: trunk/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=39709&r1=39708&r2=39709&view=diff
==============================================================================
--- trunk/storage/storage/src/modules/Storage.ycp (original)
+++ trunk/storage/storage/src/modules/Storage.ycp Thu Jul 26 14:33:41 2007
@@ -432,7 +432,7 @@
});
}
}
- else
+ else if( search( device, "/" )==0 )
{
if( search( device, "/dev/hd" )==0 ||
search( device, "/dev/sd" )==0 ||
@@ -536,6 +536,10 @@
}
ret = [ tmp ];
}
+ else
+ {
+ ret = [ $[ "disk" : "/dev/nfs", "nr" : device ]];
+ }
if( size(ret)>1 )
{
list<map> a = filter( map m, ret, ``(search(m["disk"]:"","/dev/evms")!=0));
@@ -2875,6 +2879,33 @@
return( ret==0 );
}
+global boolean AddNfsVolume( string nfsdev, integer sz, string mp )
+ {
+ y2milestone( "AddNfsVolume dev:%1 size:%2 mp:%3", nfsdev, sz, mp );
+ integer ret = 0;
+ string dummy = "";
+ ret = LibStorage::StorageInterface::addNfsDevice( sint, nfsdev, sz, mp );
+ if( ret<0 )
+ y2error( "AddNfsVolume sint ret:%1", ret );
+ UpdateTargetMapDisk( "/dev/nfs" );
+ return( ret==0 );
+ }
+
+global integer CheckNfsVolume( string nfsdev )
+ {
+ y2milestone( "CheckNfsVolume dev:%1", nfsdev );
+ integer ret = 0;
+ integer sz = 0;
+ string dummy = "";
+ ret = LibStorage::StorageInterface::checkNfsDevice( sint, nfsdev, sz );
+ if( ret<0 )
+ y2error( "CheckNfsVolume sint ret:%1", ret );
+ else
+ ret = sz;
+ y2milestone( "CheckNfsVolume ret:%1", ret );
+ return( ret );
+ }
+
global boolean CreateMd( integer nr, string type )
{
y2milestone( "CreateMd nr:%1 type:%2", nr, type );
@@ -3184,6 +3215,11 @@
p["stripesize"]:0 );
}
}
+ else if( ctype == `CT_NFS )
+ {
+ ret = Storage::AddNfsVolume( p["device"]:"", p["size_k"]:0,
+ p["mount"]:"" );
+ }
y2milestone( "CreateAny ret:%1", ret );
return( ret );
}
@@ -3474,7 +3510,6 @@
});
}
});
- tg = GetTargetMap();
keys = maplist( string k, any e, tg, ``(k));
keys = sort( string a, string b, keys,
``( type_order[tg[a,"type"]:`CT_UNKNOWN]:6 >
@@ -3904,10 +3939,16 @@
``{
string ret = disk;
map tg = GetTargetMap();
- list<map> ps = filter( map p, tg[disk,"partitions"]:[], ``(p["nr"]:0b["nr"]:0));
- if( size(ps)>0 )
- ret = ps[0,"device"]:"";
+ if( haskey( tg[disk,"partitions",0]:$[], "nr" ))
+ {
+ list<map> ps = filter( map p, tg[disk,"partitions"]:[], ``(p["nr"]:01 )
+ ps = sort( map a, map b, ps, ``(a["nr"]:0>b["nr"]:0));
+ if( size(ps)>0 )
+ ret = ps[0,"device"]:"";
+ }
+ else
+ ret = tg[disk,"partitions",0,"device"]:disk;
y2milestone( "GetIdSmaller disk:%1 delim:%2 ret:%3",
disk, delim, ret );
return( ret );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org