Skip to content

Commit

Permalink
Merge pull request #6452 from dachary/wip-13664-test-ec
Browse files Browse the repository at this point in the history
tests: test/librados/test.cc must create profile

Reviewed-by: Samuel Just <sjust@redhat.com>
  • Loading branch information
Loic Dachary committed Nov 3, 2015
2 parents cab3d3f + a603429 commit 76de0c3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/test/librados/test.cc
Expand Up @@ -69,6 +69,18 @@ std::string create_one_ec_pool(const std::string &pool_name, rados_t *cluster)

char *cmd[2];
cmd[1] = NULL;

std::string profile_create = "{\"prefix\": \"osd erasure-code-profile set\", \"name\": \"testprofile\", \"profile\": [ \"k=2\", \"m=1\", \"ruleset-failure-domain=osd\"]}";
cmd[0] = (char *)profile_create.c_str();
ret = rados_mon_command(*cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0);
if (ret) {
std::ostringstream oss;

rados_shutdown(*cluster);
oss << "rados_mon_command erasure-code-profile set name:testprofile failed with error " << ret;
return oss.str();
}

std::string cmdstr = "{\"prefix\": \"osd pool create\", \"pool\": \"" +
pool_name + "\", \"pool_type\":\"erasure\", \"pg_num\":8, \"pgp_num\":8, \"erasure_code_profile\":\"testprofile\"}";
cmd[0] = (char *)cmdstr.c_str();
Expand All @@ -81,7 +93,7 @@ std::string create_one_ec_pool(const std::string &pool_name, rados_t *cluster)
oss << "rados_mon_command osd erasure-code-profile rm name:testprofile failed with error " << ret2 << std::endl;

rados_shutdown(*cluster);
oss << "rados_mon_command erasure-code-profile set name:testprofile failed with error " << ret;
oss << "rados_mon_command osd pool create failed with error " << ret;
return oss.str();
}

Expand Down

0 comments on commit 76de0c3

Please sign in to comment.