[yast-commit] r61917 - in /branches/SuSE-Code-11-SP1-Branch/storage: VERSION libstorage/src/Disk.cc libstorage/src/Disk.h libstorage/src/Storage.cc libstorage/src/Storage.h package/yast2-storage.changes
Author: fehr Date: Thu Apr 29 15:12:44 2010 New Revision: 61917 URL: http://svn.opensuse.org/viewcvs/yast?rev=61917&view=rev Log: - fix handling of multiple xbd devices with same basename (e.g. xvda1,xvda2) bnc #587658 - ignore changes of partition id on readonly disks Modified: branches/SuSE-Code-11-SP1-Branch/storage/VERSION branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes Modified: branches/SuSE-Code-11-SP1-Branch/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/VERSION?rev=61917&r1=61916&r2=61917&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/VERSION (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/VERSION Thu Apr 29 15:12:44 2010 @@ -1 +1 @@ -2.17.98 +2.17.99 Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc?rev=61917&r1=61916&r2=61917&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc Thu Apr 29 15:12:44 2010 @@ -77,15 +77,9 @@ size_k = SizeK; head = new_head = 16; sector = new_sector = 32; - cyl = new_cyl = std::max( size_k*2 / head / sector, 1ULL ); byte_cyl = head * sector * 512; - unsigned long long sz = size_k; - Partition *p = new Partition( *this, num, sz, 0, cyl, PRIMARY ); - if( ppart.getSize( p->device(), sz ) && sz>0 ) - { - p->setSize( sz ); - } - addToList( p ); + cyl = new_cyl = 0; + addPartition( num, size_k, ppart ); } Disk::Disk( Storage * const s, const string& fname ) : @@ -1840,15 +1834,17 @@ } if( readonly() ) { - ret = DISK_CHANGE_READONLY; + y2war( "trying to chang partition id on readonly disk - ignoring" ); + i->changeIdDone(); + ret = 0; } - if( ret==0 ) + else { ret = i->changeId( id ); } y2mil("ret:" << ret); return ret; -} + } int Disk::forgetChangePartitionId( unsigned nr ) @@ -2713,6 +2709,21 @@ return( ret ); } +void Disk::addPartition( unsigned num, unsigned long long sz, + ProcPart& ppart ) + { + y2mil( "dev:" << device() << " num:" << num << " sizek" << sz ); + unsigned long cyl_inc = std::max( sz*2 / head / sector, 1ULL ); + Partition *p = new Partition( *this, num, sz, cyl, cyl_inc, PRIMARY ); + cyl += cyl_inc; + new_cyl = cyl; + if( ppart.getSize( p->device(), sz ) && sz>0 ) + { + p->setSize( sz ); + } + addToList( p ); + } + unsigned Disk::numPartitions() const { return(partPair( notDeleted ).length()); Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h?rev=61917&r1=61916&r2=61917&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h Thu Apr 29 15:12:44 2010 @@ -213,6 +213,8 @@ bool getPartedSectors( const Partition *p, unsigned long long& start, unsigned long long& end ); const Partition * getPartitionAfter( const Partition * p ); + void addPartition( unsigned num, unsigned long long sz, + ProcPart& ppart ); virtual void print( std::ostream& s ) const { s << *this; } virtual Container* getCopy() const { return( new Disk( *this ) ); } void getGeometry( const string& line, unsigned long& c, Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc?rev=61917&r1=61916&r2=61917&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc Thu Apr 29 15:12:44 2010 @@ -794,51 +794,63 @@ void -Storage::initDisk( DiskData& data, ProcPart& pp ) +Storage::initDisk( list<DiskData>& dl, ProcPart& pp ) { - y2mil( "data:" << data ); - data.dev = data.name; - string::size_type pos = data.dev.find('!'); - while( pos!=string::npos ) - { - data.dev[pos] = '/'; - pos = data.dev.find('!',pos+1); - } - y2milestone( "name sysfs:%s parted:%s", data.name.c_str(), - data.dev.c_str() ); - Disk * d = NULL; - switch( data.typ ) + y2mil( "dl: " << dl ); + for( list<DiskData>::iterator i = dl.begin(); i!=dl.end(); ++i ) { - case DiskData::DISK: - d = new Disk( this, data.dev, data.s ); - break; - case DiskData::DASD: - d = new Dasd( this, data.dev, data.s ); - break; - case DiskData::XEN: + DiskData& data( *i ); + y2mil( "data:" << data ); + data.dev = data.name; + string::size_type pos = data.dev.find('!'); + while( pos!=string::npos ) + { + data.dev[pos] = '/'; + pos = data.dev.find('!',pos+1); + } + y2milestone( "name sysfs:%s parted:%s", data.name.c_str(), + data.dev.c_str() ); + Disk * d = NULL; + switch( data.typ ) { - string::size_type p = data.dev.find_last_not_of( "0123456789" ); - int nr = -1; - data.dev.substr( p+1 ) >> nr; - data.dev.erase( p+1 ); - if( nr>=0 ) + case DiskData::DISK: + d = new Disk( this, data.dev, data.s ); + break; + case DiskData::DASD: + d = new Dasd( this, data.dev, data.s ); + break; + case DiskData::XEN: { - d = new Disk( this, data.dev, (unsigned)nr, data.s, pp ); + string::size_type p = data.dev.find_last_not_of( "0123456789" ); + int nr = -1; + data.dev.substr( p+1 ) >> nr; + data.dev.erase( p+1 ); + y2mil( "data dev:" << data.dev << " nr:" << nr ); + if( nr>=0 ) + { + list<DiskData>::iterator j = dl.begin(); + while( j!=dl.end() && j->dev!=data.dev ) + ++j; + if( j!=dl.end() && j->d ) + j->d->addPartition( (unsigned)nr, data.s, pp ); + else + d = new Disk( this, data.dev, (unsigned)nr, data.s, pp ); + } + break; } - break; } - } - if( d && - (d->getSysfsInfo(SYSFSDIR "/" + data.name)||data.typ==DiskData::XEN) && - (data.typ==DiskData::XEN||d->detect(pp))) - { - if( max_log_num>0 ) - d->logData( logdir() ); - data.d = d; - } - else if( d ) - { - delete d; + if( d && + (d->getSysfsInfo(SYSFSDIR "/" + data.name)||data.typ==DiskData::XEN) && + (data.typ==DiskData::XEN||d->detect(pp))) + { + if( max_log_num>0 ) + d->logData( logdir() ); + data.d = d; + } + else if( d ) + { + delete d; + } } } @@ -890,11 +902,7 @@ } } closedir( Dir ); - y2mil( "dl: " << dl ); - for( list<DiskData>::iterator i = dl.begin(); i!=dl.end(); ++i ) - { - initDisk(*i, parts); - } + initDisk(dl, parts); y2mil( "dl: " << dl ); for( list<DiskData>::const_iterator i = dl.begin(); i!=dl.end(); ++i ) { Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h?rev=61917&r1=61916&r2=61917&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h Thu Apr 29 15:12:44 2010 @@ -1854,7 +1854,7 @@ void detectDmraid( ProcPart& ppart ); void detectDmmultipath( ProcPart& ppart ); void detectDm(ProcPart& ppart, bool only_crypt); - void initDisk( DiskData& data, ProcPart& pp ); + void initDisk( list<DiskData>& dl, ProcPart& pp ); void detectFsData( const VolIterator& begin, const VolIterator& end, ProcMounts& mounts ); void detectFsDataTestMode( const string& file, Modified: branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes?rev=61917&r1=61916&r2=61917&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes Thu Apr 29 15:12:44 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Apr 28 16:48:04 CEST 2010 - fehr@suse.de + +- fix handling of multiple xbd devices with same basename + (e.g. xvda1,xvda2) bnc #587658 +- ignore changes of partition id on readonly disks + +------------------------------------------------------------------- Thu Apr 22 16:25:56 CEST 2010 - fehr@suse.de - add missing hunk to finally fix bnc #592197 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
fehr@svn.opensuse.org