Author: fehr Date: Tue Jul 20 12:07:01 2010 New Revision: 62278 URL: http://svn.opensuse.org/viewcvs/yast?rev=62278&view=rev Log: - add function HasRaidParity to Storage.ycp - use rev_conv_parstring to get parity string values Modified: trunk/storage/storage/src/modules/Storage.ycp trunk/storage/storage/src/modules/StorageFields.ycp Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=62278&r1=62277&r2=62278&view=diff ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Tue Jul 20 12:07:01 2010 @@ -1360,6 +1360,11 @@ return p; } +global boolean HasRaidParity( string rt ) + { + return( contains( [ "raid5", "raid6", "raid10" ], rt )); + } + map getContainerInfo( map c ) { y2milestone( "getContainerInfo %1", c ); @@ -1469,13 +1474,13 @@ integer t = LibStorage::MdPartCoInfo::swig_type_get(infos); c["raid_type"] = substring(sformat("%1", toSymbol(conv_mdtype, t)), 1); - if (c["raid_type"]:"" == "raid5") - { + if( HasRaidParity( c["raid_type"]:"" )) + { t = LibStorage::MdPartCoInfo::swig_parity_get(infos); symbol pt = toSymbol(conv_mdparity, t); - if (pt != `par_none) - c["parity_algorithm"] = substring(sformat("%1", pt), 1); - } + if( pt != `par_default ) + c["parity_algorithm"] = rev_conv_parstring[t]:""; + } t = LibStorage::MdPartCoInfo::swig_chunkSizeK_get(infos); if (t > 0) { @@ -1549,12 +1554,12 @@ p["nr"] = LibStorage::MdInfo::swig_nr_get(info); integer t = LibStorage::MdInfo::swig_type_get(info); p["raid_type"] = substring( sformat( "%1", toSymbol( conv_mdtype, t )), 1 ); - if( p["raid_type"]:""=="raid5" ) + if( HasRaidParity( p["raid_type"]:"" )) { t = LibStorage::MdInfo::swig_parity_get(info); symbol pt = toSymbol( conv_mdparity, t ); - if( pt != `par_none ) - p["parity_algorithm"] = substring( sformat( "%1", pt), 1 ); + if( pt != `par_default ) + p["parity_algorithm"] = rev_conv_parstring[t]:""; } p["type"] = `sw_raid; p["fstype"] = Partitions::raid_name; @@ -2962,7 +2967,7 @@ ret = Storage::CreateMd( p["nr"]:0, p["raid_type"]:"raid1" ); if( ret && haskey( p, "chunk_size" )) Storage::ChangeMdChunk( p["nr"]:0, p["chunk_size"]:4 ); - if( ret && p["raid_type"]:""=="raid5" && + if( ret && HasRaidParity( p["raid_type"]:"" ) && haskey( p, "parity_algorithm" )) Storage::ChangeMdParity( p["nr"]:0, p["parity_algorithm"]:"" ); Modified: trunk/storage/storage/src/modules/StorageFields.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/StorageFields.ycp?rev=62278&r1=62277&r2=62278&view=diff ============================================================================== --- trunk/storage/storage/src/modules/StorageFields.ycp (original) +++ trunk/storage/storage/src/modules/StorageFields.ycp Tue Jul 20 12:07:01 2010 @@ -807,7 +807,8 @@ case `chunk_size: { string value = ""; - if (contains(["raid0", "raid5"], data["raid_type"]:"")) { + if (data["raid_type"]:""=="raid0" || + Storage::HasRaidParity(data["raid_type"]:"")) { integer chunksize = data["chunk_size"]:0; value = Storage::KByteToHumanStringOmitZeroes(chunksize); } @@ -821,7 +822,7 @@ case `parity_algorithm: { string value = ""; - if (contains(["raid5"], data["raid_type"]:"")) { + if (Storage::HasRaidParity(data["raid_type"]:"")) { value = data["parity_algorithm"]:""; value = mergestring(splitstring(value, "_"), "-"); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org