Author: aschnell
Date: Fri Aug 15 16:40:57 2008
New Revision: 50131
URL: http://svn.opensuse.org/viewcvs/yast?rev=50131&view=rev
Log:
- backup commit
Modified:
branches/tmp/aschnell/multipath/libstorage/src/Disk.cc
branches/tmp/aschnell/multipath/libstorage/src/Disk.h
branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc
branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h
branches/tmp/aschnell/multipath/libstorage/src/Storage.cc
branches/tmp/aschnell/multipath/libstorage/src/Storage.h
branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h
Modified: branches/tmp/aschnell/multipath/libstorage/src/Disk.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Disk.cc?rev=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Disk.cc (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Disk.cc Fri Aug 15 16:40:57 2008
@@ -209,17 +209,6 @@
}
}
-void
-Disk::addMpAlias( const string& dev )
- {
- y2mil( "dev:" << dev );
- if( dev != device() &&
- find( mp_alias.begin(), mp_alias.end(), dev )==mp_alias.end() )
- {
- mp_alias.push_back( dev );
- y2mil( "mp_alias:" << mp_alias );
- }
- }
unsigned long long
Disk::cylinderToKb( unsigned long cylinder ) const
@@ -475,8 +464,6 @@
file << "UdevPath: " << udev_path << endl;
if( !udev_id.empty() )
file << "UdevId: " << udev_id << endl;
- if( !mp_alias.empty() )
- file << "MpAlias: " << mp_alias << endl;
file << "Major: " << mjr << endl;
file << "Minor: " << mnr << endl;
file << "Range: " << range << endl;
@@ -2628,8 +2615,6 @@
s << " UdevPath:" << d.udev_path;
if( !d.udev_id.empty() )
s << " UdevId:" << d.udev_id;
- if( !d.mp_alias.empty() )
- s << " MpAlias:" << d.mp_alias;
s << " MaxPrimary:" << d.max_primary;
if( d.ext_possible )
s << " ExtPossible MaxLogical:" << d.max_logical;
@@ -2783,7 +2768,6 @@
iscsi = rhs.iscsi;
udev_path = rhs.udev_path;
udev_id = rhs.udev_id;
- mp_alias = rhs.mp_alias;
logfile_name = rhs.logfile_name;
sysfs_dir = rhs.sysfs_dir;
dmp_slave = rhs.dmp_slave;
Modified: branches/tmp/aschnell/multipath/libstorage/src/Disk.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/Disk.h?rev=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Disk.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Disk.h Fri Aug 15 16:40:57 2008
@@ -48,9 +48,6 @@
const std::list<string>& udevId() const { return udev_id; }
void setSlave( bool val=true ) { dmp_slave=val; }
void setNumMinor( unsigned long val ) { range=val; }
- void addMpAlias( const string& dev );
- void clearMpAlias() { mp_alias.clear(); }
- const std::list<string>& mpAlias() const { return mp_alias; }
const string& sysfsDir() const { return sysfs_dir; }
unsigned numPartitions() const;
bool isDasd() const { return( nm.find("dasd")==0 ); }
@@ -218,7 +215,6 @@
string label;
string udev_path;
std::list<string> udev_id;
- std::list<string> mp_alias;
string detected_label;
string system_stderr;
string logfile_name;
Modified: branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc?rev=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.cc Fri Aug 15 16:40:57 2008
@@ -4,6 +4,8 @@
#include <iostream>
#include <sstream>
+#include <locale>
+#include
#include "y2storage/DmmultipathCo.h"
#include "y2storage/Dmmultipath.h"
@@ -15,57 +17,70 @@
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() );
- }
+ y2deb("constructing dmmultipath co " << Name);
+}
+
DmmultipathCo::~DmmultipathCo()
- {
- y2debug( "destructed multipath co %s", dev.c_str() );
- }
+{
+ y2deb("destructed multipath co " << dev);
+}
+
+
+void
+DmmultipathCo::getMultipathData(const string& name)
+{
+ y2mil("name:" << name);
+ SystemCmd c(MULTIPATHBIN " -d -v 2+ -ll " + quote(name));
-void DmmultipathCo::getMultipathData( const string& name )
+ if (c.numLines() > 0)
{
- 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 )
+ string line = *c.getLine(0);
+ y2mil("line:" << line);
+ list<string> tmp = splitString(extractNthWord(1, line, true), ",");
+ if (tmp.size() >= 2)
{
- ci = sl.begin();
- ++ci; ++ci; ++ci;
+ list<string>::const_iterator it = tmp.begin();
+ vendor = boost::trim_copy(*it++, locale::classic());
+ model = boost::trim_copy(*it++, locale::classic());
}
- unsigned num = 1;
- while( num=3 )
+ string line = *c.getLine(i);
+ if (line.find( " \\_" ) == 0)
{
- ci = sl.begin();
- ++ci; ++ci;
- if( *ci == name )
- {
- --ci;
- --ci;
- if( ci->find( "/dev/" )==0 )
- {
- pve->device = *ci;
- addPv( pve );
- }
- }
+ y2mil( "mp element:" << line );
+ string dev = extractNthWord(3,line);
+ if (find(devs.begin(), devs.end(), dev) == devs.end())
+ devs.push_back(dev);
}
- ++num;
}
- delete( pve );
+
+ y2mil("devs:" << devs);
+
+ Pv *pv = new Pv;
+ for (list<string>::const_iterator it = devs.begin(); it != devs.end(); it++)
+ {
+ pv->device = *it;
+ addPv(pv);
+ }
+ delete pv;
}
+}
+
void
DmmultipathCo::setUdevData( const string& id )
@@ -74,7 +89,7 @@
udev_id.clear();
udev_id = splitString( id );
udev_id.erase( remove_if(udev_id.begin(), udev_id.end(),
- find_begin("dm-uuid-dmmultipath")));
+ find_begin("dm-uuid-mpath")));
udev_id.sort();
y2mil( "id:" << udev_id );
DmmultipathPair pp = dmmultipathPair();
@@ -91,54 +106,86 @@
dm = new Dmmultipath( *this, num, p );
}
-void DmmultipathCo::addPv( Pv*& p )
- {
- PeContainer::addPv( p );
- if( !deleted() )
- getStorage()->setUsedBy( p->device, UB_DMMULTIPATH, name() );
+
+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 )
- {
+
+void DmmultipathCo::activate(bool val)
+{
y2milestone( "old active:%d val:%d", active, val );
- if( active != val )
- {
+ if (active != val)
+ {
SystemCmd c;
- if( val )
- {
+ if (val)
+ {
Dm::activate(true);
- c.execute(MULTIPATHBIN " -ay -p");
- }
+ c.execute("/etc/init.d/multipathd start");
+ }
else
- {
- c.execute(MULTIPATHBIN " -an");
- }
- active = val;
+ {
+ c.execute("/etc/init.d/multipathd stop");
}
+ active = val;
}
+}
-void DmmultipathCo::getMultipaths( list<string>& l )
- {
+
+void
+DmmultipathCo::getMultipaths( list<string>& l )
+{
l.clear();
- SystemCmd c(MULTIPATHBIN " -s -c -c -c");
- for( unsigned i=0; i=3 )
+ if( line.find( " \\_" )==0 )
{
- 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( "mp element:" << line );
+ string dev = extractNthWord(3,line);
+ if( find( mp_list.begin(), mp_list.end(), dev )== mp_list.end() )
+ mp_list.push_back(dev);
}
+ if( ++i 1)
+ {
+ l.push_back(unit);
}
- y2mil( "detected Multipaths " << l );
}
+ y2mil("ret:" << l);
+}
+
string DmmultipathCo::setDiskLabelText( bool doing ) const
{
@@ -166,14 +213,18 @@
{
DmPartCo::getInfo( info );
tinfo.p = info;
+ tinfo.vendor = vendor;
+ tinfo.model = model;
}
namespace storage
{
-std::ostream& operator<< (std::ostream& s, const DmmultipathCo& d )
+std::ostream& operator<<(std::ostream& s, const DmmultipathCo& d)
{
- s << *((DmPartCo*)&d);
+ s << *((DmPartCo*)&d);
+ s << " Vendor:" << d.vendor
+ << " Model:" << d.model;
return s;
}
@@ -182,6 +233,14 @@
string DmmultipathCo::getDiffString( const Container& d ) const
{
string log = DmPartCo::getDiffString(d);
+ const DmmultipathCo * p = dynamic_cast(&d);
+ if (p)
+ {
+ if (vendor != p->vendor)
+ log += " vendor:" + vendor + "-->" + p->vendor;
+ if (model != p->model)
+ log += " model:" + model + "-->" + p->model;
+ }
return log;
}
@@ -191,13 +250,16 @@
if (ret)
{
const DmmultipathCo *p = dynamic_cast(&rhs);
- ret = p && DmPartCo::equalContent( *p );
+ ret = p && DmPartCo::equalContent(*p) &&
+ vendor == p->vendor && model == p->model;
}
return ret;
}
DmmultipathCo::DmmultipathCo( const DmmultipathCo& rhs ) : DmPartCo(rhs)
{
+ vendor = rhs.vendor;
+ model = rhs.model;
}
void DmmultipathCo::logData( const string& Dir ) {}
Modified: branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h?rev=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/DmmultipathCo.h Fri Aug 15 16:40:57 2008
@@ -101,6 +101,9 @@
void logData( const string& Dir );
+ string vendor;
+ string model;
+
static bool active;
};
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=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Storage.cc (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Storage.cc Fri Aug 15 16:40:57 2008
@@ -237,6 +237,7 @@
}
detectMds();
detectDmraid( *ppart );
+ detectDmmultipath( *ppart );
detectLvmVgs();
detectDm( *ppart );
@@ -400,70 +401,9 @@
else if( autodetect )
{
autodetectDisks( ppart );
- detectMultipath();
}
}
-void
-Storage::detectMultipath()
- {
- bool acc_ok = access(MULTIPATHBIN, X_OK) == 0;
- y2mil( "detectMultipath acc_ok:" << acc_ok );
- if( acc_ok )
- {
- list<string> mp_list;
- string line;
- unsigned i=0;
- SystemCmd c(MULTIPATHBIN " -d -v 2+ -ll");
- if( i1 )
- {
- for( list<string>::const_iterator i=mp_list.begin();
- i!=mp_list.end(); ++i )
- {
- Storage::DiskIterator di = findDisk( *i );
- if( di != dEnd() )
- {
- di->clearMpAlias();
- for( list<string>::const_iterator j=mp_list.begin();
- j!=mp_list.end(); ++j )
- {
- if( i!=j )
- di->addMpAlias( *j );
- }
- }
- else
- y2war( "Disk not found:" << *i );
- }
- }
- }
- }
- }
void Storage::detectMds()
{
@@ -602,6 +542,50 @@
}
}
+
+void
+Storage::detectDmmultipath( ProcPart& ppart )
+{
+ if( test() )
+ {
+ glob_t globbuf;
+ if( glob( (testdir+"/dmmultipath_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
+ &globbuf) == 0)
+ {
+ // TODO
+ }
+ globfree (&globbuf);
+ }
+ else if( getenv( "YAST2_STORAGE_NO_DMMULTIPATH" )==NULL )
+ {
+ list<string> l;
+ map by_id;
+ DmmultipathCo::getMultipaths( l );
+ if( !l.empty() )
+ getFindMap( "/dev/disk/by-id", by_id, false );
+ for( list<string>::const_iterator i=l.begin(); i!=l.end(); ++i )
+ {
+ DmmultipathCo * v = new DmmultipathCo( this, *i, ppart );
+ if( v->isValid() )
+ {
+ /*
+ string nm = by_id["dm-"+decString(v->minorNr())];
+ if( !nm.empty() )
+ v->setUdevData( nm );
+ */
+ addToList( v );
+ }
+ else
+ {
+ y2mil("inactive DMMULTIPATH " << *i);
+ v->unuseDev();
+ delete v;
+ }
+ }
+ }
+}
+
+
void
Storage::detectDm( ProcPart& ppart )
{
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=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/Storage.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/Storage.h Fri Aug 15 16:40:57 2008
@@ -1644,6 +1644,7 @@
void detectNfs( ProcMounts& mounts );
void detectLvmVgs();
void detectDmraid( ProcPart& ppart );
+ void detectDmmultipath( ProcPart& ppart );
void detectDm( ProcPart& ppart );
void initDisk( DiskData& data, ProcPart& pp );
void detectFsData( const VolIterator& begin, const VolIterator& end,
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=50131&r1=50130&r2=50131&view=diff
==============================================================================
--- branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h (original)
+++ branches/tmp/aschnell/multipath/libstorage/src/StorageInterface.h Fri Aug 15 16:40:57 2008
@@ -235,6 +235,8 @@
{
DmmultipathCoInfo() {}
DmPartCoInfo p;
+ string vendor;
+ string model;
};
/**
@@ -730,7 +732,7 @@
/**
* Query container info for a DMMULTIPATH container
*
- * @param name name of container, e.g. pdc_ccaihgii
+ * @param name name of container, e.g. 3600508b400105f590000900000300000
* @param info record that gets filled with DMMULTIPATH Container special data
* @return zero if all is ok, a negative number to indicate an error
*/
@@ -739,7 +741,7 @@
/**
* Query container info for a DMMULTIPATH container
*
- * @param name name of container, e.g. pdc_ccaihgii
+ * @param name name of container, e.g. 3600508b400105f590000900000300000
* @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
@@ -829,7 +831,7 @@
* 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
+ * @param name name of dmmultipath, e.g. 3600508b400105f590000900000300000
* @return zero if all is ok, a negative number to indicate an error
*/
virtual int getDmmultipathInfo( const string& name,
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org