Author: aschnell
Date: Thu Aug 14 19:07:38 2008
New Revision: 50094
URL: http://svn.opensuse.org/viewcvs/yast?rev=50094&view=rev
Log:
- backup commit
Added:
branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.cc
branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.h
branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc
branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h
Modified:
branches/tmp/aschnell/multipath/libstorage/bindings/ycp/LibStorage.i
branches/tmp/aschnell/multipath/libstorage/src/Container.cc
branches/tmp/aschnell/multipath/libstorage/src/Makefile.am
branches/tmp/aschnell/multipath/libstorage/src/Storage.cc
branches/tmp/aschnell/multipath/libstorage/src/Storage.h
branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h
branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.cc
branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.h
branches/tmp/aschnell/multipath/storage/src/include/ep-hd.ycp
branches/tmp/aschnell/multipath/storage/src/include/ep-main.ycp
branches/tmp/aschnell/multipath/storage/src/modules/Partitions.ycp
branches/tmp/aschnell/multipath/storage/src/modules/Storage.ycp
branches/tmp/aschnell/multipath/storage/src/modules/StorageFields.ycp
branches/tmp/aschnell/multipath/yast2-storage.spec.in
Modified: branches/tmp/aschnell/multipath/libstorage/bindings/ycp/LibStorage.i
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/bindings/ycp/LibStorage.i?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/bindings/ycp/LibStorage.i (original)
+++ branches/tmp/aschnell/multipath/libstorage/bindings/ycp/LibStorage.i Thu Aug 14 19:07:38 2008
@@ -30,8 +30,10 @@
specialize_sequence(storage::NfsInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::DmPartCoInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::DmraidCoInfo, TO_PACK, FROM_PACK, CHECK)
+specialize_sequence(storage::DmmultipathCoInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::DmPartInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::DmraidInfo, TO_PACK, FROM_PACK, CHECK)
+specialize_sequence(storage::DmmultipathInfo, TO_PACK, FROM_PACK, CHECK)
specialize_sequence(storage::PartitionSlotInfo, TO_PACK, FROM_PACK, CHECK)
%include "../../src/StorageInterface.h"
Modified: branches/tmp/aschnell/multipath/libstorage/src/Container.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Container.cc?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Container.cc (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Container.cc Thu Aug 14 19:07:38 2008
@@ -419,5 +419,5 @@
}
const string Container::type_names[] = { "UNKNOWN", "DISK", "MD", "LOOP", "LVM",
- "DM", "DMRAID", "NFS" };
+ "DM", "DMRAID", "NFS", "DMMULTIPATH" };
Added: branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.cc?rev=50094&view=auto
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.cc (added)
+++ branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.cc Thu Aug 14 19:07:38 2008
@@ -0,0 +1,250 @@
+/*
+ Textdomain "storage"
+*/
+
+#include <sstream>
+
+#include "y2storage/Dmmultipath.h"
+#include "y2storage/DmmultipathCo.h"
+#include "y2storage/SystemCmd.h"
+#include "y2storage/AppUtil.h"
+#include "y2storage/Storage.h"
+
+using namespace storage;
+using namespace std;
+
+Dmmultipath::Dmmultipath( const DmmultipathCo& d, unsigned nr, Partition* p ) :
+ DmPart( d, nr, p )
+ {
+ y2milestone( "constructed dmmultipath %s on co %s", dev.c_str(),
+ cont->name().c_str() );
+ }
+
+Dmmultipath::~Dmmultipath()
+ {
+ y2debug( "destructed dmmultipath %s", dev.c_str() );
+ }
+
+string Dmmultipath::removeText( bool doing ) const
+ {
+ string txt;
+ string d = dev.substr(12);
+ if( p && p->OrigNr()!=p->nr() )
+ d = co()->numToName(p->OrigNr());
+ if( doing )
+ {
+ // displayed text during action, %1$s is replaced by multipath partition name e.g. pdc_dabaheedj1
+ txt = sformat( _("Deleting multipath partition %1$s"), d.c_str() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by multipath partition name e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Delete multipath partition %1$s (%2$s)"), d.c_str(),
+ sizeString().c_str() );
+ }
+ return( txt );
+ }
+
+string Dmmultipath::createText( bool doing ) const
+ {
+ string txt;
+ string d = dev.substr(12);
+ if( doing )
+ {
+ // displayed text during action, %1$s is replaced by multipath partition name e.g. pdc_dabaheedj1
+ txt = sformat( _("Creating multipath partition %1$s"), d.c_str() );
+ }
+ else
+ {
+ if( mp=="swap" )
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Create swap multipath partition %1$s (%2$s)"),
+ d.c_str(), sizeString().c_str() );
+ }
+ else if( !mp.empty() )
+ {
+ if( encryption==ENC_NONE )
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by file system type (e.g. reiserfs)
+ // %4$s is replaced by mount point (e.g. /usr)
+ txt = sformat( _("Create multipath partition %1$s (%2$s) for %4$s with %3$s"),
+ d.c_str(), sizeString().c_str(), fsTypeString().c_str(),
+ mp.c_str() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by file system type (e.g. reiserfs)
+ // %4$s is replaced by mount point (e.g. /usr)
+ txt = sformat( _("Create encrypted multipath partition %1$s (%2$s) for %4$s with %3$s"),
+ d.c_str(), sizeString().c_str(), fsTypeString().c_str(),
+ mp.c_str() );
+ }
+ }
+ else if( p && p->type()==EXTENDED )
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Create extended multipath partition %1$s (%2$s)"),
+ d.c_str(), sizeString().c_str() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Create multipath partition %1$s (%2$s)"),
+ d.c_str(), sizeString().c_str() );
+ }
+ }
+ return( txt );
+ }
+
+string Dmmultipath::formatText( bool doing ) const
+ {
+ string txt;
+ string d = dev.substr(12);
+ if( doing )
+ {
+ // displayed text during action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by file system type (e.g. reiserfs)
+ txt = sformat( _("Formatting multipath partition %1$s (%2$s) with %3$s"),
+ d.c_str(), sizeString().c_str(), fsTypeString().c_str() );
+ }
+ else
+ {
+ if( !mp.empty() )
+ {
+ if( mp=="swap" )
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Format multipath partition %1$s (%2$s) for swap"),
+ d.c_str(), sizeString().c_str() );
+ }
+ else if( encryption==ENC_NONE )
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by file system type (e.g. reiserfs)
+ // %4$s is replaced by mount point (e.g. /usr)
+ txt = sformat( _("Format multipath partition %1$s (%2$s) for %4$s with %3$s"),
+ d.c_str(), sizeString().c_str(), fsTypeString().c_str(),
+ mp.c_str() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by file system type (e.g. reiserfs)
+ // %4$s is replaced by mount point (e.g. /usr)
+ txt = sformat( _("Format encrypted multipath partition %1$s (%2$s) for %4$s with %3$s"),
+ d.c_str(), sizeString().c_str(), fsTypeString().c_str(),
+ mp.c_str() );
+ }
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by file system type (e.g. reiserfs)
+ txt = sformat( _("Format multipath partition %1$s (%2$s) with %3$s"),
+ d.c_str(), sizeString().c_str(),
+ fsTypeString().c_str() );
+ }
+ }
+ return( txt );
+ }
+
+string Dmmultipath::resizeText( bool doing ) const
+ {
+ string txt;
+ string d = dev.substr(12);
+ if( doing )
+ {
+ if( needShrink() )
+ // displayed text during action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Shrinking multipath partition %1$s to %2$s"), d.c_str(), sizeString().c_str() );
+ else
+ // displayed text during action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Extending multipath partition %1$s to %2$s"), d.c_str(), sizeString().c_str() );
+ txt += _(" (progress bar might not move)");
+ }
+ else
+ {
+ if( needShrink() )
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Shrink multipath partition %1$s to %2$s"), d.c_str(), sizeString().c_str() );
+ else
+ // displayed text before action, %1$s is replaced by multipath partition e.g. pdc_dabaheedj1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat( _("Extend multipath partition %1$s to %2$s"), d.c_str(), sizeString().c_str() );
+
+ }
+ return( txt );
+ }
+
+string Dmmultipath::setTypeText( bool doing ) const
+ {
+ string txt;
+ string d = dev.substr(12);
+ if( doing )
+ {
+ // displayed text during action, %1$s is replaced by partition name (e.g. pdc_dabaheedj1),
+ // %2$s is replaced by hexadecimal number (e.g. 8E)
+ txt = sformat( _("Setting type of multipath partition %1$s to %2$X"),
+ d.c_str(), id() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by partition name (e.g. pdc_dabaheedj1),
+ // %2$s is replaced by hexadecimal number (e.g. 8E)
+ txt = sformat( _("Set type of multipath partition %1$s to %2$X"),
+ d.c_str(), id() );
+ }
+ return( txt );
+ }
+
+void Dmmultipath::getInfo( DmmultipathInfo& tinfo ) const
+ {
+ DmPart::getInfo( info );
+ tinfo.p = info;
+ }
+
+namespace storage
+{
+
+std::ostream& operator<< (std::ostream& s, const Dmmultipath &p )
+ {
+ s << *(DmPart*)&p;
+ return( s );
+ }
+
+}
+
+bool Dmmultipath::equalContent( const Dmmultipath& rhs ) const
+ {
+ return( DmPart::equalContent(rhs) );
+ }
+
+void Dmmultipath::logDifference( const Dmmultipath& rhs ) const
+ {
+ DmPart::logDifference(rhs);
+ }
+
+Dmmultipath& Dmmultipath::operator= ( const Dmmultipath& rhs )
+ {
+ y2debug( "operator= from %s", rhs.nm.c_str() );
+ *((DmPart*)this) = rhs;
+ return( *this );
+ }
+
Added: branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.h?rev=50094&view=auto
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.h (added)
+++ branches/tmp/aschnell/multipath/libstorage/src/Dmmultipath.h Thu Aug 14 19:07:38 2008
@@ -0,0 +1,38 @@
+#ifndef DMMULTIPATH_H
+#define DMMULTIPATH_H
+
+#include "y2storage/DmPart.h"
+
+namespace storage
+{
+
+class DmmultipathCo;
+class Partition;
+
+class Dmmultipath : public DmPart
+ {
+ public:
+ Dmmultipath( const DmmultipathCo& d, unsigned nr, Partition* p=NULL );
+ Dmmultipath( const DmmultipathCo& d, const Dmmultipath& rd );
+
+ virtual ~Dmmultipath();
+ void getInfo( storage::DmmultipathInfo& info ) const;
+ friend std::ostream& operator<< (std::ostream& s, const Dmmultipath &p );
+ virtual void print( std::ostream& s ) const { s << *this; }
+ string removeText( bool doing ) const;
+ string createText( bool doing ) const;
+ string formatText( bool doing ) const;
+ string resizeText( bool doing ) const;
+ string setTypeText( bool doing=true ) const;
+ bool equalContent( const Dmmultipath& rhs ) const;
+ void logDifference( const Dmmultipath& d ) const;
+ static bool notDeleted( const Dmmultipath& l ) { return( !l.deleted() ); }
+
+ protected:
+ virtual const string shortPrintedName() const { return( "Dmmultipath" ); }
+ Dmmultipath& operator=( const Dmmultipath& );
+ };
+
+}
+
+#endif
Added: branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc?rev=50094&view=auto
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc (added)
+++ branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc Thu Aug 14 19:07:38 2008
@@ -0,0 +1,206 @@
+/*
+ Textdomain "storage"
+*/
+
+#include <iostream>
+#include <sstream>
+
+#include "y2storage/DmmultipathCo.h"
+#include "y2storage/Dmmultipath.h"
+#include "y2storage/SystemCmd.h"
+#include "y2storage/AppUtil.h"
+#include "y2storage/Storage.h"
+#include "y2storage/StorageDefines.h"
+
+using namespace std;
+using namespace storage;
+
+DmmultipathCo::DmmultipathCo( Storage * const s, const string& Name, ProcPart& ppart ) :
+ DmPartCo(s, "/dev/mapper/"+Name, staticType(), ppart )
+ {
+ DmPartCo::init( ppart );
+ getMultipathData( Name );
+ y2debug( "constructing dmmultipath co %s", Name.c_str() );
+ }
+
+DmmultipathCo::~DmmultipathCo()
+ {
+ y2debug( "destructed multipath co %s", dev.c_str() );
+ }
+
+void DmmultipathCo::getMultipathData( const string& name )
+ {
+ y2milestone( "name:%s", name.c_str() );
+ SystemCmd c(MULTIPATHBIN " -s -c -c -c " + quote(name));
+ list<string>::const_iterator ci;
+ list<string> sl;
+ if( c.numLines()>0 )
+ sl = splitString( *c.getLine(0), ":" );
+ Pv *pve = new Pv;
+ if( sl.size()>=4 )
+ {
+ ci = sl.begin();
+ ++ci; ++ci; ++ci;
+ }
+ unsigned num = 1;
+ while( num=3 )
+ {
+ ci = sl.begin();
+ ++ci; ++ci;
+ if( *ci == name )
+ {
+ --ci;
+ --ci;
+ if( ci->find( "/dev/" )==0 )
+ {
+ pve->device = *ci;
+ addPv( pve );
+ }
+ }
+ }
+ ++num;
+ }
+ delete( pve );
+ }
+
+void
+DmmultipathCo::setUdevData( const string& id )
+ {
+ y2milestone( "disk %s id %s", nm.c_str(), id.c_str() );
+ udev_id.clear();
+ udev_id = splitString( id );
+ udev_id.erase( remove_if(udev_id.begin(), udev_id.end(),
+ find_begin("dm-uuid-dmmultipath")));
+ udev_id.sort();
+ y2mil( "id:" << udev_id );
+ DmmultipathPair pp = dmmultipathPair();
+ for( DmmultipathIter p=pp.begin(); p!=pp.end(); ++p )
+ {
+ p->addUdevData();
+ }
+ }
+
+void
+DmmultipathCo::newP( DmPart*& dm, unsigned num, Partition* p )
+ {
+ y2mil( "num:" << num );
+ dm = new Dmmultipath( *this, num, p );
+ }
+
+void DmmultipathCo::addPv( Pv*& p )
+ {
+ PeContainer::addPv( p );
+ if( !deleted() )
+ getStorage()->setUsedBy( p->device, UB_DMMULTIPATH, name() );
+ p = new Pv;
+ }
+
+void DmmultipathCo::activate( bool val )
+ {
+ y2milestone( "old active:%d val:%d", active, val );
+ if( active != val )
+ {
+ SystemCmd c;
+ if( val )
+ {
+ Dm::activate(true);
+ c.execute(MULTIPATHBIN " -ay -p");
+ }
+ else
+ {
+ c.execute(MULTIPATHBIN " -an");
+ }
+ active = val;
+ }
+ }
+
+void DmmultipathCo::getMultipaths( list<string>& l )
+ {
+ l.clear();
+ SystemCmd c(MULTIPATHBIN " -s -c -c -c");
+ for( unsigned i=0; i=3 )
+ {
+ list<string>::const_iterator ci = sl.begin();
+ if( !ci->empty()
+ && ci->find( "/dev/" )==string::npos
+ && find( l.begin(), l.end(), *ci )==l.end())
+ {
+ l.push_back( *ci );
+ }
+ }
+ }
+ y2mil( "detected Multipaths " << l );
+ }
+
+
+string DmmultipathCo::setDiskLabelText( bool doing ) const
+ {
+ string txt;
+ string d = nm;
+ if( doing )
+ {
+ // displayed text during action, %1$s is replaced by multipath name (e.g. pdc_igeeeadj),
+ // %2$s is replaced by label name (e.g. msdos)
+ txt = sformat( _("Setting disk label of multipath %1$s to %2$s"),
+ d.c_str(), labelName().c_str() );
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by multipath name (e.g. pdc_igeeeadj),
+ // %2$s is replaced by label name (e.g. msdos)
+ txt = sformat( _("Set disk label of multipath %1$s to %2$s"),
+ d.c_str(), labelName().c_str() );
+ }
+ return( txt );
+ }
+
+
+void DmmultipathCo::getInfo( DmmultipathCoInfo& tinfo ) const
+ {
+ DmPartCo::getInfo( info );
+ tinfo.p = info;
+ }
+
+namespace storage
+{
+
+std::ostream& operator<< (std::ostream& s, const DmmultipathCo& d )
+{
+ s << *((DmPartCo*)&d);
+ return s;
+}
+
+}
+
+string DmmultipathCo::getDiffString( const Container& d ) const
+{
+ string log = DmPartCo::getDiffString(d);
+ return log;
+}
+
+bool DmmultipathCo::equalContent( const Container& rhs ) const
+{
+ bool ret = Container::equalContent(rhs);
+ if (ret)
+ {
+ const DmmultipathCo *p = dynamic_cast(&rhs);
+ ret = p && DmPartCo::equalContent( *p );
+ }
+ return ret;
+}
+
+DmmultipathCo::DmmultipathCo( const DmmultipathCo& rhs ) : DmPartCo(rhs)
+{
+}
+
+void DmmultipathCo::logData( const string& Dir ) {}
+
+bool DmmultipathCo::active = false;
+
Added: branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h?rev=50094&view=auto
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h (added)
+++ branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h Thu Aug 14 19:07:38 2008
@@ -0,0 +1,109 @@
+#ifndef DMMULTIPATH_CO_H
+#define DMMULTIPATH_CO_H
+
+#include <list>
+
+#include "y2storage/DmPartCo.h"
+#include "y2storage/Dmmultipath.h"
+
+namespace storage
+{
+
+class Storage;
+class SystemCmd;
+class ProcPart;
+class Region;
+
+class DmmultipathCo : public DmPartCo
+ {
+ friend class Storage;
+
+ public:
+ DmmultipathCo( Storage * const s, const string& Name, ProcPart& ppart );
+ DmmultipathCo( Storage * const s, const string& Name, unsigned num,
+ unsigned long long Size, ProcPart& ppart );
+ DmmultipathCo( const DmmultipathCo& rhs );
+ virtual ~DmmultipathCo();
+
+ static storage::CType staticType() { return storage::DMMULTIPATH; }
+ friend std::ostream& operator<< (std::ostream&, const DmmultipathCo& );
+ void getInfo( storage::DmmultipathCoInfo& info ) const;
+ void setUdevData( const string& id );
+
+ bool equalContent( const Container& rhs ) const;
+ string getDiffString( const Container& d ) const;
+ DmmultipathCo& operator= ( const DmmultipathCo& rhs );
+
+ protected:
+
+ // iterators over partitions
+ // protected typedefs for iterators over partitions
+ typedef CastIterator DmmultipathInter;
+ typedef CastIterator DmmultipathCInter;
+ template< class Pred >
+ struct DmmultipathPI { typedef ContainerIter type; };
+ template< class Pred >
+ struct DmmultipathCPI { typedef ContainerIter type; };
+ typedef CheckFnc<const Dmmultipath> CheckFncDmmultipath;
+ typedef CheckerIterator< CheckFncDmmultipath, DmmultipathPI<CheckFncDmmultipath>::type,
+ DmmultipathInter, Dmmultipath > DmmultipathPIterator;
+ typedef CheckerIterator< CheckFncDmmultipath, DmmultipathCPI<CheckFncDmmultipath>::type,
+ DmmultipathCInter, const Dmmultipath > DmmultipathCPIterator;
+ typedef DerefIterator DmmultipathIter;
+ typedef DerefIterator ConstDmmultipathIter;
+ typedef IterPair<DmmultipathIter> DmmultipathPair;
+ typedef IterPair<ConstDmmultipathIter> ConstDmmultipathPair;
+
+ DmmultipathPair dmmultipathPair( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL)
+ {
+ return( DmmultipathPair( dmmultipathBegin( CheckDmmultipath ), dmmultipathEnd( CheckDmmultipath ) ));
+ }
+ DmmultipathIter dmmultipathBegin( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL)
+ {
+ IterPair<DmmultipathInter> p( (DmmultipathInter(begin())), (DmmultipathInter(end())) );
+ return( DmmultipathIter( DmmultipathPIterator( p, CheckDmmultipath )) );
+ }
+ DmmultipathIter dmmultipathEnd( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL)
+ {
+ IterPair<DmmultipathInter> p( (DmmultipathInter(begin())), (DmmultipathInter(end())) );
+ return( DmmultipathIter( DmmultipathPIterator( p, CheckDmmultipath, true )) );
+ }
+
+ ConstDmmultipathPair dmmultipathPair( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL) const
+ {
+ return( ConstDmmultipathPair( dmmultipathBegin( CheckDmmultipath ), dmmultipathEnd( CheckDmmultipath ) ));
+ }
+ ConstDmmultipathIter dmmultipathBegin( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL) const
+ {
+ IterPair<DmmultipathCInter> p( (DmmultipathCInter(begin())), (DmmultipathCInter(end())) );
+ return( ConstDmmultipathIter( DmmultipathCPIterator( p, CheckDmmultipath )) );
+ }
+ ConstDmmultipathIter dmmultipathEnd( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL) const
+ {
+ IterPair<DmmultipathCInter> p( (DmmultipathCInter(begin())), (DmmultipathCInter(end())) );
+ return( ConstDmmultipathIter( DmmultipathCPIterator( p, CheckDmmultipath, true )) );
+ }
+
+ DmmultipathCo( Storage * const s, const string& File );
+ virtual void print( std::ostream& s ) const { s << *this; }
+ virtual Container* getCopy() const { return( new DmmultipathCo( *this ) ); }
+ static void activate( bool val );
+ void getMultipathData( const string& name );
+ void addMultipath( const string& name );
+ void addPv( Pv*& p );
+ void newP( DmPart*& dm, unsigned num, Partition* p );
+ string setDiskLabelText( bool doing ) const;
+
+ static string undevName( const string& name );
+
+ static void getMultipaths( std::list<string>& l );
+ static bool multipathNotDeleted( const Dmmultipath&d ) { return( !d.deleted() ); }
+
+ void logData( const string& Dir );
+
+ static bool active;
+ };
+
+}
+
+#endif
Modified: branches/tmp/aschnell/multipath/libstorage/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Makefile.am?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Makefile.am (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Makefile.am Thu Aug 14 19:07:38 2008
@@ -30,7 +30,8 @@
PeContainer.cc PeContainer.h \
LvmVg.cc LvmVg.h \
DmPartCo.cc DmPartCo.h \
- DmraidCo.cc DmraidCo.h \
+ DmraidCo.cc DmraidCo.h \
+ DmmultipathCo.cc DmmultipathCo.h \
DmCo.cc DmCo.h \
MdCo.cc MdCo.h \
LoopCo.cc LoopCo.h \
@@ -40,7 +41,8 @@
Dm.cc Dm.h \
LvmLv.cc LvmLv.h \
DmPart.cc DmPart.h \
- Dmraid.cc Dmraid.h \
+ Dmraid.cc Dmraid.h \
+ Dmmultipath.cc Dmmultipath.h \
Md.cc Md.h \
Loop.cc Loop.h \
Nfs.cc Nfs.h \
Modified: branches/tmp/aschnell/multipath/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Storage.cc?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Storage.cc (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Storage.cc Thu Aug 14 19:07:38 2008
@@ -1338,7 +1338,7 @@
ret = STORAGE_REMOVE_PARTITION_INVALID_CONTAINER;
}
}
- else if( cont->type()==DMRAID )
+ else if( cont->type()==DMRAID || cont->type()==DMMULTIPATH )
{
DmPartCo* disk = dynamic_cast(&(*cont));
if( disk!=NULL )
@@ -1403,7 +1403,7 @@
ret = STORAGE_CHANGE_AREA_INVALID_CONTAINER;
}
}
- else if( cont->type()==DMRAID )
+ else if( cont->type()==DMRAID || cont->type()==DMMULTIPATH )
{
DmPartCo* disk = dynamic_cast(&(*cont));
if( disk!=NULL )
@@ -1458,7 +1458,7 @@
ret = STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER;
}
}
- else if( cont->type()==DMRAID )
+ else if( cont->type()==DMRAID || cont->type()==DMMULTIPATH )
{
DmPartCo* disk = dynamic_cast(&(*cont));
if( disk!=NULL )
@@ -1530,7 +1530,7 @@
ret = STORAGE_RESIZE_INVALID_CONTAINER;
}
}
- else if( cont->type()==DMRAID )
+ else if( cont->type()==DMRAID || cont->type()==DMMULTIPATH )
{
DmPartCo* disk = dynamic_cast(&(*cont));
DmPart* p = dynamic_cast(&(*vol));
@@ -1588,7 +1588,7 @@
ret = STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER;
}
}
- else if( cont->type()==DMRAID )
+ else if( cont->type()==DMRAID || cont->type()==DMMULTIPATH )
{
DmPartCo* disk = dynamic_cast(&(*cont));
if( disk!=NULL )
@@ -3710,9 +3710,10 @@
static bool isDmContainer( const Container& co )
- {
- return co.type()==DM || co.type()==LVM || co.type()==DMRAID;
- }
+{
+ return co.type()==DM || co.type()==LVM || co.type()==DMRAID || co.type()==DMMULTIPATH;
+}
+
bool Storage::removeDmMapsTo( const string& dev )
{
@@ -4121,6 +4122,39 @@
}
+int
+Storage::getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info )
+{
+ int ret = 0;
+ assertInit();
+ DmmultipathCoIterator i = findDmmultipathCo( name );
+ if( i != dmmCoEnd() )
+ {
+ i->getInfo( info );
+ }
+ else
+ ret = STORAGE_DMMULTIPATH_CO_NOT_FOUND;
+ return( ret );
+}
+
+int
+Storage::getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
+ DmmultipathCoInfo& info )
+{
+ int ret = 0;
+ assertInit();
+ DmmultipathCoIterator i = findDmmultipathCo( name );
+ if( i != dmmCoEnd() )
+ {
+ ((const Container*)&(*i))->getInfo( cinfo );
+ i->getInfo( info );
+ }
+ else
+ ret = STORAGE_DMMULTIPATH_CO_NOT_FOUND;
+ return( ret );
+}
+
+
int Storage::getMdInfo( dequestorage::MdInfo& plist )
{
int ret = 0;
@@ -4198,6 +4232,30 @@
return( ret );
}
+
+int
+Storage::getDmmultipathInfo( const string& name,
+ dequestorage::DmmultipathInfo& plist )
+{
+ int ret = 0;
+ plist.clear();
+ assertInit();
+ DmmultipathCoIterator i = findDmmultipathCo( name );
+ if( i != dmmCoEnd() )
+ {
+ DmmultipathCo::DmmultipathPair p = i->dmmultipathPair(DmmultipathCo::multipathNotDeleted);
+ for( DmmultipathCo::DmmultipathIter i2 = p.begin(); i2 != p.end(); ++i2 )
+ {
+ plist.push_back( DmmultipathInfo() );
+ i2->getInfo( plist.back() );
+ }
+ }
+ else
+ ret = STORAGE_DMMULTIPATH_CO_NOT_FOUND;
+ return( ret );
+}
+
+
string Storage::getAllUsedFs() const
{
list<FsType> fs;
@@ -4763,6 +4821,17 @@
return( ret );
}
+Storage::DmmultipathCoIterator Storage::findDmmultipathCo( const string& name )
+ {
+ assertInit();
+ DmmultipathCoPair p = dmmCoPair();
+ DmmultipathCoIterator ret=p.begin();
+ string tname = DmPartCo::undevName(name);
+ while( ret!=p.end() && (ret->deleted() || ret->name()!=tname))
+ ++ret;
+ return( ret );
+ }
+
Storage::DmPartCoIterator Storage::findDmPartCo( const string& name )
{
assertInit();
@@ -4956,6 +5025,8 @@
case UB_DMRAID:
//ret = removeDmraidCo( name );
break;
+ case UB_DMMULTIPATH:
+ break;
case UB_NONE:
y2war(device << " used by none");
break;
Modified: branches/tmp/aschnell/multipath/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Storage.h?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Storage.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Storage.h Thu Aug 14 19:07:38 2008
@@ -16,6 +16,8 @@
#include "y2storage/LvmLv.h"
#include "y2storage/DmraidCo.h"
#include "y2storage/Dmraid.h"
+#include "y2storage/DmmultipathCo.h"
+#include "y2storage/Dmmultipath.h"
#include "y2storage/MdCo.h"
#include "y2storage/Md.h"
#include "y2storage/DmCo.h"
@@ -203,7 +205,7 @@
static SkipDeleted SkipDel;
static bool notDeleted( const Container&d ) { return( !d.deleted() ); };
static bool isDmPart( const Container&d )
- { return( d.type()==storage::DMRAID ); }
+ { return d.type() == storage::DMRAID || d.type() == storage::DMMULTIPATH; }
static void initDefaultLogger ();
@@ -263,6 +265,7 @@
int getDiskInfo( const string& disk, storage::DiskInfo& info);
int getLvmVgInfo( const string& name, storage::LvmVgInfo& info);
int getDmraidCoInfo( const string& name, storage::DmraidCoInfo& info);
+ int getDmmultipathCoInfo( const string& name, storage::DmmultipathCoInfo& info);
int getContDiskInfo( const string& disk, storage::ContainerInfo& cinfo,
storage::DiskInfo& info);
int getContLvmVgInfo( const string& name, storage::ContainerInfo& cinfo,
@@ -270,6 +273,9 @@
int getContDmraidCoInfo( const string& name,
storage::ContainerInfo& cinfo,
storage::DmraidCoInfo& info );
+ int getContDmmultipathCoInfo( const string& name,
+ storage::ContainerInfo& cinfo,
+ storage::DmmultipathCoInfo& info );
void getVolumes (dequestorage::VolumeInfo& vlist);
int getVolume( const string& device, storage::VolumeInfo& info);
int getPartitionInfo( const string& disk,
@@ -282,6 +288,8 @@
int getLoopInfo( dequestorage::LoopInfo& plist );
int getDmraidInfo( const string& name,
dequestorage::DmraidInfo& plist );
+ int getDmmultipathInfo( const string& name,
+ dequestorage::DmmultipathInfo& plist );
int getContVolInfo( const string& dev, ContVolInfo& info);
bool getFsCapabilities( storage::FsType fstype,
@@ -900,6 +908,90 @@
return( DmraidCoIterator( DmraidCoPIterator( p, CheckFnc, true )) );
}
+
+// iterators over DMMULTIPATH container
+ protected:
+ // protected typedefs for iterators over DMMULTIPATH container
+ typedef CastCheckIterator ContainerCDmmultipathIter;
+ template< class Pred >
+ struct ConstDmmultipathCoPI { typedef ContainerIter type; };
+ typedef CastCheckIterator ContainerDmmultipathIter;
+ template< class Pred >
+ struct DmmultipathCoPI { typedef ContainerIter type; };
+ template< class Pred >
+ struct DmmultipathCoI { typedef ContainerDerIter type; };
+ typedef CheckFnc<const DmmultipathCo> CheckFncDmmultipathCo;
+ typedef CheckerIterator< CheckFncDmmultipathCo, ConstDmmultipathCoPI<CheckFncDmmultipathCo>::type,
+ ContainerCDmmultipathIter, DmmultipathCo > ConstDmmultipathCoPIterator;
+ typedef CheckerIterator< CheckFncDmmultipathCo, DmmultipathCoPI<CheckFncDmmultipathCo>::type,
+ ContainerDmmultipathIter, DmmultipathCo > DmmultipathCoPIterator;
+ typedef DerefIterator DmmultipathCoIterator;
+ typedef IterPair<DmmultipathCoIterator> DmmultipathCoPair;
+
+ public:
+ // public typedefs for iterators over DMMULTIPATH container
+ typedef DerefIterator ConstDmmultipathCoIterator;
+ template< class Pred >
+ struct ConstDmmultipathCoI
+ { typedef ContainerDerIter type; };
+ template< class Pred >
+ struct DmmultipathCoCondIPair { typedef MakeCondIterPair type; };
+ typedef IterPair<ConstDmmultipathCoIterator> ConstDmmultipathCoPair;
+
+ // public member functions for iterators over DMMULTIPATH container
+ ConstDmmultipathCoPair dmmultipathCoPair( bool (* CheckFnc)( const DmmultipathCo& )=NULL ) const
+ {
+ return( ConstDmmultipathCoPair( dmmultipathCoBegin( CheckFnc ), dmmultipathCoEnd( CheckFnc ) ));
+ }
+ ConstDmmultipathCoIterator dmmultipathCoBegin( bool (* CheckFnc)( const DmmultipathCo& )=NULL ) const
+ {
+ IterPair<ContainerCDmmultipathIter> p( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
+ ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
+ return( ConstDmmultipathCoIterator( ConstDmmultipathCoPIterator( p, CheckFnc )) );
+ }
+ ConstDmmultipathCoIterator dmmultipathCoEnd( bool (* CheckFnc)( const DmmultipathCo& )=NULL ) const
+ {
+ IterPair<ContainerCDmmultipathIter> p( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
+ ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
+ return( ConstDmmultipathCoIterator( ConstDmmultipathCoPIterator( p, CheckFnc, true )) );
+ }
+ template< class Pred > typename DmmultipathCoCondIPair<Pred>::type dmmultipathCoCondPair( const Pred& p ) const
+ {
+ return( typename DmmultipathCoCondIPair<Pred>::type( dmmultipathCoCondBegin( p ), dmmultipathCoCondEnd( p ) ) );
+ }
+ template< class Pred > typename ConstDmmultipathCoI<Pred>::type dmmultipathCoCondBegin( const Pred& p ) const
+ {
+ IterPair<ContainerCDmmultipathIter> pair( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
+ ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
+ return( typename ConstDmmultipathCoI<Pred>::type( typename ConstDmmultipathCoPI<Pred>::type( pair, p )) );
+ }
+ template< class Pred > typename ConstDmmultipathCoI<Pred>::type dmmultipathCoCondEnd( const Pred& p ) const
+ {
+ IterPair<ContainerCDmmultipathIter> pair( ContainerCDmmultipathIter( cont.begin(), cont.end() ),
+ ContainerCDmmultipathIter( cont.begin(), cont.end(), true ));
+ return( typename ConstDmmultipathCoI<Pred>::type( typename ConstDmmultipathCoPI<Pred>::type( pair, p, true )) );
+ }
+ protected:
+ // protected member functions for iterators over DMMULTIPATH container
+ DmmultipathCoPair dmmCoPair( bool (* CheckFnc)( const DmmultipathCo& )=NULL )
+ {
+ return( DmmultipathCoPair( dmmCoBegin( CheckFnc ), dmmCoEnd( CheckFnc ) ));
+ }
+ DmmultipathCoIterator dmmCoBegin( bool (* CheckFnc)( const DmmultipathCo& )=NULL )
+ {
+ IterPair<ContainerDmmultipathIter> p( ContainerDmmultipathIter( cont.begin(), cont.end() ),
+ ContainerDmmultipathIter( cont.begin(), cont.end(), true ));
+ return( DmmultipathCoIterator( DmmultipathCoPIterator( p, CheckFnc )) );
+ }
+ DmmultipathCoIterator dmmCoEnd( bool (* CheckFnc)( const DmmultipathCo& )=NULL )
+ {
+ IterPair<ContainerDmmultipathIter> p( ContainerDmmultipathIter( cont.begin(), cont.end() ),
+ ContainerDmmultipathIter( cont.begin(), cont.end(), true ));
+ return( DmmultipathCoIterator( DmmultipathCoPIterator( p, CheckFnc, true )) );
+ }
+
+
// iterators over volumes
protected:
// protected typedefs for iterators over volumes
@@ -1467,6 +1559,80 @@
return( typename ConstDmraidI<Pred>::type( typename ConstDmraidPI<Pred>::type(pair, p, true )) );
}
+
+// iterators over dmmultipath devices
+ protected:
+ // protected typedefs for iterators over dmmultipath devices
+ typedef ListListIterator ConstDmmultipathInter;
+ typedef CastIterator ConstDmmultipathInter2;
+ template< class Pred >
+ struct ConstDmmultipathPI { typedef ContainerIter type; };
+ typedef CheckFnc<const Dmmultipath> CheckFncDmmultipath;
+ typedef CheckerIterator< CheckFncDmmultipath, ConstDmmultipathPI<CheckFncDmmultipath>::type,
+ ConstDmmultipathInter2, Dmmultipath > ConstDmmultipathPIterator;
+ public:
+ // public typedefs for iterators over dmmultipath volumes
+ template< class Pred >
+ struct ConstDmmultipathI
+ { typedef ContainerDerIter type; };
+ template< class Pred >
+ struct DmmultipathCondIPair
+ { typedef MakeCondIterPair type; };
+ typedef DerefIterator ConstDmmultipathIterator;
+ typedef IterPair<ConstDmmultipathIterator> ConstDmmultipathPair;
+
+ // public member functions for iterators over dmmultipath volumes
+ ConstDmmultipathPair dmmPair( bool (* CheckDmmultipathCo)( const DmmultipathCo& )) const
+ {
+ return( ConstDmmultipathPair( dmmBegin( CheckDmmultipathCo ), dmmEnd( CheckDmmultipathCo ) ));
+ }
+ ConstDmmultipathPair dmmPair( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL,
+ bool (* CheckDmmultipathCo)( const DmmultipathCo& )=NULL) const
+ {
+ return( ConstDmmultipathPair( dmmBegin( CheckDmmultipath, CheckDmmultipathCo ),
+ dmmEnd( CheckDmmultipath, CheckDmmultipathCo ) ));
+ }
+ ConstDmmultipathIterator dmmBegin( bool (* CheckDmmultipathCo)( const DmmultipathCo& )) const
+ {
+ return( dmmBegin( NULL, CheckDmmultipathCo ) );
+ }
+ ConstDmmultipathIterator dmmBegin( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL,
+ bool (* CheckDmmultipathCo)( const DmmultipathCo& )=NULL) const
+ {
+ IterPair<ConstDmmultipathInter2> p( (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ))),
+ (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ), true )));
+ return( ConstDmmultipathIterator( ConstDmmultipathPIterator(p, CheckDmmultipath )));
+ }
+ ConstDmmultipathIterator dmmEnd( bool (* CheckDmmultipathCo)( const DmmultipathCo& )) const
+ {
+ return( dmmEnd( NULL, CheckDmmultipathCo ) );
+ }
+ ConstDmmultipathIterator dmmEnd( bool (* CheckDmmultipath)( const Dmmultipath& )=NULL,
+ bool (* CheckDmmultipathCo)( const DmmultipathCo& )=NULL) const
+ {
+ IterPair<ConstDmmultipathInter2> p( (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ))),
+ (ConstDmmultipathInter(dmmultipathCoPair( CheckDmmultipathCo ), true )));
+ return( ConstDmmultipathIterator( ConstDmmultipathPIterator(p, CheckDmmultipath, true )));
+ }
+ template< class Pred > typename DmmultipathCondIPair<Pred>::type dmmCondPair( const Pred& p ) const
+ {
+ return( typename DmmultipathCondIPair<Pred>::type( dmmCondBegin( p ), dmmCondEnd( p ) ) );
+ }
+ template< class Pred > typename ConstDmmultipathI<Pred>::type dmmCondBegin( const Pred& p ) const
+ {
+ IterPair<ConstDmmultipathInter2> pair( (ConstDmmultipathInter( dmmultipathCoPair())),
+ (ConstDmmultipathInter( dmmultipathCoPair(), true )));
+ return( typename ConstDmmultipathI<Pred>::type( typename ConstDmmultipathPI<Pred>::type(pair, p) ) );
+ }
+ template< class Pred > typename ConstDmmultipathI<Pred>::type dmmCondEnd( const Pred& p ) const
+ {
+ IterPair<ConstDmmultipathInter2> pair( (ConstDmmultipathInter( dmmCoPair())),
+ (ConstDmmultipathInter( dmmCoPair(), true )));
+ return( typename ConstDmmultipathI<Pred>::type( typename ConstDmmultipathPI<Pred>::type(pair, p, true )) );
+ }
+
+
protected:
// protected internal member functions
void initialize();
@@ -1497,6 +1663,7 @@
DiskIterator findDiskPath( const string& path );
LvmVgIterator findLvmVg( const string& name );
DmraidCoIterator findDmraidCo( const string& name );
+ DmmultipathCoIterator findDmmultipathCo( const string& name );
DmPartCoIterator findDmPartCo( const string& name );
bool findVolume( const string& device, ContIterator& c,
VolIterator& v );
Modified: branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h Thu Aug 14 19:07:38 2008
@@ -112,9 +112,9 @@
enum MdParity { PAR_NONE, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC };
- enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_DM, UB_DMRAID };
+ enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_DM, UB_DMRAID, UB_DMMULTIPATH };
- enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC,
+ enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH,
COTYPE_LAST_ENTRY };
/**
@@ -231,6 +231,12 @@
DmPartCoInfo p;
};
+ struct DmmultipathCoInfo
+ {
+ DmmultipathCoInfo() {}
+ DmPartCoInfo p;
+ };
+
/**
* Contains info about a volume.
*/
@@ -394,6 +400,15 @@
};
/**
+ * Contains info about a DMMULTIPATH volume.
+ */
+ struct DmmultipathInfo
+ {
+ DmmultipathInfo() {}
+ DmPartInfo p;
+ };
+
+ /**
* Contains info about a DM volume.
*/
struct ContVolInfo
@@ -483,6 +498,7 @@
STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
STORAGE_DMRAID_CO_NOT_FOUND = -2028,
STORAGE_RESIZE_INVALID_CONTAINER = -2029,
+ STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
VOLUME_FSTAB_EMPTY_MOUNT = -3001,
@@ -712,6 +728,26 @@
DmraidCoInfo& info) = 0;
/**
+ * Query container info for a DMMULTIPATH container
+ *
+ * @param name name of container, e.g. pdc_ccaihgii
+ * @param info record that gets filled with DMMULTIPATH Container special data
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
+
+ /**
+ * Query container info for a DMMULTIPATH container
+ *
+ * @param name name of container, e.g. pdc_ccaihgii
+ * @param cinfo record that gets filled with container general data
+ * @param info record that gets filled with DMMULTIPATH Container special data
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
+ DmmultipathCoInfo& info) = 0;
+
+ /**
* Query all volumes found in system
*
* @param infos list of records that get filled with volume info
@@ -790,6 +826,16 @@
deque<DmraidInfo>& plist ) = 0;
/**
+ * Query infos for dmmultipath devices in system
+ *
+ * @param plist list of records that get filled with dmmultipath specific info
+ * @param name name of dmmultipath, e.g. pdc_igeeeadj
+ * @return zero if all is ok, a negative number to indicate an error
+ */
+ virtual int getDmmultipathInfo( const string& name,
+ deque<DmmultipathInfo>& plist ) = 0;
+
+ /**
* Query capabilities of a filesystem type.
*/
virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
Modified: branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.cc?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.cc (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.cc Thu Aug 14 19:07:38 2008
@@ -62,6 +62,7 @@
case UB_LVM:
case UB_MD:
case UB_DMRAID:
+ case UB_DMMULTIPATH:
return "/dev/" + ub_name;
case UB_DM:
@@ -89,6 +90,9 @@
case storage::UB_DMRAID:
st = "dmraid";
break;
+ case UB_DMMULTIPATH:
+ st = "dmmultipath";
+ break;
default:
st = "UNKNOWN";
break;
Modified: branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.h?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/StorageTypes.h Thu Aug 14 19:07:38 2008
@@ -15,12 +15,13 @@
static const int order[COTYPE_LAST_ENTRY] = {
0, // CUNKNOWN
1, // DISK
- 3, // MD
+ 4, // MD
7, // LOOP
- 5, // LVM
- 4, // DM
+ 6, // LVM
+ 5, // DM
2, // DMRAID
- 8 // NFSC
+ 8, // NFSC
+ 3 // DMMULTIPATH
};
bool ret = order[a] < order[b];
Modified: branches/tmp/aschnell/multipath/storage/src/include/ep-hd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/storage/src/include/ep-hd.ycp?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/storage/src/include/ep-hd.ycp (original)
+++ branches/tmp/aschnell/multipath/storage/src/include/ep-hd.ycp Thu Aug 14 19:07:38 2008
@@ -23,7 +23,7 @@
{
symbol Predicate(map disk, map partition)
{
- return StorageFields::PredicateDiskType(disk, partition, [`CT_DMRAID, `CT_DISK]);
+ return StorageFields::PredicateDiskType(disk, partition, [`CT_DMRAID, `CT_DMMULTIPATH, `CT_DISK]);
}
boolean IsAvailable ( string client )
Modified: branches/tmp/aschnell/multipath/storage/src/include/ep-main.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/storage/src/include/ep-main.ycp?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/storage/src/include/ep-main.ycp (original)
+++ branches/tmp/aschnell/multipath/storage/src/include/ep-main.ycp Thu Aug 14 19:07:38 2008
@@ -144,6 +144,7 @@
{
case `CT_DISK:
case `CT_DMRAID:
+ case `CT_DMMULTIPATH:
huhu(disk, `hd, $[ `create : CreateHdPartitionPanel, `handle : HandleHdPartitionPanel ],
$[ `create : CreateHdDiskPanel, `handle : HandleHdDiskPanel ]);
break;
Modified: branches/tmp/aschnell/multipath/storage/src/modules/Partitions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/storage/src/modules/Partitions.ycp?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/storage/src/modules/Partitions.ycp (original)
+++ branches/tmp/aschnell/multipath/storage/src/modules/Partitions.ycp Thu Aug 14 19:07:38 2008
@@ -56,6 +56,7 @@
global string dm_name = "DM";
global string loop_name = "Loop Device";
global string dmraid_name = "DM RAID";
+ global string dmmultipath_name = "DM Multipath";
global string nfs_name = "NFS";
// filesystems for /win
Modified: branches/tmp/aschnell/multipath/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/storage/src/modules/Storage.ycp?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/storage/src/modules/Storage.ycp (original)
+++ branches/tmp/aschnell/multipath/storage/src/modules/Storage.ycp Thu Aug 14 19:07:38 2008
@@ -56,6 +56,7 @@
import "LibStorage::DmInfo";
import "LibStorage::DmPartInfo";
import "LibStorage::DmraidInfo";
+ import "LibStorage::DmmultipathInfo";
import "LibStorage::NfsInfo";
import "LibStorage::ContainerInfo";
import "LibStorage::DiskInfo";
@@ -63,6 +64,7 @@
import "LibStorage::PartitionAddInfo";
import "LibStorage::DmPartCoInfo";
import "LibStorage::DmraidCoInfo";
+ import "LibStorage::DmmultipathCoInfo";
import "LibStorage::PartitionSlotInfo";
map conv_ctype =
@@ -73,6 +75,7 @@
LibStorage::LOOP() : `CT_LOOP,
LibStorage::LVM() : `CT_LVM,
LibStorage::DMRAID() : `CT_DMRAID,
+ LibStorage::DMMULTIPATH() : `CT_DMMULTIPATH,
LibStorage::DM() : `CT_DM,
LibStorage::NFSC() : `CT_NFS
]
@@ -84,6 +87,7 @@
"m" : $[ LibStorage::UB_LVM() : `UB_LVM,
LibStorage::UB_MD() : `UB_MD,
LibStorage::UB_DMRAID() : `UB_DMRAID,
+ LibStorage::UB_DMMULTIPATH() : `UB_DMMULTIPATH,
LibStorage::UB_DM() : `UB_DM
]
];
@@ -156,9 +160,8 @@
map DiskMapVersion = $[];
map DiskMap = $[];
map ClassifiedSettings = $[];
-map type_order = $[ `CT_DISK : 0, `CT_MD : 1, `CT_DMRAID : 2,
- `CT_LOOP : 3, `CT_DM : 4, `CT_LVM : 5,
- `CT_EVMS : 6, `CT_NFS : 7 ];
+map type_order = $[ `CT_DISK : 0, `CT_MD : 1, `CT_DMRAID : 2, `CT_DMMULTIPATH : 3,
+ `CT_LOOP : 4, `CT_DM : 5, `CT_LVM : 6, `CT_NFS : 7 ];
list<string> hw_packages = [];
list<string> no_propose_disks = nil;
boolean proposal_evms = false;
@@ -1588,6 +1591,31 @@
c["partitions"] = add( c["partitions"]:[], p );
});
}
+ else if( c["type"]:`CT_UNKNOWN == `CT_DMMULTIPATH )
+ {
+ list<any> pinfos = [];
+ any infos = LibStorage::DmmultipathCoInfo::new("LibStorage::DmmultipathCoInfo");
+ string d = c["device"]:"";
+ ret = LibStorage::StorageInterface::getDmmultipathCoInfo( sint, d, infos );
+ if( ret==0 )
+ {
+ any pinfo = LibStorage::DmmultipathCoInfo::swig_p_get( infos );
+ c = dmPartCoMap( pinfo, c );
+ }
+ else
+ y2warning( "disk \"%1\" ret:%2", c["device"]:"", ret );
+ c["partitions"] = [];
+ ret = LibStorage::StorageInterface::getDmmultipathInfo( sint, d, pinfos );
+ foreach( any info, pinfos,
+ ``{
+ any pinfo = LibStorage::DmmultipathInfo::swig_p_get( info );
+ map p = $[];
+ p = dmPartMap( pinfo, p );
+ p["fstype"] = Partitions::dmmultipath_name;
+ if( p["nr"]:-1 != 0 )
+ c["partitions"] = add( c["partitions"]:[], p );
+ });
+ }
else if( c["type"]:`CT_UNKNOWN == `CT_LVM )
{
list<any> pinfos = [];
@@ -3415,10 +3443,12 @@
return( rbool );
}
-global define boolean IsPartType( symbol t )
- {
- return( t==`CT_DMRAID || t==`CT_DISK );
- }
+
+global boolean IsPartType(symbol t)
+{
+ return t == `CT_DMRAID || t == `CT_DMMULTIPATH || t == `CT_DISK;
+}
+
global define boolean CreateAny( symbol ctype, map d, map& p )
{
@@ -4550,11 +4580,11 @@
*
* @struct entry ~ $[ "type" : ... ? ]
*/
-global define boolean IsPartitionable( map entry )
- {
- return( entry["type"]:`CT_UNKNOWN==`CT_DMRAID ||
- IsRealDisk( entry ) );
- }
+global boolean IsPartitionable( map entry )
+{
+ return entry["type"]:`CT_UNKNOWN==`CT_DMRAID || entry["type"]:`CT_UNKNOWN==`CT_DMMULTIPATH ||
+ IsRealDisk( entry );
+}
global define boolean DeviceRealDisk( string device )
``{
@@ -6184,6 +6214,7 @@
boolean need_md = false;
boolean need_lvm = false;
boolean need_dmraid = false;
+ boolean need_dmmultipath = false;
foreach( string k, map e, tg,
``{
if( size(filter( map p, e["partitions"]:[],
@@ -6195,9 +6226,11 @@
need_lvm = true;
if( e["type"]:`CT_UNKNOWN==`CT_DMRAID )
need_dmraid = true;
+ if( e["type"]:`CT_UNKNOWN==`CT_DMMULTIPATH )
+ need_dmmultipath = true;
});
- y2milestone( "FinishInstall need crypto:%1 md:%2 lvm:%3 dmraid:%4",
- need_crypt, need_md, need_lvm, need_dmraid );
+ y2milestone( "FinishInstall need crypto:%1 md:%2 lvm:%3 dmraid:%4 dmmultipath:%5",
+ need_crypt, need_md, need_lvm, need_dmraid, need_dmmultipath );
string cmd = "";
map bo = $[];
if( need_crypt )
@@ -6205,6 +6238,7 @@
CallInsserv( need_md, "md" );
CallInsserv( need_lvm, "lvm" );
CallInsserv( need_dmraid, "dmraid" );
+ CallInsserv( need_dmmultipath, "multipathd" );
y2milestone( "FinishInstall done" );
}
@@ -6968,7 +7002,7 @@
if( p["type"]:`unknown==`evms )
ret = d["is_container"]:false || p["evms_native"]:false;
else
- ret = d["type"]:`CT_UNKNONW==`CT_DMRAID ||
+ ret = d["type"]:`CT_UNKNONW==`CT_DMRAID || d["type"]:`CT_UNKNONW==`CT_DMMULTIPATH ||
size(d["udev_id"]:[])>0;
}
y2milestone( "IsPersistent device:%1 ret:%2", p["device"]:"", ret );
Modified: branches/tmp/aschnell/multipath/storage/src/modules/StorageFields.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/storage/src/modules/StorageFields.ycp?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/storage/src/modules/StorageFields.ycp (original)
+++ branches/tmp/aschnell/multipath/storage/src/modules/StorageFields.ycp Thu Aug 14 19:07:38 2008
@@ -25,8 +25,8 @@
*/
global void IterateTargetMap(map target_map, void(map, map) callback)
{
- const map disk_order = $[ `CT_DMRAID : 0, `CT_DISK : 1, `CT_MD : 2, `CT_LOOP : 3,
- `CT_LVM : 4, `CT_DM : 6, `CT_NFS : 7 ];
+ const map disk_order = $[ `CT_DMRAID : 0, `CT_DMMULTIPATH : 1, `CT_DISK : 2,
+ `CT_MD : 3, `CT_LOOP : 4, `CT_LVM : 5, `CT_DM : 6, `CT_NFS : 8 ];
list<string> keys = maplist(string dev, map disk, target_map, { return dev; });
keys = sort(string a, string b, keys, {
@@ -52,6 +52,8 @@
return "DM " + used_by;
case `UB_DMRAID:
return "RAID " + used_by;
+ case `UB_DMMULTIPATH:
+ return "Multipath " + used_by;
case `UB_MD:
return "RAID " + used_by;
default:
@@ -314,6 +316,10 @@
{
value = "BIOS RAID " + disk["name"]:"";
}
+ else if(disk["type"]:`CT_UNKNOWN==`CT_DMMULTIPATH)
+ {
+ value = "Multipath " + disk["name"]:"";
+ }
else
{
// label text
@@ -683,7 +689,7 @@
if (type == `CT_DISK && !real_disk)
return true;
- if (!contains([ `CT_DISK, `CT_DMRAID, `CT_LVM ], type))
+ if (!contains([ `CT_DISK, `CT_DMRAID, `CT_DMMULTIPATH, `CT_LVM ], type))
return true;
return false;
@@ -695,7 +701,7 @@
if (partition["fsid"]:0 == Partitions::fsid_mac_hidden)
return true;
- if (disk["used_by_type"]:`UB_NONE == `UB_DMRAID)
+ if (contains([ `UB_DMRAID, `UB_DMMULTIPATH ], disk["used_by_type"]:`UB_NONE))
return true;
return false;
Modified: branches/tmp/aschnell/multipath/yast2-storage.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/yast2-storage.spec.in?rev=50094&r1=50093&r2=50094&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/yast2-storage.spec.in (original)
+++ branches/tmp/aschnell/multipath/yast2-storage.spec.in Thu Aug 14 19:07:38 2008
@@ -3,7 +3,7 @@
@HEADER@
BuildRequires: blocxx-devel boost-devel gcc-c++ libxcrypt-devel openssl-devel sablot swig docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-testsuite yast2-perl-bindings
-Requires: parted yast2-storage-lib = %version yast2-perl-bindings mdadm lvm2 dmraid kpartx cryptsetup
+Requires: parted yast2-storage-lib = %version yast2-perl-bindings mdadm lvm2 dmraid multipath-tools kpartx cryptsetup
Requires: yast2-core >= 2.17.8
Requires: yast2 >= 2.17.3
Requires: yast2-libyui >= 2.17.5
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org