Author: aschnell Date: Tue Nov 3 11:02:03 2009 New Revision: 59268 URL: http://svn.opensuse.org/viewcvs/yast?rev=59268&view=rev Log: - simplified detection and removing now obsolete skipRAID() Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.h branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.h branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.h branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.cc Tue Nov 3 11:02:03 2009 @@ -25,7 +25,7 @@ dev = name; nm = undevName(name); num_part = num_pe = free_pe = 0; - active = valid = del_ptable = false; + active = del_ptable = false; disk = NULL; init( ppart ); } @@ -280,8 +280,12 @@ activate_part(true); } getVolumes( ppart ); - active = valid = true; + active = true; } + else + { + y2err("error dm " << nm << " table not found"); + } } void @@ -966,8 +970,6 @@ s << " delPT"; if( !d.active ) s << " inactive"; - if( !d.valid ) - s << " invalid"; return( s ); } @@ -993,13 +995,6 @@ else log += " active-->"; } - if( valid!=p->valid ) - { - if( p->valid ) - log += " -->valid"; - else - log += " valid-->"; - } } return( log ); } @@ -1044,7 +1039,7 @@ bool DmPartCo::equalContent( const DmPartCo& rhs ) const { bool ret = PeContainer::equalContent(rhs,false) && - active==rhs.active && valid==rhs.valid && + active==rhs.active && del_ptable==rhs.del_ptable; if( ret ) { @@ -1067,7 +1062,6 @@ { y2deb("constructed DmPartCo by copy constructor from " << rhs.nm); active = rhs.active; - valid = rhs.valid; del_ptable = rhs.del_ptable; disk = NULL; if( rhs.disk ) Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/DmPartCo.h Tue Nov 3 11:02:03 2009 @@ -26,7 +26,6 @@ virtual ~DmPartCo(); unsigned long long sizeK() const { return size_k; } - unsigned isValid() const { return valid; } const string& labelName() const { return disk->labelName(); } const string& udevPath() const { return udev_path; } const std::list<string>& udevId() const { return udev_id; } @@ -173,7 +172,6 @@ Disk* disk; bool active; - bool valid; bool del_ptable; unsigned num_part; Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.cc Tue Nov 3 11:02:03 2009 @@ -157,10 +157,18 @@ } -void -DmmultipathCo::getMultipaths(list<string>& l) + bool + DmmultipathCo::isActivated(const string& name) + { + SystemCmd c(DMSETUPBIN " table " + quote(name)); + return c.retcode() == 0 && c.numLines() >= 1 && isdigit(c.stdout()[0]); + } + + +list<string> +DmmultipathCo::getMultipaths() { - l.clear(); + list<string> l; SystemCmd c(MULTIPATHBIN " -d -v 2+ -ll"); if (c.numLines() > 0) @@ -198,9 +206,17 @@ line = *c.getLine(i); } y2mil( "mp_list:" << mp_list ); + if (mp_list.size() >= 1) { - l.push_back(unit); + if (isActivated(unit)) + { + l.push_back(unit); + } + else + { + y2mil("ignoring inactive dmmultipath " << unit); + } } } @@ -209,6 +225,7 @@ } y2mil("detected multipaths " << l); + return l; } Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/DmmultipathCo.h Tue Nov 3 11:02:03 2009 @@ -98,7 +98,9 @@ static void activate( bool val=true ); static bool isActive() { return active; } - static void getMultipaths( std::list<string>& l ); + static bool isActivated(const string& name); + static list<string> getMultipaths(); + static bool multipathNotDeleted( const Dmmultipath&d ) { return( !d.deleted() ); } void logData( const string& Dir ); Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.cc Tue Nov 3 11:02:03 2009 @@ -128,55 +128,47 @@ } } -bool DmraidCo::skipRAID(const string& name) -{ - /* Example: - * isw_fgjagejdb_Vol0_R1:312576000:128:mirror:ok:0:2:0 - * Detect 'isw_' at position 0. - */ - if( name.find("isw_") == 0 ) - { - string::size_type pos = name.find(":"); - if( pos == string::npos ) - { - return false; - } - string raid = name.substr(0,pos); - y2mil("Found isw raid: " << raid); - if( MdPartCo::isHandlingDev() == true || MdPartCo::isHandled(raid) == true) - { - return true; - } + + bool + DmraidCo::isActivated(const string& name) + { + SystemCmd c(DMSETUPBIN " table " + quote(name)); + return c.retcode() == 0 && c.numLines() >= 1 && isdigit(c.stdout()[0]); } - return false; -} -void DmraidCo::getRaids( list<string>& l ) -{ - l.clear(); - SystemCmd c(DMRAIDBIN " -s -c -c -c"); - for( unsigned i=0; i<c.numLines(); ++i ) - { - /* Skip Intel Software RAID */ - if( skipRAID(*c.getLine(i))) - { - y2mil("Detected Intel Software RAID: Skipping"); - continue; - } - - list<string> sl = splitString( *c.getLine(i), ":" ); - if( sl.size()>=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 ); - } - } + + list<string> + DmraidCo::getRaids() + { + list<string> l; + + SystemCmd c(DMRAIDBIN " -s -c -c -c"); + for( unsigned i=0; i<c.numLines(); ++i ) + { + list<string> sl = splitString( *c.getLine(i), ":" ); + if( sl.size()>=3 ) + { + list<string>::const_iterator ci = sl.begin(); + if( !ci->empty() + && ci->find( "/dev/" )==string::npos + && find( l.begin(), l.end(), *ci )==l.end()) + { + if (isActivated(*ci)) + { + l.push_back( *ci ); + } + else + { + y2mil("ignoring inactive dmraid " << *ci); + } + } + } + } + + y2mil("detected dmraids " << l); + return l; } -} + string DmraidCo::removeText( bool doing ) const { Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/DmraidCo.h Tue Nov 3 11:02:03 2009 @@ -97,10 +97,10 @@ static string undevName( const string& name ); - static void getRaids( std::list<string>& l ); + static bool isActivated(const string& name); + static list<string> getRaids(); + static bool raidNotDeleted( const Dmraid&d ) { return( !d.deleted() ); } - /* Skips some raid: currently ISW - Intel Software RAID */ - static bool skipRAID(const string& name); int doRemove(); Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.cc Tue Nov 3 11:02:03 2009 @@ -25,7 +25,6 @@ Textdomain "storage" */ -//#include <iostream> #include <sstream> #include "y2storage/MdPart.h" Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPart.h Tue Nov 3 11:02:03 2009 @@ -17,11 +17,10 @@ * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * */ -#ifndef MDPART_H_ -#define MDPART_H_ +#ifndef MD_PART_H +#define MD_PART_H #include "y2storage/Md.h" #include "y2storage/Partition.h" @@ -72,4 +71,4 @@ } -#endif /* MDPART_H_ */ +#endif Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc Tue Nov 3 11:02:03 2009 @@ -24,17 +24,14 @@ Textdomain "storage" */ -#include <iostream> #include <sstream> - #include <unistd.h> #include <string> #include <sys/stat.h> #include <sys/types.h> #include <dirent.h> - #include "y2storage/MdPartCo.h" #include "y2storage/MdPart.h" #include "y2storage/ProcPart.h" @@ -59,7 +56,7 @@ getMajorMinor(); - active = valid = del_ptable = false; + active = del_ptable = false; disk = NULL; y2mil("MdPartCo::nm=" << nm <<", dev=" << dev); @@ -375,7 +372,7 @@ y2mil( " nm:" << nm << " size_k:" << size_k); createDisk( ppart ); getVolumes( ppart ); - active = valid = true; + active = true; } void @@ -1105,8 +1102,6 @@ s << " delPT"; if( !d.active ) s << " inactive"; - if( !d.valid ) - s << " invalid"; return( s ); } @@ -1132,13 +1127,6 @@ else log += " active-->"; } - if( valid!=p->valid ) - { - if( p->valid ) - log += " -->valid"; - else - log += " valid-->"; - } } return( log ); } @@ -1224,7 +1212,7 @@ { const MdPartCo* mdp = dynamic_cast<const MdPartCo*>(&rhs); ret = ret && - active==mdp->active && valid==mdp->valid && + active==mdp->active && del_ptable==mdp->del_ptable; ret = ret && @@ -1261,7 +1249,6 @@ { y2deb("constructed MdPartCo by copy constructor from " << rhs.nm); active = rhs.active; - valid = rhs.valid; del_ptable = rhs.del_ptable; chunk_size = rhs.chunk_size; md_type = rhs.md_type; Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h Tue Nov 3 11:02:03 2009 @@ -18,11 +18,10 @@ * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * */ -#ifndef MDPARTCO_H_ -#define MDPARTCO_H_ +#ifndef MD_PART_CO_H +#define MD_PART_CO_H #include <list> @@ -59,7 +58,6 @@ unsigned long long sizeK() const { return size_k; } - unsigned isValid() const { return valid; } const string& labelName() const { return disk->labelName(); } const string& udevPath() const { return udev_path; } const std::list<string>& udevId() const { return udev_id; } @@ -285,10 +283,7 @@ std::list<string> udev_id; string logfile_name; - - Disk* disk; - bool valid; bool del_ptable; unsigned num_part; @@ -369,4 +364,5 @@ static list<string> devHandled; }; } -#endif /* MDPARTCO_H_ */ + +#endif Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage... ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/Storage.cc Tue Nov 3 11:02:03 2009 @@ -466,19 +466,11 @@ { y2mil(" Md Part Co :" << *i); MdPartCo * v = new MdPartCo( this, *i, &ppart ); - if( v->isValid() ) - { //list<string> nm = by_id["dm-"+decString(v->minorNr())]; // if( !nm.empty() ) // v->setUdevData( nm ); y2mil("Container is valid. Adding."); addToList( v ); - } - else - { - y2mil( "Invalid MD : " << *i ); - delete( v ); - } } } } @@ -721,8 +713,7 @@ } else if( getenv( "YAST2_STORAGE_NO_DMRAID" )==NULL ) { - list<string> l; - DmraidCo::getRaids(l); + const list<string> l = DmraidCo::getRaids(); if (!l.empty()) { map<string, list<string>> by_id; @@ -730,19 +721,10 @@ for( list<string>::const_iterator i=l.begin(); i!=l.end(); ++i ) { DmraidCo * v = new DmraidCo( this, *i, ppart ); - if( v->isValid() ) - { list<string> nm = by_id["dm-"+decString(v->minorNr())]; if( !nm.empty() ) v->setUdevData( nm ); addToList( v ); - } - else - { - y2milestone( "inactive DMRAID %s", i->c_str() ); - v->unuseDev(); - delete( v ); - } } } } @@ -764,8 +746,7 @@ } else if( getenv( "YAST2_STORAGE_NO_DMMULTIPATH" )==NULL ) { - list<string> l; - DmmultipathCo::getMultipaths(l); + const list<string> l = DmmultipathCo::getMultipaths(); if (!l.empty()) { map<string, list<string>> by_id; @@ -773,19 +754,10 @@ for( list<string>::const_iterator i=l.begin(); i!=l.end(); ++i ) { DmmultipathCo * v = new DmmultipathCo( this, *i, ppart ); - if( v->isValid() ) - { list<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; - } } } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org