Author: fehr
Date: Mon Feb 25 17:41:53 2008
New Revision: 45000
URL: http://svn.opensuse.org/viewcvs/yast?rev=45000&view=rev
Log:
ignore EVMS containers with erroneous devices (#360075)
Modified:
trunk/storage/libstorage/src/EvmsCo.cc
trunk/storage/libstorage/src/EvmsCo.h
trunk/storage/libstorage/src/Storage.cc
trunk/storage/package/yast2-storage.changes
Modified: trunk/storage/libstorage/src/EvmsCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/EvmsCo.cc?rev=45000&r1=44999&r2=45000&view=diff
==============================================================================
--- trunk/storage/libstorage/src/EvmsCo.cc (original)
+++ trunk/storage/libstorage/src/EvmsCo.cc Mon Feb 25 17:41:53 2008
@@ -40,10 +40,13 @@
init();
container = true;
lvm1 = cont.lvm1;
- getCoData( cont.name, data, false );
- EvmsPair p=evmsPair(lvNotCreated);
- if( !p.empty() )
- getStorage()->waitForDevice( p.begin()->device() );
+ valid = getCoData( cont.name, data, false );
+ if( valid )
+ {
+ EvmsPair p=evmsPair(lvNotCreated);
+ if( !p.empty() )
+ getStorage()->waitForDevice( p.begin()->device() );
+ }
}
EvmsCo::EvmsCo( Storage * const s, const string& name, bool lv1 ) :
@@ -584,9 +587,10 @@
return( ret );
}
-void EvmsCo::getCoData( const string& name, const EvmsTree& data, bool check )
+bool EvmsCo::getCoData( const string& name, const EvmsTree& data, bool check )
{
y2milestone( "name:%s check:%d", name.c_str(), check );
+ bool ret = true;
list<EvmsCont>::const_iterator co=data.cont.begin();
while( co!=data.cont.end() && name!=co->name )
++co;
@@ -607,38 +611,95 @@
pe_size = co->peSize;
num_pe = co->sizeK/pe_size;
free_pe = co->free/pe_size;
- for( list<unsigned>::const_iterator i=co->creates.begin();
- i!=co->creates.end(); ++i )
+ listEvmsCont::peinfo::const_iterator i=co->consumes.begin();
+ string dev;
+ while( ret && i!=co->consumes.end() )
{
- map::const_iterator oi = data.objects.find( *i );
+ map::const_iterator oi = data.objects.find( i->id );
if( oi!=data.objects.end() )
{
- map::const_iterator mi =
- data.volumes.find( oi->second.vol );
- if( mi!=data.volumes.end() )
+ if( oi->second.vol>0 )
{
- addLv( mi->second.sizeK/pe_size, mi->second.name, mi->second.native );
+ map::const_iterator mi =
+ data.volumes.find( oi->second.vol );
+ if( mi!=data.volumes.end() )
+ {
+ dev = evmsToDev( mi->second.device );
+ ret = dev.find( "Error/" )==string::npos;
+ if( !ret )
+ y2mil( "err device:" << dev );
+ }
+ else
+ y2warning( "volume not found:%u", oi->second.vol );
}
else
- y2warning( "volume not found:%u", oi->second.vol );
+ {
+ dev = oi->second.name;
+ ret = dev.find( "Error/" )==string::npos;
+ if( !ret )
+ y2mil( "err device:" << dev );
+ }
}
else
- y2warning( "object not found:%u", *i );
+ y2warning( "object not found:%u", i->id );
+ ++i;
}
- for( listEvmsCont::peinfo::const_iterator i=co->consumes.begin();
- i!=co->consumes.end(); ++i )
+ if( !ret )
+ y2milestone( "container %s contains erroneous PVs", co->name.c_str() );
+ else
{
- map::const_iterator oi = data.objects.find( i->id );
- if( oi!=data.objects.end() )
+ for( list<unsigned>::const_iterator i=co->creates.begin();
+ i!=co->creates.end(); ++i )
{
- if( oi->second.vol>0 )
+ map::const_iterator oi =
+ data.objects.find( *i );
+ if( oi!=data.objects.end() )
{
map::const_iterator mi =
data.volumes.find( oi->second.vol );
if( mi!=data.volumes.end() )
{
+ addLv( mi->second.sizeK/pe_size, mi->second.name,
+ mi->second.native );
+ }
+ else
+ y2warning( "volume not found:%u", oi->second.vol );
+ }
+ else
+ y2warning( "object not found:%u", *i );
+ }
+ for( listEvmsCont::peinfo::const_iterator i=co->consumes.begin();
+ i!=co->consumes.end(); ++i )
+ {
+ map::const_iterator oi =
+ data.objects.find( i->id );
+ if( oi!=data.objects.end() )
+ {
+ if( oi->second.vol>0 )
+ {
+ map::const_iterator mi =
+ data.volumes.find( oi->second.vol );
+ if( mi!=data.volumes.end() )
+ {
+ Pv p;
+ p.device = evmsToDev( mi->second.device );
+ y2mil( "p.device:" << p.device );
+ p.status = "allocatable";
+ p.uuid = i->uuid;
+ p.num_pe = i->size;
+ p.free_pe = i->free;
+ addPv( &p );
+ }
+ else
+ y2warning( "volume not found:%u", oi->second.vol );
+ }
+ else
+ {
Pv p;
- p.device = evmsToDev( mi->second.device );
+ p.device = oi->second.name;
+ if( p.device.find( "md/" )==0 )
+ p.device.erase(0,3);
+ p.device = "/dev/" + p.device;
y2mil( "p.device:" << p.device );
p.status = "allocatable";
p.uuid = i->uuid;
@@ -646,66 +707,51 @@
p.free_pe = i->free;
addPv( &p );
}
- else
- y2warning( "volume not found:%u", oi->second.vol );
}
else
- {
- Pv p;
- p.device = oi->second.name;
- if( p.device.find( "md/" )==0 )
- p.device.erase(0,3);
- p.device = "/dev/" + p.device;
- y2mil( "p.device:" << p.device );
- p.status = "allocatable";
- p.uuid = i->uuid;
- p.num_pe = i->size;
- p.free_pe = i->free;
- addPv( &p );
- }
+ y2warning( "object not found:%u", i->id );
}
- else
- y2warning( "object not found:%u", i->id );
- }
-
- EvmsPair p=evmsPair(lvDeleted);
- for( EvmsIter i=p.begin(); i!=p.end(); ++i )
- {
- //cout << "Deleted:" << *i << endl;
- map pe_map = i->getPeMap();
- remLvPeDistribution( i->getLe(), pe_map, pv, pv_add );
- free_pe += i->getLe();
- }
- p=evmsPair(lvCreated);
- for( EvmsIter i=p.begin(); i!=p.end(); ++i )
- {
- //cout << "Created:" << *i << endl;
- map pe_map;
- if( addLvPeDistribution( i->getLe(), i->stripes(), pv, pv_add,
- pe_map ) == 0 )
- i->setPeMap( pe_map );
- free_pe -= i->getLe();
- }
- p=evmsPair(lvResized);
- for( EvmsIter i=p.begin(); i!=p.end(); ++i )
- {
- //cout << "Resized:" << *i << endl;
- map pe_map = i->getPeMap();
- long size_diff = i->getLe() - sizeToLe(i->origSizeK());
- if( size_diff>0 )
+ EvmsPair p=evmsPair(lvDeleted);
+ for( EvmsIter i=p.begin(); i!=p.end(); ++i )
{
- if( addLvPeDistribution( size_diff, i->stripes(), pv, pv_add,
+ //cout << "Deleted:" << *i << endl;
+ map pe_map = i->getPeMap();
+ remLvPeDistribution( i->getLe(), pe_map, pv, pv_add );
+ free_pe += i->getLe();
+ }
+ p=evmsPair(lvCreated);
+ for( EvmsIter i=p.begin(); i!=p.end(); ++i )
+ {
+ //cout << "Created:" << *i << endl;
+ map pe_map;
+ if( addLvPeDistribution( i->getLe(), i->stripes(), pv, pv_add,
pe_map ) == 0 )
i->setPeMap( pe_map );
+ free_pe -= i->getLe();
}
- else if( size_diff<0 )
+ p=evmsPair(lvResized);
+ for( EvmsIter i=p.begin(); i!=p.end(); ++i )
{
- if( remLvPeDistribution( -size_diff, pe_map, pv, pv_add )==0 )
- i->setPeMap( pe_map );
+ //cout << "Resized:" << *i << endl;
+ map pe_map = i->getPeMap();
+ long size_diff = i->getLe() - sizeToLe(i->origSizeK());
+ if( size_diff>0 )
+ {
+ if( addLvPeDistribution( size_diff, i->stripes(), pv,
+ pv_add, pe_map ) == 0 )
+ i->setPeMap( pe_map );
+ }
+ else if( size_diff<0 )
+ {
+ if( remLvPeDistribution( -size_diff, pe_map, pv, pv_add )==0 )
+ i->setPeMap( pe_map );
+ }
+ free_pe -= size_diff;
}
- free_pe -= size_diff;
}
}
+ y2milestone( "ret:%d", ret );
+ return( ret );
}
void EvmsCo::getNormalVolumes( const EvmsTree& data )
@@ -1050,6 +1096,7 @@
dev += "/" + nm;
normalizeDevice(dev);
lvm1 = container = false;
+ valid = true;
}
#define SOCKET_PATH "/var/lib/YaST2/socket_libstorage_evms"
@@ -1866,6 +1913,8 @@
s << *((PeContainer*)&d);
if( d.lvm1 )
s << " lvm1";
+ if( !d.valid )
+ s << " invalid";
s << " UUID:" << d.uuid;
s << " cont:" << d.container;
return( s );
@@ -1893,6 +1942,13 @@
else
log += " cont-->";
}
+ if( valid!=p->valid )
+ {
+ if( !p->valid )
+ log += " -->invalid";
+ else
+ log += " invalid-->";
+ }
if( uuid!=p->uuid )
log += " UUID:" + uuid + "-->" + p->uuid;
y2milestone( "%s", log.c_str() );
@@ -1941,7 +1997,8 @@
if( ret && p )
{
ret = PeContainer::equalContent(*p,false) &&
- uuid==p->uuid && lvm1==p->lvm1 && container==p->container;
+ uuid==p->uuid && lvm1==p->lvm1 && container==p->container &&
+ valid==p->valid;
}
if( ret && p )
{
@@ -1965,6 +2022,7 @@
y2debug( "constructed EvmsCo by copy constructor from %s", rhs.nm.c_str() );
uuid = rhs.uuid;
lvm1 = rhs.lvm1;
+ valid = rhs.valid;
container = rhs.container;
ConstEvmsPair p = rhs.evmsPair();
for( ConstEvmsIter i = p.begin(); i!=p.end(); ++i )
Modified: trunk/storage/libstorage/src/EvmsCo.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/EvmsCo.h?rev=45000&r1=44999&r2=45000&view=diff
==============================================================================
--- trunk/storage/libstorage/src/EvmsCo.h (original)
+++ trunk/storage/libstorage/src/EvmsCo.h Mon Feb 25 17:41:53 2008
@@ -92,6 +92,7 @@
unsigned numVol() const { return vols.size(); }
bool lvm2() const { return( !lvm1 ); }
bool isContainer() const { return( container ); }
+ bool isValid() const { return( valid ); }
static storage::CType staticType() { return storage::EVMS; }
friend std::ostream& operator<< (std::ostream&, const EvmsCo& );
@@ -182,7 +183,7 @@
EvmsCo( Storage * const s, const string& File, int );
- void getCoData( const string& name, const EvmsTree& data,
+ bool getCoData( const string& name, const EvmsTree& data,
bool check=false );
void getNormalVolumes( const EvmsTree& data );
void setUsed( const string& device, storage::UsedByType typ,
@@ -220,6 +221,7 @@
string uuid;
bool lvm1;
bool container;
+ bool valid;
static bool active;
static int sockfd;
mutable storage::EvmsCoInfo info;
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=45000&r1=44999&r2=45000&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Mon Feb 25 17:41:53 2008
@@ -613,11 +613,16 @@
{
y2mil( "EVMS Container:" << *i );
e = new EvmsCo( this, *i, data );
- EvmsCoIterator eco = findEvmsCo( i->name );
- if( eco != evCoEnd() )
- removeContainer( &(*eco) );
- addToList( e );
- e->checkConsistency();
+ if( e->isValid() )
+ {
+ EvmsCoIterator eco = findEvmsCo( i->name );
+ if( eco != evCoEnd() )
+ removeContainer( &(*eco) );
+ addToList( e );
+ e->checkConsistency();
+ }
+ else
+ delete( e );
}
}
}
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=45000&r1=44999&r2=45000&view=diff
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Mon Feb 25 17:41:53 2008
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Mon Feb 25 17:40:54 CET 2008 - fehr@suse.de
+
+- ignore EVMS containers with erroneous devices (#360075)
+
+-------------------------------------------------------------------
Tue Feb 19 19:55:06 CET 2008 - fehr@suse.de
- fix missing fstab handling during removal of partitions on
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org