]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: test/librados/test.cc must create profile 6450/head
authorLoic Dachary <ldachary@redhat.com>
Mon, 2 Nov 2015 23:21:51 +0000 (00:21 +0100)
committerLoic Dachary <ldachary@redhat.com>
Tue, 3 Nov 2015 07:41:34 +0000 (08:41 +0100)
Now that the create_one_ec_pool function removes the testprofile each
time it is called, it must create the testprofile erasure code profile
again for the test to use.

http://tracker.ceph.com/issues/13664 Refs: #13664

Signed-off-by: Loic Dachary <ldachary@redhat.com>
(cherry picked from commit a60342942b5a42ee04d59af77a6b904ce62eefc4)

src/test/librados/test.cc

index 8380b28146fb5df923c884f46832d184063297e2..198c10c8d817c68a6aca664dc0191b95c4ffc0cd 100644 (file)
@@ -67,6 +67,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();
@@ -79,7 +91,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();
   }