Author: fehr
Date: Mon Jan 14 15:47:42 2008
New Revision: 43581
URL: http://svn.opensuse.org/viewcvs/yast?rev=43581&view=rev
Log:
- backport NFS support for SLES10 SP2 (feature #300779)
- version 2.13.96
Added:
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.h
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/nfs.ycp
Modified:
branches/SuSE-SLE-10-SP1-Branch/storage/VERSION
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/bindings/ycp/LibStorage.i
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Makefile.am
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.cc
branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.h
branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_check_generated.ycp
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/inst_custom_part.ycp
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/FileSystems.ycp
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Partitions.ycp
branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/VERSION?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/VERSION (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/VERSION Mon Jan 14 15:47:42 2008
@@ -1 +1 @@
-2.13.95
+2.13.96
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/bindings/ycp/LibStorage.i
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/bindings/ycp/LibStorage.i?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/bindings/ycp/LibStorage.i (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/bindings/ycp/LibStorage.i Mon Jan 14 15:47:42 2008
@@ -26,6 +26,7 @@
specialize_sequence(storage::MdInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::LoopInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::DmInfo, TO_PACK, FROM_PACK, CHECK)
+specialize_sequence(storage::NfsInfo, TO_PACK, FROM_PACK, CHECK)
%include "../../src/StorageInterface.h"
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.cc Mon Jan 14 15:47:42 2008
@@ -389,9 +389,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: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/AppUtil.h Mon Jan 14 15:47:42 2008
@@ -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: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.cc Mon Jan 14 15:47:42 2008
@@ -314,9 +314,15 @@
}
}
-string
+void
Container::logDifference( const Container& c ) const
{
+ y2milestone( "%s", getDiffString(c).c_str() );
+ }
+
+string
+Container::getDiffString( const Container& c ) const
+ {
string ret = "Name:" + nm;
if( nm!=c.nm )
ret += "-->"+c.nm;
@@ -375,46 +381,15 @@
if( !ret )
{
if( verbose )
- y2milestone( "%s", logDifference( *c ).c_str() );
+ y2milestone( "%s", getDiffString( *c ).c_str() );
}
else
{
- switch( typ )
- {
- case DISK:
- ret = ((const Disk*)this)->equalContent( *(const Disk*)c );
- if( !ret && verbose )
- ((const Disk*)this)->logDifference( *(const Disk*)c );
- break;
- case MD:
- ret = ((const MdCo*)this)->equalContent( *(const MdCo*)c );
- if( !ret && verbose )
- ((const MdCo*)this)->logDifference( *(const MdCo*)c );
- break;
- case LOOP:
- ret = ((const LoopCo*)this)->equalContent( *(const LoopCo*)c );
- if( !ret && verbose )
- ((const LoopCo*)this)->logDifference( *(const LoopCo*)c );
- break;
- case LVM:
- ret = ((const LvmVg*)this)->equalContent( *(const LvmVg*)c );
- if( !ret && verbose )
- ((const LvmVg*)this)->logDifference( *(const LvmVg*)c );
- break;
- case DM:
- ret = ((const DmCo*)this)->equalContent( *(const DmCo*)c );
- if( !ret && verbose )
- ((const DmCo*)this)->logDifference( *(const DmCo*)c );
- break;
- case EVMS:
- ret = ((const EvmsCo*)this)->equalContent( *(const EvmsCo*)c );
- if( !ret && verbose )
- ((const EvmsCo*)this)->logDifference( *(const EvmsCo*)c );
- break;
- default:
- ret = this->equalContent( *c );
- break;
- }
+ ret = equalContent( *c );
+ if( !ret && verbose )
+ logDifference( *c );
+ if( typ==COTYPE_LAST_ENTRY || typ==CUNKNOWN )
+ y2err( "Unknown Container:" << *c );
}
return( ret );
}
@@ -440,5 +415,6 @@
*this = rhs;
}
-string Container::type_names[] = { "UNKNOWN", "DISK", "MD", "LOOP", "LVM", "DM", "EVMS" };
+string Container::type_names[] = { "UNKNOWN", "DISK", "MD", "LOOP", "LVM",
+ "DM", "EVMS", "NFS" };
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Container.h Mon Jan 14 15:47:42 2008
@@ -43,8 +43,9 @@
{ return( !(*this ( const Container& rhs ) const
{ return( !(*this<=rhs) ); }
- bool equalContent( const Container& rhs ) const;
- string logDifference( const Container& c ) const;
+ virtual bool equalContent( const Container& rhs ) const;
+ virtual string getDiffString( const Container& c ) const;
+ virtual void logDifference( const Container& c ) const;
virtual void getCommitActions( std::liststorage::commitAction*& l ) const;
virtual int getToCommit( storage::CommitStage stage,
@@ -131,7 +132,7 @@
public:
Container( Storage * const, const string& Name, storage::CType typ );
Container( const Container& );
- Storage * const getStorage() const { return sto; }
+ Storage * getStorage() const { return sto; }
virtual ~Container();
const string& name() const { return nm; }
const string& device() const { return dev; }
@@ -153,7 +154,7 @@
virtual string createText(bool doing=true) const;
virtual int resizeVolume( Volume* v, unsigned long long newSize );
virtual int removeVolume( Volume* v );
- static storage::CType const staticType() { return storage::CUNKNOWN; }
+ static storage::CType staticType() { return storage::CUNKNOWN; }
friend std::ostream& operator<< (std::ostream& s, const Container &c );
virtual Container* getCopy() const { return( new Container( *this ) ); }
bool compareContainer( const Container* c, bool verbose ) const;
@@ -183,8 +184,8 @@
static bool stageCreate( const Volume& v )
{ return( v.created()||v.needExtend()); }
- static string type_names[EVMS+1];
- static unsigned order[EVMS+1];
+ static string type_names[COTYPE_LAST_ENTRY];
+ static unsigned order[COTYPE_LAST_ENTRY];
Storage * const sto;
storage::CType typ;
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.cc Mon Jan 14 15:47:42 2008
@@ -2496,108 +2496,119 @@
}
-void Disk::logDifference( const Disk& d ) const
+
+void Disk::logDifference( const Container& d ) const
{
- string log = Container::logDifference( d );
- if( cyl!=d.cyl )
- log += " Cyl:" + decString(cyl) + "-->" + decString(d.cyl);
- if( head!=d.head )
- log += " Head:" + decString(head) + "-->" + decString(d.head);
- if( sector!=d.sector )
- log += " Sect:" + decString(sector) + "-->" + decString(d.sector);
- if( mjr!=d.mjr )
- log += " Mjr:" + decString(mjr) + "-->" + decString(d.mjr);
- if( mnr!=d.mnr )
- log += " Mnr:" + decString(mnr) + "-->" + decString(d.mnr);
- if( range!=d.range )
- log += " Range:" + decString(range) + "-->" + decString(d.range);
- if( size_k!=d.size_k )
- log += " SizeK:" + decString(size_k) + "-->" + decString(d.size_k);
- if( label!=d.label )
- log += " Label:" + label + "-->" + d.label;
- if( sysfs_dir!=d.sysfs_dir )
- log += " SysfsDir:" + sysfs_dir + "-->" + d.sysfs_dir;
- if( max_primary!=d.max_primary )
- log += " MaxPrimary:" + decString(max_primary) + "-->" + decString(d.max_primary);
- if( ext_possible!=d.ext_possible )
- {
- if( d.ext_possible )
- log += " -->ExtPossible";
- else
- log += " ExtPossible-->";
- }
- if( max_logical!=d.max_logical )
- log += " MaxLogical:" + decString(max_logical) + "-->" + decString(d.max_logical);
- if( init_disk!=d.init_disk )
- {
- if( d.init_disk )
- log += " -->InitDisk";
- else
- log += " InitDisk-->";
- }
- if( iscsi!=d.iscsi )
- {
- if( d.init_disk )
- log += " -->iSCSI";
- else
- log += " iSCSI-->";
- }
- y2milestone( "%s", log.c_str() );
- ConstPartPair p=partPair();
- ConstPartIter i=p.begin();
- while( i!=p.end() )
- {
- ConstPartPair pc=d.partPair();
- ConstPartIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j!=pc.end() )
+ string log = getDiffString( d );
+ const Disk * p = dynamic_cast(&d);
+ if( p != NULL )
+ {
+ if( cyl!=p->cyl )
+ log += " Cyl:" + decString(cyl) + "-->" + decString(p->cyl);
+ if( head!=p->head )
+ log += " Head:" + decString(head) + "-->" + decString(p->head);
+ if( sector!=p->sector )
+ log += " Sect:" + decString(sector) + "-->" + decString(p->sector);
+ if( mjr!=p->mjr )
+ log += " Mjr:" + decString(mjr) + "-->" + decString(p->mjr);
+ if( mnr!=p->mnr )
+ log += " Mnr:" + decString(mnr) + "-->" + decString(p->mnr);
+ if( range!=p->range )
+ log += " Range:" + decString(range) + "-->" + decString(p->range);
+ if( size_k!=p->size_k )
+ log += " SizeK:" + decString(size_k) + "-->" + decString(p->size_k);
+ if( label!=p->label )
+ log += " Label:" + label + "-->" + p->label;
+ if( sysfs_dir!=p->sysfs_dir )
+ log += " SysfsDir:" + sysfs_dir + "-->" + p->sysfs_dir;
+ if( max_primary!=p->max_primary )
+ log += " MaxPrimary:" + decString(max_primary) + "-->" + decString(p->max_primary);
+ if( ext_possible!=p->ext_possible )
{
- if( !i->equalContent( *j ) )
- i->logDifference( *j );
+ if( p->ext_possible )
+ log += " -->ExtPossible";
+ else
+ log += " ExtPossible-->";
+ }
+ if( max_logical!=p->max_logical )
+ log += " MaxLogical:" + decString(max_logical) + "-->" + decString(p->max_logical);
+ if( init_disk!=p->init_disk )
+ {
+ if( p->init_disk )
+ log += " -->InitDisk";
+ else
+ log += " InitDisk-->";
+ }
+ if( iscsi!=p->iscsi )
+ {
+ if( p->iscsi )
+ log += " -->iSCSI";
+ else
+ log += " iSCSI-->";
+ }
+ y2milestone( "%s", log.c_str() );
+ ConstPartPair pp=partPair();
+ ConstPartIter i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstPartPair pc=p->partPair();
+ ConstPartIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->partPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstPartPair pc=partPair();
+ ConstPartIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
}
- else
- y2mil( " -->" << *i );
- ++i;
- }
- p=d.partPair();
- i=p.begin();
- while( i!=p.end() )
- {
- ConstPartPair pc=partPair();
- ConstPartIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j==pc.end() )
- y2mil( " <--" << *i );
- ++i;
}
+ else
+ y2mil( "" << log );
}
-bool Disk::equalContent( const Disk& rhs ) const
+bool Disk::equalContent( const Container& rhs ) const
{
- bool ret = Container::equalContent(rhs) &&
- cyl==rhs.cyl && head==rhs.head && sector==rhs.sector &&
- mjr==rhs.mjr && mnr==rhs.mnr && range==rhs.range &&
- size_k==rhs.size_k && max_primary==rhs.max_primary &&
- ext_possible==rhs.ext_possible && max_logical==rhs.max_logical &&
- init_disk==rhs.init_disk && label==rhs.label && iscsi==rhs.iscsi &&
- sysfs_dir==rhs.sysfs_dir;
+ const Disk * p = NULL;
+ bool ret = Container::equalContent(rhs);
if( ret )
- {
- ConstPartPair p = partPair();
- ConstPartPair pc = rhs.partPair();
- ConstPartIter i = p.begin();
+ p = dynamic_cast(&rhs);
+ if( ret && p )
+ ret = cyl==p->cyl && head==p->head && sector==p->sector &&
+ mjr==p->mjr && mnr==p->mnr && range==p->range &&
+ size_k==p->size_k && max_primary==p->max_primary &&
+ ext_possible==p->ext_possible && max_logical==p->max_logical &&
+ init_disk==p->init_disk && label==p->label &&
+ iscsi==p->iscsi && sysfs_dir==p->sysfs_dir;
+ if( ret && p )
+ {
+ ConstPartPair pp = partPair();
+ ConstPartPair pc = p->partPair();
+ ConstPartIter i = pp.begin();
ConstPartIter j = pc.begin();
- while( ret && i!=p.end() && j!=pc.end() )
+ while( ret && i!=pp.end() && j!=pc.end() )
{
ret = ret && i->equalContent( *j );
++i;
++j;
}
- ret = ret && i==p.end() && j==pc.end();
+ ret = ret && i==pp.end() && j==pc.end();
}
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Disk.h Mon Jan 14 15:47:42 2008
@@ -52,7 +52,7 @@
unsigned numPartitions() const;
bool isDasd() const { return( nm.find("dasd")==0 ); }
bool isLogical( unsigned nr ) const;
- static storage::CType const staticType() { return storage::DISK; }
+ static storage::CType staticType() { return storage::DISK; }
friend std::ostream& operator<< (std::ostream&, const Disk& );
void triggerUdevUpdate();
@@ -93,8 +93,8 @@
unsigned long kbToCylinder( unsigned long long ) const;
string getPartName( unsigned nr ) const;
void getInfo( storage::DiskInfo& info ) const;
- bool equalContent( const Disk& rhs ) const;
- void logDifference( const Disk& d ) const;
+ bool equalContent( const Container& rhs ) const;
+ void logDifference( const Container& d ) const;
Disk& operator= ( const Disk& rhs );
bool FakeDisk() const { return(range==1); }
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.cc Mon Jan 14 15:47:42 2008
@@ -305,7 +305,7 @@
num = mnr;
}
-const PeContainer* const Dm::pec() const
+const PeContainer* Dm::pec() const
{
return(dynamic_cast(cont));
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Dm.h Mon Jan 14 15:47:42 2008
@@ -62,7 +62,7 @@
protected:
void init();
- const PeContainer* const pec() const;
+ const PeContainer* pec() const;
virtual const string shortPrintedName() const { return( "Dm" ); }
string getDevice( const string& majmin );
static void getDmMajor();
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.cc Mon Jan 14 15:47:42 2008
@@ -292,59 +292,65 @@
}
-void DmCo::logDifference( const DmCo& d ) const
+void DmCo::logDifference( const Container& d ) const
{
- string log = Container::logDifference( d );
- y2milestone( "%s", log.c_str() );
- ConstDmPair p=dmPair();
- ConstDmIter i=p.begin();
- while( i!=p.end() )
+ y2mil( "" << getDiffString( d ));
+ const DmCo * p = dynamic_cast(&d);
+ if( p != NULL )
{
- ConstDmPair pc=d.dmPair();
- ConstDmIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j!=pc.end() )
+ ConstDmPair pp=dmPair();
+ ConstDmIter i=pp.begin();
+ while( i!=pp.end() )
{
- if( !i->equalContent( *j ) )
- i->logDifference( *j );
+ ConstDmPair pc=p->dmPair();
+ ConstDmIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->dmPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstDmPair pc=dmPair();
+ ConstDmIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
}
- else
- y2mil( " -->" << *i );
- ++i;
- }
- p=d.dmPair();
- i=p.begin();
- while( i!=p.end() )
- {
- ConstDmPair pc=dmPair();
- ConstDmIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j==pc.end() )
- y2mil( " <--" << *i );
- ++i;
}
}
-bool DmCo::equalContent( const DmCo& rhs ) const
+bool DmCo::equalContent( const Container& rhs ) const
{
+ const DmCo * p = NULL;
bool ret = Container::equalContent(rhs);
if( ret )
+ p = dynamic_cast(&rhs);
+ if( ret && p )
{
- ConstDmPair p = dmPair();
- ConstDmPair pc = rhs.dmPair();
- ConstDmIter i = p.begin();
+ ConstDmPair pp = dmPair();
+ ConstDmPair pc = p->dmPair();
+ ConstDmIter i = pp.begin();
ConstDmIter j = pc.begin();
- while( ret && i!=p.end() && j!=pc.end() )
+ while( ret && i!=pp.end() && j!=pc.end() )
{
ret = ret && i->equalContent( *j );
++i;
++j;
}
- ret = ret && i==p.end() && j==pc.end();
+ ret = ret && i==pp.end() && j==pc.end();
}
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/DmCo.h Mon Jan 14 15:47:42 2008
@@ -16,10 +16,10 @@
DmCo( Storage * const s, bool detect, ProcPart& ppart );
DmCo( const DmCo& rhs );
virtual ~DmCo();
- static storage::CType const staticType() { return storage::DM; }
+ static storage::CType staticType() { return storage::DM; }
friend std::ostream& operator<< (std::ostream&, const DmCo& );
- bool equalContent( const DmCo& rhs ) const;
- void logDifference( const DmCo& d ) const;
+ bool equalContent( const Container& rhs ) const;
+ void logDifference( const Container& d ) const;
void updateDmMaps();
int removeDm( const string& table );
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.cc Mon Jan 14 15:47:42 2008
@@ -86,7 +86,7 @@
}
}
-const EvmsCo* const Evms::evmsCo() const
+const EvmsCo* Evms::evmsCo() const
{
return(dynamic_cast(cont));
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Evms.h Mon Jan 14 15:47:42 2008
@@ -28,7 +28,7 @@
void getInfo(storage::EvmsInfo&) const;
bool equalContent( const Evms& rhs ) const;
void logDifference( const Evms& d ) const;
- const EvmsCo* const evmsCo() const;
+ const EvmsCo* evmsCo() const;
protected:
void init( const string& name );
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.cc Mon Jan 14 15:47:42 2008
@@ -576,8 +576,8 @@
int EvmsAccess::pluginFilterFunction( const char* plugin )
{
- static char *ExcludeList[] = { "/ext2-", "/reiser-", "/jfs-", "/xfs-",
- "/swap-", "/ocfs2-", "/ntfs-", "/hb2-" };
+ static const char *ExcludeList[] = { "/ext2-", "/reiser-", "/jfs-", "/xfs-",
+ "/swap-", "/ocfs2-", "/ntfs-", "/hb2-" };
int ret = 0;
unsigned i = 0;
while( !ret && i::const_iterator Ptr_Ci = objects.begin();
@@ -1111,7 +1111,7 @@
else
{
option->count = count;
- option->option[0].name = "name";
+ option->option[0].name = (char *)"name";
option->option[0].is_number_based = false;
option->option[0].type = EVMS_Type_String;
option->option[0].flags = 0;
@@ -1120,13 +1120,13 @@
option->option[1].flags = 0;
if( NewMeta_bv )
{
- option->option[1].name = "extent_size";
+ option->option[1].name = (char *)"extent_size";
option->option[1].type = EVMS_Type_Unsigned_Int64;
option->option[1].value.i64 = PeSizeK_lv*2;
}
else
{
- option->option[1].name = "pe_size";
+ option->option[1].name = (char *)"pe_size";
option->option[1].type = EVMS_Type_Unsigned_Int32;
option->option[1].value.i32 = PeSizeK_lv*2;
}
@@ -1247,12 +1247,12 @@
else
{
option->count = count;
- option->option[0].name = "name";
+ option->option[0].name = (char *)"name";
option->option[0].is_number_based = false;
option->option[0].type = EVMS_Type_String;
option->option[0].flags = 0;
option->option[0].value.s = (char*)LvName_Cv.c_str();
- option->option[1].name = "size";
+ option->option[1].name = (char *)"size";
option->option[1].is_number_based = false;
option->option[1].flags = 0;
if( lvm2 )
@@ -1267,7 +1267,7 @@
}
if( Stripe_lv>1 )
{
- option->option[2].name = "stripes";
+ option->option[2].name = (char *)"stripes";
option->option[2].is_number_based = false;
option->option[2].flags = 0;
if( lvm2 )
@@ -1282,7 +1282,7 @@
}
if( StripeSizeK_lv )
{
- option->option[3].name = "stripe_size";
+ option->option[3].name = (char *)"stripe_size";
option->option[3].is_number_based = false;
option->option[3].flags = 0;
if( lvm2 )
@@ -1762,13 +1762,13 @@
option.option[0].flags = 0;
if( !lvm2 )
{
- option.option[0].name = "add_size";
+ option.option[0].name = (char *)"add_size";
option.option[0].type = EVMS_Type_Unsigned_Int32;
option.option[0].value.i32 = (SizeK_lv-Rg_p->sizeK())*2;
}
else
{
- option.option[0].name = "size";
+ option.option[0].name = (char *)"size";
option.option[0].type = EVMS_Type_Unsigned_Int64;
option.option[0].value.i64 = (SizeK_lv-Rg_p->sizeK())*2;
}
@@ -1788,13 +1788,13 @@
option.option[0].is_number_based = false;
if( !lvm2 )
{
- option.option[0].name = "remove_size";
+ option.option[0].name = (char *)"remove_size";
option.option[0].type = EVMS_Type_Unsigned_Int32;
option.option[0].value.i32 = (Rg_p->sizeK()-SizeK_lv)*2;
}
else
{
- option.option[0].name = "size";
+ option.option[0].name = (char *)"size";
option.option[0].type = EVMS_Type_Unsigned_Int64;
option.option[0].value.i64 = (Rg_p->sizeK()-SizeK_lv)*2;
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsAccess.h Mon Jan 14 15:47:42 2008
@@ -33,7 +33,7 @@
ObjType type() const { return typ; };
const string& name() const { return nam; };
- const object_handle_t id() const { return idt; };
+ object_handle_t id() const { return idt; };
void disownPtr() { own_ptr = false; };
void output( std::ostream& Stream ) const;
@@ -61,8 +61,8 @@
public:
EvmsDataObject( EvmsObject *const obj );
EvmsDataObject( object_handle_t id );
- const EvmsObject *const consumedBy() const { return consumed; };
- const EvmsObject *const volume() const { return vol; };
+ const EvmsObject * consumedBy() const { return consumed; };
+ const EvmsObject * volume() const { return vol; };
void output( std::ostream& Stream ) const;
virtual void addRelation( EvmsAccess* Acc );
@@ -141,8 +141,8 @@
class EvmsAccess
{
public:
- EvmsObject *const addObject( object_handle_t id );
- EvmsObject *const find( object_handle_t id );
+ EvmsObject * addObject( object_handle_t id );
+ EvmsObject * find( object_handle_t id );
EvmsAccess();
~EvmsAccess();
void output( std::ostream &Stream ) const;
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.cc Mon Jan 14 15:47:42 2008
@@ -1872,76 +1872,89 @@
}
-void EvmsCo::logDifference( const EvmsCo& d ) const
+void EvmsCo::logDifference( const Container& d ) const
{
- string log = PeContainer::logDifference( d );
- if( lvm1!=d.lvm1 )
+ const EvmsCo * p = dynamic_cast(&d);
+ if( p )
{
- if( d.lvm1 )
- log += " -->lvm1";
- else
- log += " lvm1-->";
- }
- if( container!=d.container )
- {
- if( d.container )
- log += " -->cont";
- else
- log += " cont-->";
- }
- if( uuid!=d.uuid )
- log += " UUID:" + uuid + "-->" + d.uuid;
- y2milestone( "%s", log.c_str() );
- ConstEvmsPair p=evmsPair();
- ConstEvmsIter i=p.begin();
- while( i!=p.end() )
- {
- ConstEvmsPair pc=d.evmsPair();
- ConstEvmsIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j!=pc.end() )
+ string log = PeContainer::getDiffString( *p );
+ if( lvm1!=p->lvm1 )
{
- if( !i->equalContent( *j ) )
- i->logDifference( *j );
+ if( p->lvm1 )
+ log += " -->lvm1";
+ else
+ log += " lvm1-->";
+ }
+ if( container!=p->container )
+ {
+ if( p->container )
+ log += " -->cont";
+ else
+ log += " cont-->";
+ }
+ if( uuid!=p->uuid )
+ log += " UUID:" + uuid + "-->" + p->uuid;
+ y2milestone( "%s", log.c_str() );
+ ConstEvmsPair pp=evmsPair();
+ ConstEvmsIter i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstEvmsPair pc=p->evmsPair();
+ ConstEvmsIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->evmsPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstEvmsPair pc=evmsPair();
+ ConstEvmsIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
}
- else
- y2mil( " -->" << *i );
- ++i;
- }
- p=d.evmsPair();
- i=p.begin();
- while( i!=p.end() )
- {
- ConstEvmsPair pc=evmsPair();
- ConstEvmsIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j==pc.end() )
- y2mil( " <--" << *i );
- ++i;
}
+ else
+ y2mil( "" << Container::getDiffString(d) );
}
-bool EvmsCo::equalContent( const EvmsCo& rhs ) const
+bool EvmsCo::equalContent( const Container& rhs ) const
{
- bool ret = PeContainer::equalContent(rhs,false) &&
- uuid==rhs.uuid && lvm1==rhs.lvm1 && container==rhs.container;
+ const EvmsCo * p = NULL;
+ bool ret = Container::equalContent(rhs);
if( ret )
+ p = dynamic_cast(&rhs);
+ if( ret && p )
+ {
+ ret = PeContainer::equalContent(*p,false) &&
+ uuid==p->uuid && lvm1==p->lvm1 && container==p->container;
+ }
+ if( ret && p )
{
- ConstEvmsPair p = evmsPair();
- ConstEvmsPair pc = rhs.evmsPair();
- ConstEvmsIter i = p.begin();
+ ConstEvmsPair pp = evmsPair();
+ ConstEvmsPair pc = p->evmsPair();
+ ConstEvmsIter i = pp.begin();
ConstEvmsIter j = pc.begin();
- while( ret && i!=p.end() && j!=pc.end() )
+ while( ret && i!=pp.end() && j!=pc.end() )
{
ret = ret && i->equalContent( *j );
++i;
++j;
}
- ret = ret && i==p.end() && j==pc.end();
+ ret = ret && i==pp.end() && j==pc.end();
}
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/EvmsCo.h Mon Jan 14 15:47:42 2008
@@ -92,7 +92,7 @@
unsigned numVol() const { return vols.size(); }
bool lvm2() const { return( !lvm1 ); }
bool isContainer() const { return( container ); }
- static storage::CType const staticType() { return storage::EVMS; }
+ static storage::CType staticType() { return storage::EVMS; }
friend std::ostream& operator<< (std::ostream&, const EvmsCo& );
int removeCo();
@@ -119,8 +119,8 @@
int removeVolume( Volume* v );
void addVolume( Evms* v );
void getInfo( storage::EvmsCoInfo& info ) const;
- bool equalContent( const EvmsCo& rhs ) const;
- void logDifference( const EvmsCo& d ) const;
+ bool equalContent( const Container& rhs ) const;
+ void logDifference( const Container& d ) const;
bool checkConsistency() const;
void updateMd();
void changeDeviceName( const string& old, const string& nw );
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.cc Mon Jan 14 15:47:42 2008
@@ -345,59 +345,65 @@
}
-void LoopCo::logDifference( const LoopCo& d ) const
+void LoopCo::logDifference( const Container& d ) const
{
- string log = Container::logDifference( d );
- y2milestone( "%s", log.c_str() );
- ConstLoopPair p=loopPair();
- ConstLoopIter i=p.begin();
- while( i!=p.end() )
+ y2mil( "" << getDiffString( d ));
+ const LoopCo * p = dynamic_cast(&d);
+ if( p != NULL )
{
- ConstLoopPair pc=d.loopPair();
- ConstLoopIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j!=pc.end() )
+ ConstLoopPair pp=loopPair();
+ ConstLoopIter i=pp.begin();
+ while( i!=pp.end() )
{
- if( !i->equalContent( *j ) )
- i->logDifference( *j );
+ ConstLoopPair pc=p->loopPair();
+ ConstLoopIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->loopPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstLoopPair pc=loopPair();
+ ConstLoopIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
}
- else
- y2mil( " -->" << *i );
- ++i;
- }
- p=d.loopPair();
- i=p.begin();
- while( i!=p.end() )
- {
- ConstLoopPair pc=loopPair();
- ConstLoopIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j==pc.end() )
- y2mil( " <--" << *i );
- ++i;
}
}
-bool LoopCo::equalContent( const LoopCo& rhs ) const
+bool LoopCo::equalContent( const Container& rhs ) const
{
+ const LoopCo * p = NULL;
bool ret = Container::equalContent(rhs);
if( ret )
+ p = dynamic_cast(&rhs);
+ if( ret && p )
{
- ConstLoopPair p = loopPair();
- ConstLoopPair pc = rhs.loopPair();
- ConstLoopIter i = p.begin();
+ ConstLoopPair pp = loopPair();
+ ConstLoopPair pc = p->loopPair();
+ ConstLoopIter i = pp.begin();
ConstLoopIter j = pc.begin();
- while( ret && i!=p.end() && j!=pc.end() )
+ while( ret && i!=pp.end() && j!=pc.end() )
{
ret = ret && i->equalContent( *j );
++i;
++j;
}
- ret = ret && i==p.end() && j==pc.end();
+ ret = ret && i==pp.end() && j==pc.end();
}
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LoopCo.h Mon Jan 14 15:47:42 2008
@@ -17,7 +17,7 @@
LoopCo( const LoopCo& rhs );
virtual ~LoopCo();
- static storage::CType const staticType() { return storage::LOOP; }
+ static storage::CType staticType() { return storage::LOOP; }
friend std::ostream& operator<< (std::ostream&, const LoopCo& );
int createLoop( const string& file, bool reuseExisting,
@@ -28,8 +28,8 @@
void loopIds( std::list<unsigned>& l ) const;
int removeVolume( Volume* v );
- bool equalContent( const LoopCo& rhs ) const;
- void logDifference( const LoopCo& d ) const;
+ bool equalContent( const Container& rhs ) const;
+ void logDifference( const Container& d ) const;
protected:
// iterators over LOOP volumes
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.cc Mon Jan 14 15:47:42 2008
@@ -1436,72 +1436,83 @@
}
-void LvmVg::logDifference( const LvmVg& d ) const
+void LvmVg::logDifference( const Container& d ) const
{
- string log = PeContainer::logDifference( d );
- if( status!=d.status )
- log += " status:" + status + "-->" + d.status;
- if( lvm1!=d.lvm1 )
+ const LvmVg * p = dynamic_cast(&d);
+ if( p )
{
- if( d.lvm1 )
- log += " -->lvm1";
- else
- log += " lvm1-->";
- }
- if( uuid!=d.uuid )
- log += " UUID:" + uuid + "-->" + d.uuid;
- y2milestone( "%s", log.c_str() );
- ConstLvmLvPair p=lvmLvPair();
- ConstLvmLvIter i=p.begin();
- while( i!=p.end() )
- {
- ConstLvmLvPair pc=d.lvmLvPair();
- ConstLvmLvIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j!=pc.end() )
+ string log = PeContainer::getDiffString( *p );
+ if( status!=p->status )
+ log += " status:" + status + "-->" + p->status;
+ if( lvm1!=p->lvm1 )
{
- if( !i->equalContent( *j ) )
- i->logDifference( *j );
+ if( p->lvm1 )
+ log += " -->lvm1";
+ else
+ log += " lvm1-->";
+ }
+ if( uuid!=p->uuid )
+ log += " UUID:" + uuid + "-->" + p->uuid;
+ y2milestone( "%s", log.c_str() );
+ ConstLvmLvPair pp=lvmLvPair();
+ ConstLvmLvIter i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstLvmLvPair pc=p->lvmLvPair();
+ ConstLvmLvIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->lvmLvPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstLvmLvPair pc=lvmLvPair();
+ ConstLvmLvIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
}
- else
- y2mil( " -->" << *i );
- ++i;
- }
- p=d.lvmLvPair();
- i=p.begin();
- while( i!=p.end() )
- {
- ConstLvmLvPair pc=lvmLvPair();
- ConstLvmLvIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j==pc.end() )
- y2mil( " <--" << *i );
- ++i;
}
+ else
+ y2mil( "" << Container::getDiffString(d) );
}
-bool LvmVg::equalContent( const LvmVg& rhs ) const
+bool LvmVg::equalContent( const Container& rhs ) const
{
- bool ret = PeContainer::equalContent(rhs,false) &&
- status==rhs.status && uuid==rhs.uuid && lvm1==rhs.lvm1 &&
- inactiv==rhs.inactiv && num_lv==rhs.num_lv;
+ const LvmVg * p = NULL;
+ bool ret = Container::equalContent(rhs);
if( ret )
+ p = dynamic_cast(&rhs);
+ if( ret && p )
+ ret = PeContainer::equalContent(*p,false) &&
+ status==p->status && uuid==p->uuid && lvm1==p->lvm1 &&
+ inactiv==p->inactiv && num_lv==p->num_lv;
+ if( ret && p )
{
- ConstLvmLvPair p = lvmLvPair();
- ConstLvmLvPair pc = rhs.lvmLvPair();
- ConstLvmLvIter i = p.begin();
+ ConstLvmLvPair pp = lvmLvPair();
+ ConstLvmLvPair pc = p->lvmLvPair();
+ ConstLvmLvIter i = pp.begin();
ConstLvmLvIter j = pc.begin();
- while( ret && i!=p.end() && j!=pc.end() )
+ while( ret && i!=pp.end() && j!=pc.end() )
{
ret = ret && i->equalContent( *j );
++i;
++j;
}
- ret = ret && i==p.end() && j==pc.end();
+ ret = ret && i==pp.end() && j==pc.end();
}
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/LvmVg.h Mon Jan 14 15:47:42 2008
@@ -19,7 +19,7 @@
unsigned numLv() const { return vols.size(); }
bool lvm2() const { return( !lvm1 ); }
bool inactive() const { return( inactiv ); }
- static storage::CType const staticType() { return storage::LVM; }
+ static storage::CType staticType() { return storage::LVM; }
friend std::ostream& operator<< (std::ostream&, const LvmVg& );
int removeVg();
@@ -43,8 +43,8 @@
int resizeVolume( Volume* v, unsigned long long newSize );
int removeVolume( Volume* v );
void getInfo( storage::LvmVgInfo& info ) const;
- bool equalContent( const LvmVg& rhs ) const;
- void logDifference( const LvmVg& rhs ) const;
+ bool equalContent( const Container& rhs ) const;
+ void logDifference( const Container& rhs ) const;
static void activate( bool val=true );
static void getVgs( std::list<string>& l );
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Makefile.am?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Makefile.am (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Makefile.am Mon Jan 14 15:47:42 2008
@@ -33,6 +33,7 @@
DmCo.cc DmCo.h \
MdCo.cc MdCo.h \
LoopCo.cc LoopCo.h \
+ NfsCo.cc NfsCo.h \
Volume.cc Volume.h \
Partition.cc Partition.h \
Dm.cc Dm.h \
@@ -40,6 +41,7 @@
Evms.cc Evms.h \
Md.cc Md.h \
Loop.cc Loop.h \
+ Nfs.cc Nfs.h \
SystemCmd.cc SystemCmd.h \
OutputProcessor.cc OutputProcessor.h \
Regex.cc Regex.h \
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.cc Mon Jan 14 15:47:42 2008
@@ -688,59 +688,65 @@
}
-void MdCo::logDifference( const MdCo& d ) const
+void MdCo::logDifference( const Container& d ) const
{
- string log = Container::logDifference( d );
- y2milestone( "%s", log.c_str() );
- ConstMdPair p=mdPair();
- ConstMdIter i=p.begin();
- while( i!=p.end() )
+ y2mil( "" << getDiffString( d ));
+ const MdCo * p = dynamic_cast(&d);
+ if( p != NULL )
{
- ConstMdPair pc=d.mdPair();
- ConstMdIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j!=pc.end() )
+ ConstMdPair pp=mdPair();
+ ConstMdIter i=pp.begin();
+ while( i!=pp.end() )
{
- if( !i->equalContent( *j ) )
- i->logDifference( *j );
+ ConstMdPair pc=p->mdPair();
+ ConstMdIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->mdPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstMdPair pc=mdPair();
+ ConstMdIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
}
- else
- y2mil( " -->" << *i );
- ++i;
- }
- p=d.mdPair();
- i=p.begin();
- while( i!=p.end() )
- {
- ConstMdPair pc=mdPair();
- ConstMdIter j = pc.begin();
- while( j!=pc.end() &&
- (i->device()!=j->device() || i->created()!=j->created()) )
- ++j;
- if( j==pc.end() )
- y2mil( " <--" << *i );
- ++i;
}
}
-bool MdCo::equalContent( const MdCo& rhs ) const
+bool MdCo::equalContent( const Container& rhs ) const
{
+ const MdCo * p = NULL;
bool ret = Container::equalContent(rhs);
if( ret )
+ p = dynamic_cast(&rhs);
+ if( ret && p )
{
- ConstMdPair p = mdPair();
- ConstMdPair pc = rhs.mdPair();
- ConstMdIter i = p.begin();
+ ConstMdPair pp = mdPair();
+ ConstMdPair pc = p->mdPair();
+ ConstMdIter i = pp.begin();
ConstMdIter j = pc.begin();
- while( ret && i!=p.end() && j!=pc.end() )
+ while( ret && i!=pp.end() && j!=pc.end() )
{
ret = ret && i->equalContent( *j );
++i;
++j;
}
- ret = ret && i==p.end() && j==pc.end();
+ ret = ret && i==pp.end() && j==pc.end();
}
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/MdCo.h Mon Jan 14 15:47:42 2008
@@ -18,7 +18,7 @@
MdCo( const MdCo& rhs );
virtual ~MdCo();
- static storage::CType const staticType() { return storage::MD; }
+ static storage::CType staticType() { return storage::MD; }
friend std::ostream& operator<< (std::ostream&, const MdCo& );
int createMd( unsigned num, storage::MdType type,
@@ -30,8 +30,8 @@
int changeMdChunk( unsigned num, unsigned long chunk );
int changeMdParity( unsigned num, storage::MdParity ptype );
int checkMd( unsigned num );
- bool equalContent( const MdCo& rhs ) const;
- void logDifference( const MdCo& d ) const;
+ bool equalContent( const Container& rhs ) const;
+ void logDifference( const Container& d ) const;
unsigned unusedNumber();
void syncRaidtab();
Added: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.cc?rev=43581&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.cc (added)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.cc Mon Jan 14 15:47:42 2008
@@ -0,0 +1,113 @@
+/*
+ Textdomain "storage"
+*/
+
+#include <sstream>
+
+#include
+
+#include "y2storage/Nfs.h"
+#include "y2storage/StorageTypes.h"
+#include "y2storage/Container.h"
+#include "y2storage/AppUtil.h"
+#include "y2storage/Storage.h"
+#include "y2storage/SystemCmd.h"
+
+using namespace storage;
+using namespace std;
+
+Nfs::Nfs( const NfsCo& d, const string& NfsDev ) :
+ Volume( d, 0, 0 )
+ {
+ y2debug( "constructed nfs dev:%s", NfsDev.c_str() );
+ if( d.type() != NFSC )
+ y2error( "constructed nfs with wrong container" );
+ dev = canonicalName(NfsDev);
+ if( dev != NfsDev )
+ alt_names.push_back( NfsDev );
+ init();
+ }
+
+Nfs::~Nfs()
+ {
+ 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);
+ }
+
+string Nfs::canonicalName( const string& d )
+ {
+ string dev(d);
+ string::size_type pos = 0;
+ while( (pos=dev.find("//",pos))!=string::npos )
+ dev.erase(pos,1);
+ if( !dev.empty() && *dev.rbegin()=='/' )
+ dev.erase(dev.size()-1);
+ if( dev!=d )
+ y2mil( "dev:" << dev << " d:" << d );
+ return(dev);
+ }
+
+void Nfs::getInfo( NfsInfo& tinfo ) const
+ {
+ ((Volume*)this)->getInfo( info.v );
+ tinfo = info;
+ }
+
+namespace storage
+{
+
+std::ostream& operator<< (std::ostream& s, const Nfs& l )
+ {
+ s << "Nfs " << *(Volume*)&l;
+ return( s );
+ }
+
+}
+
+bool Nfs::equalContent( const Nfs& rhs ) const
+ {
+ return( Volume::equalContent(rhs) );
+ }
+
+void Nfs::logDifference( const Nfs& rhs ) const
+ {
+ string log = Volume::logDifference( rhs );
+ y2milestone( "%s", log.c_str() );
+ }
+
+Nfs& Nfs::operator= ( const Nfs& rhs )
+ {
+ y2debug( "operator= from %s", rhs.nm.c_str() );
+ *((Volume*)this) = rhs;
+ return( *this );
+ }
+
+Nfs::Nfs( const NfsCo& d, const Nfs& rhs ) : Volume(d)
+ {
+ y2debug( "constructed nfs by copy constructor from %s", rhs.nm.c_str() );
+ *this = rhs;
+ }
+
Added: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.h?rev=43581&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.h (added)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Nfs.h Mon Jan 14 15:47:42 2008
@@ -0,0 +1,38 @@
+#ifndef NFS_H
+#define NFS_H
+
+#include "y2storage/Volume.h"
+
+namespace storage
+{
+class NfsCo;
+
+class Nfs : public Volume
+ {
+ public:
+ Nfs( const NfsCo& d, const string& NfsDev );
+ Nfs( const NfsCo& d, const Nfs& rhs );
+ virtual ~Nfs();
+ 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; }
+
+ void getInfo( storage::NfsInfo& info ) const;
+ 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& );
+
+ mutable storage::NfsInfo info;
+ };
+
+}
+
+#endif
Added: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.cc?rev=43581&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.cc (added)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.cc Mon Jan 14 15:47:42 2008
@@ -0,0 +1,297 @@
+/*
+ Textdomain "storage"
+*/
+
+#include <iostream>
+#include <sstream>
+
+#include "y2storage/NfsCo.h"
+#include "y2storage/Nfs.h"
+#include "y2storage/AppUtil.h"
+#include "y2storage/ProcMounts.h"
+#include "y2storage/Storage.h"
+#include "y2storage/EtcFstab.h"
+
+using namespace storage;
+using namespace std;
+
+NfsCo::NfsCo( Storage * const s, ProcMounts& mounts ) :
+ Container(s,"nfs",staticType())
+ {
+ y2debug( "constructing NfsCo detect" );
+ init();
+ getNfsData( mounts );
+ }
+
+NfsCo::NfsCo( Storage * const s ) :
+ Container(s,"nfs",staticType())
+ {
+ y2debug( "constructing NfsCo" );
+ init();
+ }
+
+NfsCo::NfsCo( Storage * const s, const string& file ) :
+ Container(s,"nfs",staticType())
+ {
+ y2debug( "constructing NfsCo file:%s", file.c_str() );
+ init();
+ }
+
+NfsCo::~NfsCo()
+ {
+ y2debug( "destructed NfsCo" );
+ }
+
+void
+NfsCo::init()
+ {
+ }
+
+bool NfsCo::isNfsDev( const string& dev )
+ {
+ bool ret = dev.find( ":/" )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->changeMount( mp );
+ n->setSize( sizeK );
+ addToList( n );
+ return( 0 );
+ }
+
+void
+NfsCo::getNfsData( ProcMounts& mounts )
+ {
+ y2mil( "begin fstab:" << getStorage()->getFstab() );
+ list<FstabEntry> l;
+ getStorage()->getFstab()->getEntries(l);
+ for( list<FstabEntry>::const_iterator i=l.begin(); i!=l.end(); ++i )
+ {
+ if( i->fs == "nfs" )
+ {
+ Nfs *n = new Nfs( *this, i->device );
+ n->setMount( i->mount );
+ string op = mergeString(i->opts, "," );
+ if( op != "defaults" )
+ n->setFstabOption( op );
+ addToList( n );
+ }
+ }
+ l.clear();
+ mounts.getEntries(l);
+ const char * ign_opt[] = { "hard", "rw", "v3", "v2", "lock" };
+ const char * ign_beg[] = { "proto=", "addr=", "vers=" };
+ for( list<FstabEntry>::iterator i=l.begin(); i!=l.end(); ++i )
+ {
+ if( i->fs == "nfs" )
+ {
+ Nfs *n = NULL;
+ NfsIter nfs;
+ if( findNfs( i->device, nfs ))
+ {
+ n = &(*nfs);
+ }
+ else
+ {
+ n = new Nfs( *this, i->device );
+ list<string>::iterator si = i->opts.begin();
+ unsigned pos = 0;
+ while( si!=i->opts.end() )
+ {
+ pos=0;
+ while( posopts.erase(si);
+ else
+ {
+ pos=0;
+ while( posfind(ign_beg[pos])!=0 )
+ ++pos;
+ if( posopts.erase(si);
+ else
+ ++si;
+ }
+ }
+ n->setIgnoreFstab();
+ n->setFstabOption( mergeString(i->opts, "," ) );
+ addToList( n );
+ }
+ unsigned long long sz = getStorage()->getDfSize( i->mount );
+ n->setSize( sz );
+ }
+ }
+ l.clear();
+ }
+
+bool
+NfsCo::findNfs( const string& dev, NfsIter& i )
+ {
+ NfsPair p=nfsPair();
+ i=p.begin();
+ while( i!=p.end() && i->device()!=dev )
+ ++i;
+ return( i!=p.end() );
+ }
+
+bool
+NfsCo::findNfs( const string& dev )
+ {
+ NfsIter i;
+ return( findNfs( dev, i ));
+ }
+
+
+void NfsCo::logData( const string& Dir ) {;}
+
+namespace storage
+{
+
+inline std::ostream& operator<< (std::ostream& s, const NfsCo& d )
+ {
+ s << *((Container*)&d);
+ return( s );
+ }
+
+}
+
+void NfsCo::logDifference( const Container& d ) const
+ {
+ y2mil( "" << Container::getDiffString( d ));
+ const NfsCo* p = dynamic_cast(&d);
+ if( p != NULL )
+ {
+ ConstNfsPair pp=nfsPair();
+ ConstNfsIter i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstNfsPair pc=p->nfsPair();
+ ConstNfsIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j!=pc.end() )
+ {
+ if( !i->equalContent( *j ) )
+ i->logDifference( *j );
+ }
+ else
+ y2mil( " -->" << *i );
+ ++i;
+ }
+ pp=p->nfsPair();
+ i=pp.begin();
+ while( i!=pp.end() )
+ {
+ ConstNfsPair pc=nfsPair();
+ ConstNfsIter j = pc.begin();
+ while( j!=pc.end() &&
+ (i->device()!=j->device() || i->created()!=j->created()) )
+ ++j;
+ if( j==pc.end() )
+ y2mil( " <--" << *i );
+ ++i;
+ }
+ }
+ }
+
+bool NfsCo::equalContent( const Container& rhs ) const
+ {
+ const NfsCo* p = NULL;
+ bool ret = Container::equalContent(rhs);
+ if( ret )
+ p = dynamic_cast(&rhs);
+ if( ret && p )
+ {
+ ConstNfsPair pp = nfsPair();
+ ConstNfsPair pc = p->nfsPair();
+ ConstNfsIter i = pp.begin();
+ ConstNfsIter j = pc.begin();
+ while( ret && i!=pp.end() && j!=pc.end() )
+ {
+ ret = ret && i->equalContent( *j );
+ ++i;
+ ++j;
+ }
+ ret = ret && i==pp.end() && j==pc.end();
+ }
+ return( ret );
+ }
+
+NfsCo::NfsCo( const NfsCo& rhs ) : Container(rhs)
+ {
+ y2debug( "constructed NfsCo by copy constructor from %s", rhs.nm.c_str() );
+ *this = rhs;
+ ConstNfsPair p = rhs.nfsPair();
+ for( ConstNfsIter i=p.begin(); i!=p.end(); ++i )
+ {
+ Nfs * p = new Nfs( *this, *i );
+ vols.push_back( p );
+ }
+ }
+
+
Added: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.h?rev=43581&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.h (added)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/NfsCo.h Mon Jan 14 15:47:42 2008
@@ -0,0 +1,95 @@
+#ifndef NFS_CO_H
+#define NFS_CO_H
+
+#include "y2storage/Container.h"
+#include "y2storage/Nfs.h"
+
+namespace storage
+{
+class NfsCo : public Container
+ {
+ friend class Storage;
+
+ public:
+ NfsCo( Storage * const s, ProcMounts& mounts );
+ NfsCo( Storage * const s );
+ NfsCo( const NfsCo& rhs );
+
+ virtual ~NfsCo();
+ static storage::CType staticType() { return storage::NFSC; }
+ friend std::ostream& operator<< ( std::ostream&, const NfsCo& );
+ int addNfs( const string& nfsDev, unsigned long long sizeK,
+ 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;
+
+ protected:
+ // iterators over NFS volumes
+ // protected typedefs for iterators over NFS volumes
+ typedef CastIterator NfsInter;
+ typedef CastIterator NfsCInter;
+ template< class Pred >
+ struct NfsPI { typedef ContainerIter type; };
+ template< class Pred >
+ struct NfsCPI { typedef ContainerIter type; };
+ typedef CheckFnc<const Nfs> CheckFncNfs;
+ typedef CheckerIterator< CheckFncNfs, NfsPI<CheckFncNfs>::type,
+ NfsInter, Nfs > NfsPIterator;
+ typedef CheckerIterator< CheckFncNfs, NfsCPI<CheckFncNfs>::type,
+ NfsCInter, const Nfs > NfsCPIterator;
+ typedef DerefIterator NfsIter;
+ typedef DerefIterator ConstNfsIter;
+ typedef IterPair<NfsIter> NfsPair;
+ typedef IterPair<ConstNfsIter> ConstNfsPair;
+
+ NfsPair nfsPair( bool (* Check)( const Nfs& )=NULL)
+ {
+ return( NfsPair( nfsBegin( Check ), nfsEnd( Check ) ));
+ }
+ NfsIter nfsBegin( bool (* Check)( const Nfs& )=NULL)
+ {
+ IterPair<NfsInter> p( (NfsInter(begin())), (NfsInter(end())) );
+ return( NfsIter( NfsPIterator( p, Check )) );
+ }
+ NfsIter nfsEnd( bool (* Check)( const Nfs& )=NULL)
+ {
+ IterPair<NfsInter> p( (NfsInter(begin())), (NfsInter(end())) );
+ return( NfsIter( NfsPIterator( p, Check, true )) );
+ }
+
+ ConstNfsPair nfsPair( bool (* Check)( const Nfs& )=NULL) const
+ {
+ return( ConstNfsPair( nfsBegin( Check ), nfsEnd( Check ) ));
+ }
+ ConstNfsIter nfsBegin( bool (* Check)( const Nfs& )=NULL) const
+ {
+ IterPair<NfsCInter> p( (NfsCInter(begin())), (NfsCInter(end())) );
+ return( ConstNfsIter( NfsCPIterator( p, Check )) );
+ }
+ ConstNfsIter nfsEnd( bool (* Check)( const Nfs& )=NULL) const
+ {
+ IterPair<NfsCInter> p( (NfsCInter(begin())), (NfsCInter(end())) );
+ return( ConstNfsIter( NfsCPIterator( p, Check, true )) );
+ }
+
+ NfsCo( Storage * const s, const string& File );
+
+ bool findNfs( const string& dev, NfsIter& i );
+ bool findNfs( const string& dev );
+ void getNfsData( ProcMounts& mounts );
+ void init();
+
+ virtual void print( std::ostream& s ) const { s << *this; }
+ virtual Container* getCopy() const { return( new NfsCo( *this ) ); }
+
+ void logData( const string& Dir );
+ };
+
+}
+
+#endif
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.cc Mon Jan 14 15:47:42 2008
@@ -283,7 +283,7 @@
return( txt );
}
-const Disk* const Partition::disk() const
+const Disk* Partition::disk() const
{
return(dynamic_cast(cont));
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Partition.h Mon Jan 14 15:47:42 2008
@@ -57,7 +57,7 @@
string setTypeText( bool doing=true ) const;
int setFormat( bool format=true, storage::FsType fs=storage::REISERFS );
int changeMount( const string& val );
- const Disk* const disk() const;
+ const Disk* disk() const;
bool isWindows() const;
friend std::ostream& operator<< (std::ostream& s, const Partition &p );
static bool notDeleted( const Partition&d ) { return( !d.deleted() ); }
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.cc Mon Jan 14 15:47:42 2008
@@ -617,74 +617,77 @@
}
-string PeContainer::logDifference( const PeContainer& rhs ) const
+string PeContainer::getDiffString( const Container& rhs ) const
{
- string ret = Container::logDifference( rhs );
- if( pe_size!=rhs.pe_size )
- ret += " PeSize:" + decString(pe_size) + "-->" + decString(rhs.pe_size);
- if( num_pe!=rhs.num_pe )
- ret += " PE:" + decString(num_pe) + "-->" + decString(rhs.num_pe);
- if( free_pe!=rhs.free_pe )
- ret += " Free:" + decString(free_pe) + "-->" + decString(rhs.free_pe);
- string tmp;
- list<Pv>::const_iterator i = pv.begin();
- list<Pv>::const_iterator j;
- while( i!=pv.end() )
- {
- j = find( rhs.pv.begin(), rhs.pv.end(), *i );
- if( j==rhs.pv.end() )
- tmp += i->device + "-->";
- ++i;
- }
- i = rhs.pv.begin();
- while( i!=rhs.pv.end() )
- {
- j = find( pv.begin(), pv.end(), *i );
- if( j==pv.end() )
- tmp += "<--" + i->device;
- ++i;
- }
- if( !tmp.empty() )
- ret += " Pv:" + tmp;
- tmp.erase();
- i = pv_add.begin();
- while( i!=pv_add.end() )
- {
- j = find( rhs.pv_add.begin(), rhs.pv_add.end(), *i );
- if( j==rhs.pv_add.end() )
- tmp += i->device + "-->";
- ++i;
- }
- i = rhs.pv_add.begin();
- while( i!=rhs.pv_add.end() )
- {
- j = find( pv_add.begin(), pv_add.end(), *i );
- if( j==pv_add.end() )
- tmp += "<--" + i->device;
- ++i;
- }
- if( !tmp.empty() )
- ret += " PvAdd:" + tmp;
- tmp.erase();
- i = pv_remove.begin();
- while( i!=pv_remove.end() )
- {
- j = find( rhs.pv_remove.begin(), rhs.pv_remove.end(), *i );
- if( j==rhs.pv_remove.end() )
- tmp += i->device + "-->";
- ++i;
- }
- i = rhs.pv_remove.begin();
- while( i!=rhs.pv_remove.end() )
- {
- j = find( pv_remove.begin(), pv_remove.end(), *i );
- if( j==pv_remove.end() )
- tmp += "<--" + i->device;
- ++i;
+ string ret = Container::getDiffString( rhs );
+ const PeContainer* p = dynamic_cast(&rhs);
+ if( p )
+ {
+ if( pe_size!=p->pe_size )
+ ret += " PeSize:" + decString(pe_size) + "-->" + decString(p->pe_size);
+ if( num_pe!=p->num_pe )
+ ret += " PE:" + decString(num_pe) + "-->" + decString(p->num_pe);
+ if( free_pe!=p->free_pe )
+ ret += " Free:" + decString(free_pe) + "-->" + decString(p->free_pe);
+ string tmp;
+ list<Pv>::const_iterator i = pv.begin();
+ list<Pv>::const_iterator j;
+ while( i!=pv.end() )
+ {
+ j = find( p->pv.begin(), p->pv.end(), *i );
+ if( j==p->pv.end() )
+ tmp += i->device + "-->";
+ ++i;
+ }
+ i = p->pv.begin();
+ while( i!=p->pv.end() )
+ {
+ j = find( pv.begin(), pv.end(), *i );
+ if( j==pv.end() )
+ tmp += "<--" + i->device;
+ ++i;
+ }
+ if( !tmp.empty() )
+ ret += " Pv:" + tmp;
+ tmp.erase();
+ i = pv_add.begin();
+ while( i!=pv_add.end() )
+ {
+ j = find( p->pv_add.begin(), p->pv_add.end(), *i );
+ if( j==p->pv_add.end() )
+ tmp += i->device + "-->";
+ ++i;
+ }
+ i = p->pv_add.begin();
+ while( i!=p->pv_add.end() )
+ {
+ j = find( pv_add.begin(), pv_add.end(), *i );
+ if( j==pv_add.end() )
+ tmp += "<--" + i->device;
+ ++i;
+ }
+ if( !tmp.empty() )
+ ret += " PvAdd:" + tmp;
+ tmp.erase();
+ i = pv_remove.begin();
+ while( i!=pv_remove.end() )
+ {
+ j = find( p->pv_remove.begin(), p->pv_remove.end(), *i );
+ if( j==p->pv_remove.end() )
+ tmp += i->device + "-->";
+ ++i;
+ }
+ i = p->pv_remove.begin();
+ while( i!=p->pv_remove.end() )
+ {
+ j = find( pv_remove.begin(), pv_remove.end(), *i );
+ if( j==pv_remove.end() )
+ tmp += "<--" + i->device;
+ ++i;
+ }
+ if( !tmp.empty() )
+ ret += " PvRemove:" + tmp;
}
- if( !tmp.empty() )
- ret += " PvRemove:" + tmp;
- tmp.erase();
return( ret );
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/PeContainer.h Mon Jan 14 15:47:42 2008
@@ -30,7 +30,7 @@
void unuseDev();
void changeDeviceName( const string& old, const string& nw );
bool equalContent( const PeContainer& rhs, bool comp_vol=true ) const;
- string logDifference( const PeContainer& d ) const;
+ virtual string getDiffString( const Container& d ) const;
protected:
struct Pv
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.cc Mon Jan 14 15:47:42 2008
@@ -25,7 +25,6 @@
getline( mounts, line );
while( mounts.good() )
{
- y2mil( "line:\"" << line << "\"" );
string dev = extractNthWord( 0, line );
if( dev.find( "/by-label/" ) != string::npos )
{
@@ -51,7 +50,10 @@
}
if( dev!= "rootfs" && dev!="/dev/root" )
{
- co[dev] = extractNthWord( 1, line );
+ co[dev].device = dev;
+ co[dev].mount = extractNthWord( 1, line );
+ co[dev].fs = extractNthWord( 2, line );
+ co[dev].opts = splitString( extractNthWord( 3, line ), "," );
}
getline( mounts, line );
}
@@ -63,7 +65,8 @@
{
dev = sto->findNormalDevice( dev );
}
- co[dev] = "/";
+ co[dev].device = dev;
+ co[dev].mount = "/";
}
mounts.close();
mounts.clear();
@@ -80,19 +83,26 @@
y2mil( "dev:" << dev );
dev.erase( pos );
}
- co[dev] = "swap";
+ co[dev].device = dev;
+ co[dev].mount = "swap";
+ co[dev].fs = "swap";
getline( mounts, line );
}
- y2mil( "co:" << co );
+ map::const_iterator i = co.begin();
+ while( i!=co.end() )
+ {
+ y2mil( "co:[" << i->first << "]-->" << i->second );
+ ++i;
+ }
}
string
ProcMounts::getMount( const string& dev ) const
{
string ret;
- map::const_iterator i = co.find( dev );
+ map::const_iterator i = co.find( dev );
if( i!=co.end() )
- ret = i->second;
+ ret = i->second.mount;
return( ret );
}
@@ -113,12 +123,19 @@
ProcMounts::allMounts() const
{
map ret;
- map::const_iterator i = co.begin();
- for( map::const_iterator i = co.begin(); i!=co.end(); ++i )
+ for( map::const_iterator i = co.begin(); i!=co.end(); ++i )
{
- ret[i->second] = i->first;
+ ret[i->second.mount] = i->first;
}
return( ret );
}
+void ProcMounts::getEntries( list<FstabEntry>& l ) const
+ {
+ l.clear();
+ for( map::const_iterator i = co.begin(); i!=co.end(); ++i )
+ {
+ l.push_back( i->second );
+ }
+ }
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/ProcMounts.h Mon Jan 14 15:47:42 2008
@@ -5,6 +5,8 @@
#include <list>
#include <map>
+#include "y2storage/EtcFstab.h"
+
namespace storage
{
class Storage;
@@ -16,8 +18,9 @@
string getMount( const string& Dev ) const;
string getMount( const std::list<string>& dl ) const;
std::map allMounts() const;
+ void getEntries( std::list<FstabEntry>& l ) const;
protected:
- std::map co;
+ std::map co;
};
}
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.cc Mon Jan 14 15:47:42 2008
@@ -259,7 +259,10 @@
{
fstab = new EtcFstab( "/etc", isRootMounted() );
detectLoops( ppart );
- detectFsData( vBegin(), vEnd() );
+ ProcMounts pm( this );
+ if( !instsys() )
+ detectNfs( pm );
+ detectFsData( vBegin(), vEnd(), pm );
}
EvmsCoIterator e = findEvmsCo( "" );
if( e!=evCoEnd() )
@@ -482,6 +485,26 @@
}
}
+void Storage::detectNfs( ProcMounts& mounts )
+ {
+ if( test() )
+ {
+ string file = testdir+"/nfs";
+ if( access( file.c_str(), R_OK )==0 )
+ {
+ addToList( new NfsCo( this, file ) );
+ }
+ }
+ else
+ {
+ NfsCo * v = new NfsCo( this, mounts );
+ if( !v->isEmpty() )
+ addToList( v );
+ else
+ delete v;
+ }
+ }
+
void
Storage::detectLvmVgs()
{
@@ -749,7 +772,8 @@
}
void
-Storage::detectFsData( const VolIterator& begin, const VolIterator& end )
+Storage::detectFsData( const VolIterator& begin, const VolIterator& end,
+ ProcMounts& mounts )
{
y2milestone( "detectFsData begin" );
SystemCmd Blkid( "BLKID_SKIP_CHECK_MDRAID=1 /sbin/blkid -c /dev/null" );
@@ -763,13 +787,12 @@
y2mil( "detect:" << *i );
}
}
- ProcMounts Mounts( this );
for( VolIterator i=begin; i!=end; ++i )
{
if( i->getUsedByType()==UB_NONE )
{
if( detectMounted )
- i->getMountData( Mounts );
+ i->getMountData( mounts );
i->getFstabData( *fstab );
y2mil( "detect:" << *i );
if( i->getFs()==FSUNKNOWN && i->getEncryption()==ENC_NONE )
@@ -2418,7 +2441,8 @@
{
detectEvms();
VPair p = vPair( isEvms );
- detectFsData( p.begin(), p.end() );
+ ProcMounts pm( this );
+ detectFsData( p.begin(), p.end(), pm );
EvmsCoPair ep = evCoPair();
EvmsCoIterator coi = ep.begin();
while( coi!=ep.end() && coi->device()!="/dev/evms" )
@@ -3120,6 +3144,87 @@
return( i != p.end() );
}
+bool Storage::haveNfs( NfsCo*& co )
+ {
+ co = NULL;
+ CPair p = cPair();
+ ContIterator i = p.begin();
+ while( i != p.end() && i->type()!=NFSC )
+ ++i;
+ if( i != p.end() )
+ co = static_cast(&(*i));
+ return( i != p.end() );
+ }
+
+int
+Storage::addNfsDevice( const string& nfsDev, const string& opts,
+ unsigned long long sizeK, const string& mp )
+ {
+ int ret = 0;
+ assertInit();
+ y2mil( "name:" << nfsDev << " sizeK:" << sizeK << " mp:" << mp );
+ if( readonly )
+ {
+ ret = STORAGE_CHANGE_READONLY;
+ }
+ NfsCo *co = NULL;
+ bool have = true;
+ if( ret==0 )
+ {
+ have = haveNfs(co);
+ if( !have )
+ co = new NfsCo( this );
+ }
+ if( ret==0 && co!=NULL )
+ {
+ if( sizeK==0 )
+ checkNfsDevice( nfsDev, opts, sizeK );
+ ret = co->addNfs( nfsDev, sizeK, mp );
+ }
+ if( !have )
+ {
+ if( ret==0 )
+ addToList( co );
+ else if( co!=NULL )
+ delete co;
+ }
+ if( ret==0 )
+ {
+ ret = checkCache();
+ }
+ y2milestone( "ret:%d", ret );
+ return( ret );
+ }
+
+int
+Storage::checkNfsDevice( const string& nfsDev, const string& opts,
+ unsigned long long& sizeK )
+ {
+ int ret = 0;
+ assertInit();
+ NfsCo co( this );
+ string mdir = tmpDir() + "/tmp_mp";
+ unlink( mdir.c_str() );
+ rmdir( mdir.c_str() );
+ createPath( mdir );
+ ret = co.addNfs( nfsDev, 0, "" );
+ if( !opts.empty() )
+ co.vBegin()->setFstabOption( opts );
+ if( instsys() )
+ {
+ SystemCmd c;
+ c.execute( "/sbin/portmap" );
+ }
+ if( ret==0 && (ret=co.vBegin()->mount( mdir ))==0 )
+ {
+ sizeK = getDfSize( mdir );
+ ret = co.vBegin()->umount( mdir );
+ }
+ y2mil( "name:" << nfsDev << " opts:" << opts << " ret:" << ret <<
+ " sizeK:" << sizeK );
+ return( ret );
+ }
+
int
Storage::createFileLoop( const string& lname, bool reuseExisting,
unsigned long long sizeK, const string& mp,
@@ -4118,6 +4223,20 @@
return( ret );
}
+int Storage::getNfsInfo( dequestorage::NfsInfo& plist )
+ {
+ int ret = 0;
+ plist.clear();
+ assertInit();
+ ConstNfsPair p = nfsPair(Nfs::notDeleted);
+ for( ConstNfsIterator i = p.begin(); i != p.end(); ++i )
+ {
+ plist.push_back( NfsInfo() );
+ i->getInfo( plist.back() );
+ }
+ return( ret );
+ }
+
int Storage::getLoopInfo( dequestorage::LoopInfo& plist )
{
int ret = 0;
@@ -4200,6 +4319,9 @@
static FsCapabilitiesX hfsCaps (false, false, false, false, false, false,
false, 0, 10*1024);
+ static FsCapabilitiesX nfsCaps (false, false, false, false, false, false,
+ false, 0, 10*1024);
+
switch (fstype)
{
case REISERFS:
@@ -4234,6 +4356,10 @@
fscapabilities = hfsCaps;
return true;
+ case NFS:
+ fscapabilities = nfsCaps;
+ return true;
+
case SWAP:
fscapabilities = swapCaps;
return true;
@@ -4941,6 +5067,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 );
@@ -5046,6 +5177,27 @@
return( ret );
}
+unsigned long long
+Storage::getDfSize( const string& mp )
+ {
+ unsigned long long ret = 0;
+ struct statvfs64 fsbuf;
+ if( statvfs64( mp.c_str(), &fsbuf )==0 )
+ {
+ ret = fsbuf.f_blocks;
+ ret *= fsbuf.f_bsize;
+ ret /= 1024;
+ y2milestone( "blocks:%llu free:%llu bsize:%lu", fsbuf.f_blocks,
+ fsbuf.f_bfree, fsbuf.f_bsize );
+ }
+ else
+ {
+ y2war( "errno:" << errno << " " << strerror(errno));
+ }
+ y2mil( "mp:" << mp << " ret:" << ret );
+ return( ret );
+ }
+
bool
Storage::getFreeInfo( const string& device, unsigned long long& resize_free,
unsigned long long& df_free,
@@ -5083,8 +5235,8 @@
mp = vol->getMount();
if( !mp.empty() )
{
- struct statvfs fsbuf;
- ret = statvfs( mp.c_str(), &fsbuf )==0;
+ struct statvfs64 fsbuf;
+ ret = statvfs64( mp.c_str(), &fsbuf )==0;
if( ret )
{
df_free = fsbuf.f_bfree;
@@ -5094,8 +5246,8 @@
used = fsbuf.f_blocks-fsbuf.f_bfree;
used *= fsbuf.f_bsize;
used /= 1024;
- y2milestone( "blocks:%lu free:%lu bsize:%lu", fsbuf.f_blocks,
- fsbuf.f_bfree, fsbuf.f_bsize );
+ y2milestone( "blocks:%llu free:%llu bsize:%lu",
+ fsbuf.f_blocks, fsbuf.f_bfree, fsbuf.f_bsize );
y2milestone( "free:%llu used:%llu", df_free, used );
}
if( ret && vol->getFs()==NTFS )
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Storage.h Mon Jan 14 15:47:42 2008
@@ -21,6 +21,8 @@
#include "y2storage/DmCo.h"
#include "y2storage/LoopCo.h"
#include "y2storage/Loop.h"
+#include "y2storage/NfsCo.h"
+#include "y2storage/Nfs.h"
#include "y2storage/FilterIterator.h"
#include "y2storage/DerefIterator.h"
#include "y2storage/ListListIterator.h"
@@ -116,6 +118,8 @@
{ return( d.type()==storage::MD ); }
static bool isLoop( const Container&d )
{ return( d.type()==storage::LOOP ); }
+ static bool isNfs( const Container&d )
+ { return( d.type()==storage::NFSC ); }
static bool isDm( const Container&d )
{ return( d.type()==storage::DM ); }
struct FreeInfo
@@ -206,6 +210,7 @@
dequestorage::EvmsInfo& plist );
int getMdInfo( dequestorage::MdInfo& plist );
int getDmInfo( dequestorage::DmInfo& plist );
+ int getNfsInfo( dequestorage::NfsInfo& plist );
int getLoopInfo( dequestorage::LoopInfo& plist );
int getContVolInfo( const string& dev, ContVolInfo& info);
@@ -285,6 +290,7 @@
unsigned long long& df_free,
unsigned long long& used, bool& win, bool& efi,
bool use_cache );
+ unsigned long long getDfSize( const string& mp );
int createBackupState( const string& name );
int removeBackupState( const string& name );
int restoreBackupState( const string& name );
@@ -338,6 +344,11 @@
int checkMd( const string& name );
+ int addNfsDevice( const string& nfsDev, const string& opts,
+ unsigned long long sizeK, const string& mp );
+ int checkNfsDevice( const string& nfsDev, const string& opts,
+ unsigned long long& sizeK );
+
int createFileLoop( const string& lname, bool reuseExisting,
unsigned long long sizeK, const string& mp,
const string& pwd, string& device );
@@ -1180,6 +1191,66 @@
return( typename ConstLoopI<Pred>::type( typename ConstLoopPI<Pred>::type(pair, p, true )) );
}
+// iterators over nfs devices
+ protected:
+ // protected typedefs for iterators over nfs devices
+ typedef CastIterator ConstNfsInter;
+ template< class Pred >
+ struct ConstNfsPI { typedef ContainerIter type; };
+ typedef CheckFnc<const Nfs> CheckFncNfs;
+ typedef CheckerIterator< CheckFncNfs, ConstNfsPI<CheckFncNfs>::type,
+ ConstNfsInter, Nfs > ConstNfsPIterator;
+ public:
+ // public typedefs for iterators over nfs devices
+ template< class Pred >
+ struct ConstNfsI
+ { typedef ContainerDerIter type; };
+ template< class Pred >
+ struct NfsCondIPair
+ { typedef MakeCondIterPair type;};
+ typedef DerefIterator ConstNfsIterator;
+ typedef IterPair<ConstNfsIterator> ConstNfsPair;
+
+ // public member functions for iterators over nfs devices
+ ConstNfsPair nfsPair( bool (* CheckNfs)( const Nfs& )=NULL ) const
+ {
+ return( ConstNfsPair( nfsBegin( CheckNfs ), nfsEnd( CheckNfs ) ));
+ }
+ ConstNfsIterator nfsBegin( bool (* CheckNfs)( const Nfs& )=NULL ) const
+ {
+ ConstVolInter b( contPair( isNfs ) );
+ ConstVolInter e( contPair( isNfs ), true );
+ IterPair<ConstNfsInter> p( (ConstNfsInter(b)), (ConstNfsInter(e)) );
+ return( ConstNfsIterator( ConstNfsPIterator(p, CheckNfs )));
+ }
+ ConstNfsIterator nfsEnd( bool (* CheckNfs)( const Nfs& )=NULL ) const
+ {
+ ConstVolInter b( contPair( isNfs ) );
+ ConstVolInter e( contPair( isNfs ), true );
+ IterPair<ConstNfsInter> p( (ConstNfsInter(b)), (ConstNfsInter(e)) );
+ return( ConstNfsIterator( ConstNfsPIterator(p, CheckNfs, true )));
+ }
+ template< class Pred > typename NfsCondIPair<Pred>::type nfsCondPair( const Pred& p ) const
+ {
+ return( typename NfsCondIPair<Pred>::type( nfsCondBegin( p ), nfsCondEnd( p ) ) );
+ }
+ template< class Pred > typename ConstNfsI<Pred>::type nfsCondBegin( const Pred& p ) const
+ {
+ ConstVolInter b( contPair( isNfs ) );
+ ConstVolInter e( contPair( isNfs ), true );
+ IterPair<ConstNfsInter> pair( (ConstNfsInter(b)), (ConstNfsInter(e)) );
+ return( typename ConstNfsI<Pred>::type( typename ConstNfsPI<Pred>::type(pair, p) ) );
+ }
+ template< class Pred > typename ConstNfsI<Pred>::type nfsCondEnd( const Pred& p ) const
+ {
+ ConstVolInter b( contPair( isNfs ) );
+ ConstVolInter e( contPair( isNfs ), true );
+ IterPair<ConstNfsInter> pair( (ConstNfsInter(b)), (ConstNfsInter(e)) );
+ return( typename ConstNfsI<Pred>::type( typename ConstNfsPI<Pred>::type(pair, p, true )) );
+ }
+
// iterators over device mapper devices
protected:
// protected typedefs for iterators over device mapper devices
@@ -1248,11 +1319,13 @@
void detectMultipath();
void detectMds();
void detectLoops( ProcPart& ppart );
+ void detectNfs( ProcMounts& mounts );
void detectLvmVgs();
void detectEvms();
void detectDm( ProcPart& ppart );
void initDisk( DiskData& data, ProcPart& pp );
- void detectFsData( const VolIterator& begin, const VolIterator& end );
+ void detectFsData( const VolIterator& begin, const VolIterator& end,
+ ProcMounts& mounts );
void detectFsDataTestMode( const string& file,
const VolIterator& begin,
const VolIterator& end );
@@ -1273,6 +1346,7 @@
bool findContainer( const string& device, ContIterator& c );
bool haveMd( MdCo*& md );
+ bool haveNfs( NfsCo*& co );
bool haveLoop( LoopCo*& loop );
bool haveEvms();
void handleEvmsRemoveDevice( const Disk* disk, const string& d,
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/StorageInterface.h Mon Jan 14 15:47:42 2008
@@ -80,7 +80,7 @@
namespace storage
{
- enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, VFAT, XFS, JFS, HFS, NTFS, SWAP, FSNONE };
+ enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, VFAT, XFS, JFS, HFS, NTFS, SWAP, NFS, FSNONE };
enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
@@ -96,7 +96,8 @@
enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_EVMS, UB_DM };
- enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, EVMS };
+ enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, EVMS, NFSC,
+ COTYPE_LAST_ENTRY };
/**
@@ -310,6 +311,15 @@
};
/**
+ * Contains info about a nfs volumes
+ */
+ struct NfsInfo
+ {
+ NfsInfo() {};
+ VolumeInfo v;
+ };
+
+ /**
* Contains info about a file based loop devices.
*/
struct LoopInfo
@@ -446,6 +456,9 @@
VOLUME_CRYPTFORMAT_FAILED = -3033,
VOLUME_CRYPTSETUP_FAILED = -3034,
VOLUME_CRYPTUNSETUP_FAILED = -3035,
+ VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
+ VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037,
+ VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
LVM_CREATE_PV_FAILED = -4000,
LVM_PV_ALREADY_CONTAINED = -4001,
@@ -581,6 +594,12 @@
DASD_FDASD_FAILED = -11001,
DASD_DASDFMT_FAILED = -11002,
+ 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,
@@ -717,6 +736,14 @@
virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
/**
+ * Query infos for nfs devices in system
+ *
+ * @param plist list of records that get filled with nfs info
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
+
+ /**
* Query infos for file based loop devices in system
*
* @param plist list of records that get filled with loop specific info
@@ -1593,6 +1620,30 @@
virtual int checkMd( const string& name ) = 0;
/**
+ * Add knowdlege about existence of nfs device.
+ *
+ * @param nfsDev name of nfs device
+ * @param sizeK size of the nfs device
+ * @param opts mount options for nfs mount
+ * @param mp mount point of the nfs device
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int addNfsDevice( const string& nfsDev, const string& opts,
+ unsigned long long sizeK,
+ const string& mp ) = 0;
+
+ /**
+ * Check accessability and size of nfs device.
+ *
+ * @param nfsDev name of nfs device
+ * @param opts mount options for nfs mount
+ * @param sizeK size of the nfs device
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int checkNfsDevice( const string& nfsDev, const string& opts,
+ unsigned long long& sizeK ) = 0;
+
+ /**
* Create a file based loop device. Encryption is automatically
* activated on the loop device.
*
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.cc?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.cc (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.cc Mon Jan 14 15:47:42 2008
@@ -467,6 +467,10 @@
{
ret = VOLUME_FORMAT_FS_TOO_SMALL;
}
+ else if( new_fs == NFS )
+ {
+ ret = VOLUME_FORMAT_NFS_IMPOSSIBLE;
+ }
else
{
fs = new_fs;
@@ -1071,8 +1075,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 );
}
@@ -1243,6 +1250,8 @@
{
if( !loop_active && !isTmpCryptMp(mp) && crypt_pwd.empty() )
ret = VOLUME_CRYPT_NO_PWD;
+ if( ret == 0 && cType()==NFSC )
+ ret = VOLUME_CRYPT_NFS_IMPOSSIBLE;
if( ret==0 && format )
{
encryption = typ;
@@ -2255,7 +2264,7 @@
{
changed = true;
che.fs = fs_names[fs];
- if( fs==SWAP || encryption!=ENC_NONE )
+ if( fs==NFS || fs==SWAP || encryption!=ENC_NONE )
che.freq = che.passno = 0;
else
{
@@ -2587,13 +2596,17 @@
{
s << "Device:" << v.dev;
if( v.numeric )
- s << " Nr:" << v.num;
- else
+ {
+ if( v.num>0 )
+ s << " Nr:" << v.num;
+ }
+ else if( v.nm!=v.dev )
s << " Name:" << v.nm;
s << " SizeK:" << v.size_k;
if( v.size_k != v.orig_size_k )
s << " orig_SizeK:" << v.orig_size_k;
- s << " Node <" << v.mjr << ":" << v.mnr << ">";
+ if( v.mjr!=0 || v.mnr!=0 )
+ s << " Node <" << v.mjr << ":" << v.mnr << ">";
if( v.ronly )
s << " readonly";
if( v.del )
@@ -2883,7 +2896,8 @@
}
string Volume::fs_names[] = { "unknown", "reiserfs", "ext2", "ext3", "vfat",
- "xfs", "jfs", "hfs", "ntfs", "swap", "none" };
+ "xfs", "jfs", "hfs", "ntfs", "swap", "nfs",
+ "none" };
string Volume::mb_names[] = { "device", "uuid", "label", "id", "path" };
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.h?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.h (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/libstorage/src/Volume.h Mon Jan 14 15:47:42 2008
@@ -91,7 +91,8 @@
void initLabel( const string& lbl ) { label=orig_label=lbl; }
storage::MountByType getMountBy() const { return mount_by; }
const string& getFstabOption() const { return fstab_opt; }
- void setFstabOption( const string& val ) { fstab_opt=val; }
+ void setFstabOption( const string& val ) { orig_fstab_opt=fstab_opt=val; }
+ void setMount( const string& val ) { orig_mp=mp=val; }
void updateFstabOptions();
bool needFstabUpdate() const;
const string& getMkfsOption() const { return mkfs_opt; }
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/package/yast2-storage.changes Mon Jan 14 15:47:42 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Mon Jan 14 15:46:38 CET 2008 - fehr@suse.de
+
+- backport NFS support for SLES10 SP2 (feature #300779)
+- version 2.13.96
+
+-------------------------------------------------------------------
Thu Oct 25 17:55:57 CEST 2007 - fehr@suse.de
- fix problem when more than one device name translation could be
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_check_generated.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_check_generated.ycp?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_check_generated.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_check_generated.ycp Mon Jan 14 15:47:42 2008
@@ -322,7 +322,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;
@@ -607,7 +607,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: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp Mon Jan 14 15:47:42 2008
@@ -552,6 +552,14 @@
return( ret );
};
+define map CheckDeviceFinalOk( map new )
+ ``{
+ y2milestone( "CheckDeviceFinalOk new:%1", new );
+ map ret = CheckCryptOk( ret["map"]:$[] );
+ y2milestone( "CheckDeviceFinalOk ret:%1", ret );
+ return( ret );
+ };
+
define map HandleFsChanged( boolean init, map new, map file_systems )
``{
list<string> not_used_mp = [];
@@ -606,8 +614,9 @@
UI::ChangeWidget( `id(`mount_point), `Value, new["mount"]:"" );
UI::ChangeWidget(`id(`fstab_options), `Enabled, true );
- 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;
@@ -655,7 +664,14 @@
new = filter(string key, any value, new, ``( key != "fstopt"));
}
}
- if( init || ret == `format_true || ret == `format_false )
+ 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 && UI::WidgetExists( `id(`format))) ||
+ ret == `format_true || ret == `format_false )
{
boolean format = UI::QueryWidget(`id(`format), `CurrentButton) ==
`format_true;
@@ -666,11 +682,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,
@@ -741,7 +761,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 )
@@ -751,8 +773,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: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/nfs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/nfs.ycp?rev=43581&view=auto
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/nfs.ycp (added)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/include/nfs.ycp Mon Jan 14 15:47:42 2008
@@ -0,0 +1,300 @@
+/**
+ * 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,
+ retval["fstopt"]:"" );
+ 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: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/inst_custom_part.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/inst_custom_part.ycp?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/inst_custom_part.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/inst_custom_part.ycp Mon Jan 14 15:47:42 2008
@@ -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";
@@ -90,6 +91,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");
@@ -933,13 +935,13 @@
// order should be md, then loop, then LVM, then EVMS
map disk_order = $[ `CT_DISK : 0, `CT_MD : 1, `CT_LOOP : 2, `CT_LVM : 3,
- `CT_EVMS : 4, `CT_DM : 5 ];
+ `CT_EVMS : 4, `CT_DM : 5, `CT_NFS : 6 ];
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]:7;
+ integer ob = disk_order[targets[b,"type"]:`CT_UNKNOWN]:7;
return( (oa==ob) ? (ahttp://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/FileSystems.ycp?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/FileSystems.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/FileSystems.ycp Mon Jan 14 15:47:42 2008
@@ -39,6 +39,7 @@
LibStorage::HFS() : `hfs,
LibStorage::NTFS() : `ntfs,
LibStorage::SWAP() : `swap,
+ LibStorage::NFS() : `nfs,
LibStorage::FSNONE() : `none
]
];
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Partitions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Partitions.ycp?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Partitions.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Partitions.ycp Mon Jan 14 15:47:42 2008
@@ -51,6 +51,7 @@
global string lv_name = "LV";
global string dm_name = "DM";
global string loop_name = "Loop Device";
+ global string nfs_name = "NFS";
// filesystems for /win
/* FAT32, Win95-Fat32, Win95LBA, Win95-Fat16 */
Modified: branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp?rev=43581&r1=43580&r2=43581&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp (original)
+++ branches/SuSE-SLE-10-SP1-Branch/storage/storage/src/modules/Storage.ycp Mon Jan 14 15:47:42 2008
@@ -54,6 +54,7 @@
import "LibStorage::MdInfo";
import "LibStorage::LoopInfo";
import "LibStorage::DmInfo";
+ import "LibStorage::NfsInfo";
import "LibStorage::ContainerInfo";
import "LibStorage::DiskInfo";
import "LibStorage::LvmVgInfo";
@@ -67,7 +68,8 @@
LibStorage::LOOP() : `CT_LOOP,
LibStorage::LVM() : `CT_LVM,
LibStorage::EVMS() : `CT_EVMS,
- LibStorage::DM() : `CT_DM
+ LibStorage::DM() : `CT_DM,
+ LibStorage::NFSC() : `CT_NFS
]
];
@@ -152,7 +154,7 @@
map DiskMap = $[];
map ClassifiedSettings = $[];
map type_order = $[ `CT_DISK : 0, `CT_MD : 1, `CT_LOOP : 2, `CT_DM : 3,
- `CT_LVM : 4, `CT_EVMS : 5 ];
+ `CT_LVM : 4, `CT_EVMS : 5, `CT_NFS : 6 ];
list<string> hw_packages = [];
list<string> no_propose_disks = nil;
boolean proposal_evms = false;
@@ -306,9 +308,9 @@
list<string> tl = splitstring( device, "=" );
ls = [ "dev", "disk", "", tl[1]:"" ];
ls[2] = (search( device, "LABEL=" )==0)?"by-label":"by-uuid";
- y2milestone( "GetDiskPartition ls:%1", ls );
+ y2milestone( "GetDiskPartitionTg ls:%1", ls );
}
- y2debug( "GetDiskPartition size:%1 ls:%2", size(ls), ls );
+ y2debug( "GetDiskPartitionTg size:%1 ls:%2", size(ls), ls );
if( size(ls)>=4 && ls[1]:"" == "disk" &&
contains( [ "by-id", "by-path", "by-uuid", "by-label" ], ls[2]:"" ))
@@ -362,7 +364,7 @@
{
num = tointeger( substring( id, l[0]:0+5 ));
id = substring( id, 0, l[0]:0 );
- y2debug( "GetDiskPartition id:%1 num:%2", id, num );
+ y2debug( "GetDiskPartitionTg id:%1 num:%2", id, num );
}
foreach( string dev, map disk, tg,
``{
@@ -391,7 +393,7 @@
{
num = tointeger( substring( id, l[0]:0+5 ));
id = substring( id, 0, l[0]:0 );
- y2debug( "GetDiskPartition id:%1 num:%2", id, num );
+ y2debug( "GetDiskPartitionTg id:%1 num:%2", id, num );
}
foreach( string dev, map disk, tg,
``{
@@ -411,7 +413,7 @@
});
}
}
- else
+ else if( search( device, "/" )==0 )
{
if( search( device, "/dev/hd" )==0 ||
search( device, "/dev/sd" )==0 ||
@@ -502,7 +504,11 @@
ret["nr"] = "";
}
}
- y2debug( "GetDiskPartition device:%1 ret:%2", device, ret );
+ else
+ {
+ ret = $[ "disk" : "/dev/nfs", "nr" : device ];
+ }
+ y2debug( "GetDiskPartitionTg device:%1 ret:%2", device, ret );
return( ret );
};
@@ -1437,6 +1443,24 @@
c["partitions"] = add( c["partitions"]:[], p );
});
}
+ else if( c["type"]:`CT_UNKNOWN == `CT_NFS )
+ {
+ list<any> pinfos = [];
+ y2milestone( "before getNfsInfo" );
+ ret = LibStorage::StorageInterface::getNfsInfo( sint, pinfos );
+ y2milestone( "after getNfsInfo" );
+ if( ret<0 )
+ y2warning( "getNfsInfo ret:%1", ret );
+ foreach( any info, pinfos,
+ ``{
+ map p = $[];
+ vinfo = LibStorage::NfsInfo::swig_v_get(info);
+ p = volumeMap( vinfo, p );
+ p["type"] = `nfs;
+ p["fstype"] = Partitions::nfs_name;
+ c["partitions"] = add( c["partitions"]:[], p );
+ });
+ }
//y2milestone ("getContainerInfo container %1", remove( c, "partitions" ) );
y2milestone ("getContainerInfo container %1", c );
return( c );
@@ -2710,6 +2734,35 @@
return( ret==0 );
}
+global boolean AddNfsVolume( string nfsdev, string opts, integer sz, string mp )
+ {
+ y2milestone( "AddNfsVolume dev:%1 opts:%2 size:%3 mp:%4", nfsdev, opts,
+ sz, mp );
+ integer ret = 0;
+ string dummy = "";
+ ret = LibStorage::StorageInterface::addNfsDevice( sint, nfsdev, opts, sz, mp );
+ if( ret<0 )
+ y2error( "AddNfsVolume sint ret:%1", ret );
+ UpdateTargetMapDisk( "/dev/nfs" );
+ return( ret==0 );
+ }
+
+global integer CheckNfsVolume( string nfsdev, string opts )
+ {
+ y2milestone( "CheckNfsVolume dev:%1 opts:%2", nfsdev, opts );
+ integer ret = 0;
+ integer sz = 0;
+ string dummy = "";
+ ret = LibStorage::StorageInterface::checkNfsDevice( sint, nfsdev, opts,
+ 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 );
@@ -3012,6 +3065,11 @@
p["stripesize"]:0 );
}
}
+ else if( ctype == `CT_NFS )
+ {
+ ret = Storage::AddNfsVolume( p["device"]:"", p["fstopt"]:"",
+ p["size_k"]:0, p["mount"]:"" );
+ }
y2milestone( "CreateAny ret:%1", ret );
return( ret );
}
@@ -3292,7 +3350,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 >
@@ -3615,10 +3672,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