Author: aschnell
Date: Tue Aug 5 14:52:54 2008
New Revision: 49709
URL: http://svn.opensuse.org/viewcvs/yast?rev=49709&view=rev
Log:
- more evms removal
Modified:
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/Storage.h
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=49709&r1=49708&r2=49709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Tue Aug 5 14:52:54 2008
@@ -1040,10 +1040,6 @@
else
{
ret = i->createPartition( type, start, size, device, true );
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device, type==EXTENDED );
- }
}
}
}
@@ -1058,12 +1054,6 @@
else
{
ret = i->createPartition( type, start, size, device, true );
- /*
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device, type==EXTENDED );
- }
- */
}
}
}
@@ -1111,10 +1101,6 @@
tmp_start = 0;
unsigned long start_cyl = i->kbToCylinder( tmp_start )+1;
ret = i->createPartition( type, start_cyl, num_cyl, device, true );
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device, type==EXTENDED );
- }
}
}
}
@@ -1136,12 +1122,6 @@
tmp_start = 0;
unsigned long start_cyl = i->kbToCylinder( tmp_start )+1;
ret = i->createPartition( type, start_cyl, num_cyl, device, true );
- /*
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device, type==EXTENDED );
- }
- */
}
}
}
@@ -1177,10 +1157,6 @@
{
unsigned long num_cyl = i->kbToCylinder( sizeK );
ret = i->createPartition( num_cyl, device, true );
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device );
- }
}
}
}
@@ -1196,12 +1172,6 @@
{
unsigned long num_cyl = i->kbToCylinder( sizeK );
ret = i->createPartition( num_cyl, device, true );
- /*
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device );
- }
- */
}
}
}
@@ -1268,10 +1238,6 @@
else
{
ret = i->createPartition( type, device );
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device );
- }
}
}
}
@@ -1286,12 +1252,6 @@
else
{
ret = i->createPartition( type, device );
- /*
- if( ret==0 && haveEvms() )
- {
- handleEvmsCreateDevice( disk, device );
- }
- */
}
}
}
@@ -1378,10 +1338,6 @@
{
if( vol->getUsedByType() != UB_NONE )
ret = removeUsing( vol->device(), vol->getUsedBy() );
- if( ret==0 && haveEvms() )
- {
- handleEvmsRemoveDevice( disk, vol->device(), false );
- }
if( ret==0 )
ret = disk->removePartition( vol->nr() );
}
@@ -1402,12 +1358,6 @@
{
if( vol->getUsedByType() != UB_NONE )
ret = removeUsing( vol->device(), vol->getUsedBy() );
- /*
- if( ret==0 && haveEvms() )
- {
- handleEvmsRemoveDevice( disk, vol->device(), false );
- }
- */
if( ret==0 )
ret = disk->removePartition( vol->nr() );
}
@@ -2511,18 +2461,6 @@
string vdev = vol->device();
if( vol->getUsedByType() != UB_NONE )
ret = removeUsing( vdev, vol->getUsedBy() );
- if( ret==0 && cont->type()==DISK && haveEvms() )
- {
- Disk* disk = dynamic_cast(&(*cont));
- y2mil( "disk:" << disk );
- string tmp = vdev;
- string::size_type pos = tmp.find_last_not_of( "0123456789" );
- tmp.erase( 0, pos+1 );
- unsigned num = 0;
- if( !tmp.empty() )
- tmp >> num;
- handleEvmsRemoveDevice( disk, vdev, false );
- }
if( ret==0 )
ret = cont->removeVolume( &(*vol) );
}
@@ -2604,22 +2542,6 @@
ret = i->removeVg();
if( ret==0 && i->created() )
ret = removeContainer( &(*i) );
- if( ret==0 && haveEvms() )
- {
- string evn = (string)"lvm2/" + name;
- EvmsCoIterator e = findEvmsCo( evn );
- y2mil( "n1:" << evn << " found:" << (e!=evCoEnd()) );
- if( e==evCoEnd() )
- {
- evn = (string)"lvm/" + name;
- e = findEvmsCo( evn );
- y2mil( "n2:" << evn << " found:" << (e!=evCoEnd()) );
- }
- if( e!=evCoEnd() )
- {
- removeContainer( &(*e) );
- }
- }
}
else
{
@@ -3726,7 +3648,6 @@
y2milestone( "p.length:%d", p.length() );
CommitStage a[] = { DECREASE, INCREASE, FORMAT, MOUNT };
CommitStage* pt = a;
- bool evms_activate = false;
while( unsigned(pt-a) < lengthof(a) )
{
bool new_pair = false;
@@ -3753,25 +3674,9 @@
CType type = (*ac)->type;
Container *co = cont ? const_cast((*ac)->co()) :
const_cast((*ac)->vol()->getContainer());
- if( !evms_activate && *pt==INCREASE &&
- (type==DISK||type==MD||(cont&&type==EVMS)) )
- {
- evms_activate = true;
- }
- if( !evms_activate && *pt==DECREASE &&
- (type==LVM||type==DISK||type==MD) )
- {
- evms_activate = true;
- }
- if( evms_activate && haveEvms() &&
- ((*pt==INCREASE && type==EVMS)||*pt==FORMAT||*pt==MOUNT))
- {
- // evmsActivateDevices();
- evms_activate = false;
- }
if( cont )
{
- bool cont_removed = co->deleted() && (type==LVM||type==EVMS);
+ bool cont_removed = co->deleted() && type==LVM;
ret = co->commitChanges( *pt );
cont_removed = cont_removed && ret==0;
if( cont_removed )
@@ -3793,8 +3698,7 @@
delete( *ac );
++ac;
}
- y2milestone( "stage:%d evms_activate:%d new_pair:%d", *pt,
- evms_activate, new_pair );
+ y2milestone( "stage:%d new_pair:%d", *pt, new_pair );
if( new_pair )
{
p = cPair( fnc );
@@ -3810,12 +3714,6 @@
logProcData();
}
}
- if( evms_activate && haveEvms() )
- {
- // evmsActivateDevices();
- evms_activate = false;
- logProcData();
- }
y2milestone( "ret:%d", ret );
return( ret );
}
@@ -4448,143 +4346,6 @@
}
}
-static bool isEvmsContainer( const Container& c )
- { return( c.type()==EVMS && !c.name().empty() ); }
-
-bool Storage::haveEvms()
- {
- bool ret = false;
- ContIterator c;
- if( findContainer( "/dev/evms", c ) && !c->isEmpty() )
- ret = true;
- if( !ret )
- {
- CPair cp = cPair( isEvmsContainer );
- y2mil( "num EVMS cont:" << cp.length() );
- ret = !cp.empty();
- }
- y2milestone( "ret:%d", ret );
- return( ret );
- }
-
-void Storage::handleEvmsRemoveDevice( const Disk* disk, const string& d,
- bool rename )
- {
- y2mil( "device:" << d << " rename:" << rename );
- ContIterator c;
- if( findContainer( "/dev/evms", c ))
- {
- VolIterator v;
- if( findVolume( d, v, true ) )
- {
- Partition* p = dynamic_cast(&(*v));
- if( p && p->type()==EXTENDED )
- {
- string dname = p->disk()->name();
- DiskIterator d = findDisk( dname );
- if( d!=dEnd() )
- {
- Disk::PartPair dp = d->partPair();
- Disk::PartIter pi = dp.begin();
- while( pi!=dp.end() )
- {
- if( pi->type()==LOGICAL )
- {
- //string dev = "/dev/evms/" + pi->name();
- string dev = EvmsCo::devToEvms( pi->device() );
- y2mil( "evms new dev:" << dev );
- VolIterator vv;
- if( findVolume( dev, vv ))
- {
- vv->setDeleted();
- vv->setSilent();
- }
- }
- ++pi;
- }
- }
- }
- }
- string dev = EvmsCo::devToEvms( d );
- y2mil( "evmsdev:" << dev );
- if( findVolume( dev, v ))
- {
- v->setDeleted();
- v->setSilent();
- y2mil( "v:" << *v );
- }
- if( disk->isEmpty() && disk->device().find("/dev/dasd")!=0 &&
- !findVolume( EvmsCo::devToEvms(disk->device()), v) )
- {
- EvmsCo* co = dynamic_cast(&(*c));
- if( co != NULL )
- {
- string name = EvmsCo::devToEvms(disk->device());
- y2mil( "evmsdev:" << dev );
- co->addLv( disk->sizeK(), name.substr(10), false );
- }
- }
- if( rename )
- {
- string tmp( dev );
- string::size_type pos = tmp.find_last_not_of( "0123456789" );
- tmp.erase( 0, pos+1 );
- y2mil( "tmp:" << tmp << " pos:" << pos );
- unsigned num = 0;
- if( !tmp.empty() )
- tmp >> num;
- num++;
- dev.erase( pos+1 );
- while( findVolume( dev+decString(num), v ))
- {
- string tmp = dev+decString(num-1);
- y2mil( "bef rename:" << *v );
- v->rename( tmp.substr( dev.rfind( '/' )+1 ));
- y2mil( "aft rename:" << *v );
- num++;
- }
- }
- logCo( &(*c) );
- }
- }
-
-
-void Storage::handleEvmsCreateDevice( const string& disk, const string& d, bool extended )
- {
- y2mil( "disk:" << disk << " device:" << d << " ext:" << extended );
- ContIterator c;
- if( findContainer( "/dev/evms", c ) && c->type()==EVMS )
- {
- VolIterator v;
- VolIterator w;
- string dev;
- if( !extended )
- {
- dev = EvmsCo::devToEvms(d);
- if( findVolume( d, v ) && !findVolume( dev, w ))
- {
- EvmsCo* co = dynamic_cast(&(*c));
- if( co != NULL )
- {
- Evms* l = new Evms( *co, dev.substr(10), v->sizeK(), 1u );
- co->addVolume( l );
- y2mil( "l:" << *l );
- if( findVolume( dev, w ))
- y2mil( "w:" << *w );
- }
- }
- logCo( &(*c) );
- }
- dev = EvmsCo::devToEvms( disk );
- if( findVolume( dev, v ))
- {
- v->setDeleted();
- v->setSilent();
- y2mil( "del evms disk:" << *v );
- logCo( &(*c) );
- }
- }
- }
void Storage::removeDmTableTo( const Volume& vol )
{
Modified: trunk/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?rev=49709&r1=49708&r2=49709&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.h (original)
+++ trunk/storage/libstorage/src/Storage.h Tue Aug 5 14:52:54 2008
@@ -1663,12 +1663,6 @@
bool haveMd( MdCo*& md );
bool haveNfs( NfsCo*& co );
bool haveLoop( LoopCo*& loop );
- bool haveEvms();
- void handleEvmsRemoveDevice( const Disk* disk, const string& d,
- bool rename );
- void handleEvmsCreateDevice( const string& disk, const string& dev,
- bool extended=false );
-
int removeContainer( Container* val, bool call_del=true );
void logVolumes( const string& Dir );
int commitPair( CPair& p, bool (* fnc)( const Container& ) );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org