[yast-commit] r60463 - in /branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src: MdPartCo.cc MdPartCo.h
Author: mpatelcz Date: Wed Jan 20 17:40:46 2010 New Revision: 60463 URL: http://svn.opensuse.org/viewcvs/yast?rev=60463&view=rev Log: 1. Removed text massages on deletion 2. RAID disks are released after partition deletion. Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.h Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc?rev=60463&r1=60462&r2=60463&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc Wed Jan 20 17:40:46 2010 @@ -674,13 +674,6 @@ } if( ret==0 && !created() ) { - list<string> rdevs; - getDevs( rdevs ); - for( list<string>::const_iterator s=rdevs.begin(); - s!=rdevs.end(); ++s ) - { - getStorage()->clearUsedBy(*s); - } //Remove partitions MdPartPair p=mdpartPair(MdPart::notDeleted); for( MdPartIter i=p.begin(); i!=p.end(); ++i ) @@ -688,6 +681,12 @@ if( i->nr()>0 ) { ret = removePartition( i->nr() ); + if( ret != 0 ) + { + // Error. Break. + break; + } + } } //Remove 'whole device' it was created when last partition was deleted. @@ -697,16 +696,35 @@ if( !removeFromList( &(*p.begin()) )) { y2err( "not found:" << *p.begin() ); + ret = MDPART_PARTITION_NOT_FOUND; } } - setDeleted( true ); - destrSb = true; - del_ptable = true; } + if( ret==0 ) + { + unuseDevs(); + setDeleted( true ); + destrSb = true; + del_ptable = true; + } y2mil("ret:" << ret); return( ret ); } +int MdPartCo::unuseDevs(void) +{ + list<string> rdevs; + getDevs( rdevs ); + for( list<string>::const_iterator s=rdevs.begin(); + s!=rdevs.end(); s++ ) + { + getStorage()->clearUsedBy(*s); + } + return 0; +} + + + void MdPartCo::removePresentPartitions() { VolPair p = volPair(); @@ -888,10 +906,6 @@ // 1. Check Metadata. if( sb_ver == "imsm" || sb_ver == "ddf" ) { - if( !silent ) - { - getStorage()->showInfoCb( noRemoveTextFormat(true) ); - } y2error("Cannot remove IMSM or DDF SW RAIDs."); return (MDPART_NO_REMOVE); } @@ -912,10 +926,6 @@ } if( permitRemove == 1 ) { - if( !silent ) - { - getStorage()->showInfoCb( noRemoveTextPartitions(true) ); - } y2error("Cannot remove RAID with partitions."); return (MDPART_NO_REMOVE); } @@ -1090,36 +1100,6 @@ } return( txt ); } -string MdPartCo::noRemoveTextFormat( bool doing ) const - { - string txt; - if( doing ) - { - // displayed text during action, %1$s is replaced by a name (e.g. pdc_igeeeadj), - txt = sformat( _("Cannot remove %1$s. It is IMSM or DDF RAID."), name().c_str() ); - } - else - { - // displayed text before action, %1$s is replaced by a name (e.g. pdc_igeeeadj), - txt = sformat( _("Couldn't remove %1$s. It is IMSM or DDF RAID."), name().c_str() ); - } - return( txt ); - } -string MdPartCo::noRemoveTextPartitions( bool doing ) const - { - string txt; - if( doing ) - { - // displayed text during action, %1$s is replaced by a name (e.g. pdc_igeeeadj), - txt = sformat( _("Cannot remove %1$s because it contains at least 1 partition."), name().c_str() ); - } - else - { - // displayed text before action, %1$s is replaced by a name (e.g. pdc_igeeeadj), - txt = sformat( _("Couldn't remove %1$s because it contains at least 1 partition."), name().c_str() ); - } - return( txt ); - } void MdPartCo::setUdevData(const list<string>& id) { Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.h?rev=60463&r1=60462&r2=60463&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.h (original) +++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.h Wed Jan 20 17:40:46 2010 @@ -277,8 +277,6 @@ int doCreateLabel(); virtual int doRemove(); virtual string removeText( bool doing ) const; - virtual string noRemoveTextFormat( bool doing ) const; - virtual string noRemoveTextPartitions( bool doing ) const; virtual string setDiskLabelText( bool doing ) const; void getMajorMinor(void); @@ -299,6 +297,8 @@ void getMdProps(void); void setSpares(void); + /* Clear UsedBy for Disks. */ + int unuseDevs(void); void logData( const string& Dir ); string udev_path; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
mpatelcz@svn.opensuse.org