| 239 | } |
| 240 | |
| 241 | int ErasureCodeClay::parse(ErasureCodeProfile &profile, |
| 242 | ostream *ss) |
| 243 | { |
| 244 | int err = 0; |
| 245 | err = ErasureCode::parse(profile, ss); |
| 246 | err |= to_int("k", profile, &k, DEFAULT_K, ss); |
| 247 | err |= to_int("m", profile, &m, DEFAULT_M, ss); |
| 248 | |
| 249 | err |= sanity_check_k_m(k, m, ss); |
| 250 | |
| 251 | err |= to_int("d", profile, &d, std::to_string(k+m-1), ss); |
| 252 | |
| 253 | // check for scalar_mds in profile input |
| 254 | if (profile.find("scalar_mds") == profile.end() || |
| 255 | profile.find("scalar_mds")->second.empty()) { |
| 256 | mds.profile["plugin"] = "jerasure"; |
| 257 | pft.profile["plugin"] = "jerasure"; |
| 258 | } else { |
| 259 | std::string p = profile.find("scalar_mds")->second; |
| 260 | if ((p == "jerasure") || (p == "isa") || (p == "shec")) { |
| 261 | mds.profile["plugin"] = p; |
| 262 | pft.profile["plugin"] = p; |
| 263 | } else { |
| 264 | *ss << "scalar_mds " << mds.profile["plugin"] << |
| 265 | "is not currently supported, use one of 'jerasure',"<< |
| 266 | " 'isa', 'shec'" << std::endl; |
| 267 | err = -EINVAL; |
| 268 | return err; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | if (profile.find("technique") == profile.end() || |
| 273 | profile.find("technique")->second.empty()) { |
| 274 | if ((mds.profile["plugin"]=="jerasure") || (mds.profile["plugin"]=="isa") ) { |
| 275 | mds.profile["technique"] = "reed_sol_van"; |
| 276 | pft.profile["technique"] = "reed_sol_van"; |
| 277 | } else { |
| 278 | mds.profile["technique"] = "single"; |
| 279 | pft.profile["technique"] = "single"; |
| 280 | } |
| 281 | } else { |
| 282 | std::string p = profile.find("technique")->second; |
| 283 | if (mds.profile["plugin"] == "jerasure") { |
| 284 | if ( (p == "reed_sol_van") || (p == "reed_sol_r6_op") || (p == "cauchy_orig") |
| 285 | || (p == "cauchy_good") || (p == "liber8tion")) { |
| 286 | mds.profile["technique"] = p; |
| 287 | pft.profile["technique"] = p; |
| 288 | } else { |
| 289 | *ss << "technique " << p << "is not currently supported, use one of " |
| 290 | << "reed_sol_van', 'reed_sol_r6_op','cauchy_orig'," |
| 291 | << "'cauchy_good','liber8tion'"<< std::endl; |
| 292 | err = -EINVAL; |
| 293 | return err; |
| 294 | } |
| 295 | } else if (mds.profile["plugin"] == "isa") { |
| 296 | if ( (p == "reed_sol_van") || (p == "cauchy")) { |
| 297 | mds.profile["technique"] = p; |
| 298 | pft.profile["technique"] = p; |
no test coverage detected