[yast-commit] r59243 - in /branches/tmp/mpatelcz/SP1-md/libstorage/src: MdPartCo.cc MdPartCo.h
Author: mpatelcz Date: Thu Oct 29 16:33:59 2009 New Revision: 59243 URL: http://svn.opensuse.org/viewcvs/yast?rev=59243&view=rev Log: Changed text in sb_ver. Now it shows what type of external metadata is in use. Instead of 'external:/md127/0' it shows 'imsm' for instance. Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc?rev=59243&r1=59242&r2=59243&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.cc Thu Oct 29 16:33:59 2009 @@ -1401,11 +1401,11 @@ string property; - if( !readProp(METADATA, sb_ver) ) + if( !readProp(METADATA, md_metadata) ) { y2mil("Failed to read metadata"); } - y2mil("sb_ver " << sb_ver); + y2mil("sb_ver " << md_metadata); property.clear(); if( !readProp(COMPONENT_SIZE, property) ) @@ -1472,7 +1472,7 @@ setSpares(); y2mil("reading 'map' file."); readMdMap(); - + setMetaData(); y2mil("Done"); } @@ -1550,12 +1550,18 @@ MdPartCo::getParent() { string ret; - string con = sb_ver; + string con = md_metadata; string::size_type pos1; string::size_type pos2; parent_container.clear(); + if( md_metadata.empty() ) + { + (void)readProp(METADATA, md_metadata); + con = md_metadata; + } + if( con.find("external:")==0 ) { if( (pos1=con.find_first_of("/")) != string::npos ) @@ -1581,6 +1587,36 @@ } } +void MdPartCo::setMetaData() +{ + sb_ver.clear(); + if( parent_container.empty () ) + { + getParent(); + } + string path = sysfs_path + parent_container + "/md/" + md_props[METADATA]; + string val; + + if( access( path.c_str(), R_OK )==0 ) + { + std::ifstream file( path.c_str() ); + classic(file); + file >> val; + file.close(); + file.clear(); + + // It will be 'external:XXXX' + string::size_type pos = val.find(":"); + if( pos != string::npos ) + { + sb_ver = val.erase(0,pos+1); + y2mil("sb_ver: " << sb_ver); + } + } + + return; +} + void MdPartCo::setMdParity() { md_parity = PAR_NONE; Modified: branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h?rev=59243&r1=59242&r2=59243&view=diff ============================================================================== --- branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h (original) +++ branches/tmp/mpatelcz/SP1-md/libstorage/src/MdPartCo.h Thu Oct 29 16:33:59 2009 @@ -297,7 +297,7 @@ /* Returns container */ void getParent(); - void checkMetaData(); + void setMetaData(); void setMdDevs(); @@ -325,6 +325,7 @@ /* Md Container - */ string parent_container; + string md_metadata; string md_uuid; string sb_ver; bool destrSb; -- 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