]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #6405 from jcsp/wip-9963
authorSage Weil <sage@redhat.com>
Thu, 17 Dec 2015 20:38:17 +0000 (15:38 -0500)
committerSage Weil <sage@redhat.com>
Thu, 17 Dec 2015 20:38:17 +0000 (15:38 -0500)
librados: new style (sharded) object listing

Reviewed-by: Sage Weil <sage@redhat.com>
1  2 
src/include/rados/librados.hpp
src/librados/IoCtxImpl.cc
src/librados/IoCtxImpl.h
src/librados/librados.cc
src/osd/ReplicatedPG.cc
src/osd/osd_types.cc
src/osd/osd_types.h
src/osdc/Objecter.h
src/test/Makefile-client.am
src/test/librados/test.cc

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index b82936af67754f6a8fa4735bceca652e936bbf0a,488b35c0b7f994ce16773b8102d64426ae0acfe3..469b7145bff875611dd0eda22fb2d2621c278897
@@@ -45,43 -145,44 +145,73 @@@ std::string create_one_pool
    return "";
  }
  
 -int destroy_ec_profile(rados_t *cluster)
 +int destroy_ec_profile(rados_t *cluster, std::ostream &oss)
  {
 -    char *cmd[2];
 -    cmd[0] = (char *)"{\"prefix\": \"osd erasure-code-profile rm\", \"name\": \"testprofile\"}";
 -    cmd[1] = NULL;
 -    return rados_mon_command(*cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0);
 +  char *cmd[2];
 +  cmd[0] = (char *)"{\"prefix\": \"osd erasure-code-profile rm\", \"name\": \"testprofile\"}";
 +  cmd[1] = NULL;
 +  int ret = rados_mon_command(*cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0);
 +  if (ret)
 +    oss << "rados_mon_command: erasure-code-profile rm testprofile failed with error " << ret;
 +  return ret;
 +}
 +
 +int destroy_ruleset(rados_t *cluster,
 +                    std::string ruleset,
 +                    std::ostream &oss)
 +{
 +  char *cmd[2];
 +  std::string tmp = ("{\"prefix\": \"osd crush rule rm\", \"name\":\"" +
 +                     ruleset + "\"}");
 +  cmd[0] = (char*)tmp.c_str();
 +  cmd[1] = NULL;
 +  int ret = rados_mon_command(*cluster, (const char **)cmd, 1, "", 0, NULL, 0, NULL, 0);
 +  if (ret)
 +    oss << "rados_mon_command: osd crush rule rm " + ruleset + " failed with error " << ret;
 +  return ret;
 +}
 +
 +int destroy_ec_profile_and_ruleset(rados_t *cluster,
 +                                   std::string ruleset,
 +                                   std::ostream &oss)
 +{
 +  int ret;
 +  ret = destroy_ec_profile(cluster, oss);
 +  if (ret)
 +    return ret;
 +  return destroy_ruleset(cluster, ruleset, oss);
  }
  
+ std::string set_pg_num(
+     rados_t *cluster, const std::string &pool_name, uint32_t pg_num)
+ {
+   // Wait for 'creating' to clear
+   int r = wait_for_healthy(cluster);
+   if (r != 0) {
+     goto err;
+   }
+   // Adjust pg_num
+   r = rados_pool_set(cluster, pool_name, "pg_num", stringify(pg_num));
+   if (r != 0) {
+     goto err;
+   }
+   // Wait for 'creating' to clear
+   r = wait_for_healthy(cluster);
+   if (r != 0) {
+     goto err;
+   }
+   return "";
+ err:
+   rados_shutdown(*cluster);
+   std::ostringstream oss;
+   oss << __func__ << "(" << pool_name << ") failed with error " << r;
+   return oss.str();
+ }
  std::string create_one_ec_pool(const std::string &pool_name, rados_t *cluster)
  {
    std::string err = connect_cluster(cluster);