]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: allow item addition/removal when choose_args exists
authorLoic Dachary <ldachary@redhat.com>
Fri, 26 May 2017 13:35:57 +0000 (16:35 +0300)
committerLoic Dachary <ldachary@redhat.com>
Fri, 26 May 2017 15:48:36 +0000 (18:48 +0300)
Signed-off-by: Loic Dachary <loic@dachary.org>
src/crush/CrushWrapper.cc
src/test/crush/CrushWrapper.cc

index 6583cac642dea498bd6f42072816ef816c27fca8..848bd5609d1d5101b8b402a77a4cfaa2c95dc52a 100644 (file)
@@ -314,11 +314,6 @@ int CrushWrapper::remove_root(int item, bool unused)
 
 int CrushWrapper::remove_item(CephContext *cct, int item, bool unlink_only)
 {
-  if (choose_args.size() > 0) {
-    ldout(cct, 1) << "remove_item not implemented when choose_args is not empty" << dendl;
-    return -EDOM;
-  }
-
   ldout(cct, 5) << "remove_item " << item << (unlink_only ? " unlink_only":"") << dendl;
 
   int ret = -ENOENT;
@@ -686,11 +681,6 @@ int CrushWrapper::get_children(int id, list<int> *children)
 int CrushWrapper::insert_item(CephContext *cct, int item, float weight, string name,
                              const map<string,string>& loc)  // typename -> bucketname
 {
-  if (choose_args.size() > 0) {
-    ldout(cct, 1) << "insert_item not implemented when choose_args is not empty" << dendl;
-    return -EDOM;
-  }
-
   ldout(cct, 5) << "insert_item item " << item << " weight " << weight
                << " name " << name << " loc " << loc << dendl;
 
@@ -794,11 +784,6 @@ int CrushWrapper::insert_item(CephContext *cct, int item, float weight, string n
 
 int CrushWrapper::move_bucket(CephContext *cct, int id, const map<string,string>& loc)
 {
-  if (choose_args.size() > 0) {
-    ldout(cct, 1) << "move_bucket not implemented when choose_args is not empty" << dendl;
-    return -EDOM;
-  }
-
   // sorry this only works for buckets
   if (id >= 0)
     return -EINVAL;
@@ -864,11 +849,6 @@ int CrushWrapper::swap_bucket(CephContext *cct, int src, int dst)
 
 int CrushWrapper::link_bucket(CephContext *cct, int id, const map<string,string>& loc)
 {
-  if (choose_args.size() > 0) {
-    ldout(cct, 1) << "link_bucket not implemented when choose_args is not empty" << dendl;
-    return -EDOM;
-  }
-
   // sorry this only works for buckets
   if (id >= 0)
     return -EINVAL;
@@ -888,11 +868,6 @@ int CrushWrapper::link_bucket(CephContext *cct, int id, const map<string,string>
 int CrushWrapper::create_or_move_item(CephContext *cct, int item, float weight, string name,
                                      const map<string,string>& loc)  // typename -> bucketname
 {
-  if (choose_args.size() > 0) {
-    ldout(cct, 1) << "create_or_move_item not implemented when choose_args is not empty" << dendl;
-    return -EDOM;
-  }
-
   int ret = 0;
   int old_iweight;
 
@@ -919,11 +894,6 @@ int CrushWrapper::create_or_move_item(CephContext *cct, int item, float weight,
 int CrushWrapper::update_item(CephContext *cct, int item, float weight, string name,
                              const map<string,string>& loc)  // typename -> bucketname
 {
-  if (choose_args.size() > 0) {
-    ldout(cct, 1) << "update_item not implemented when choose_args is not empty" << dendl;
-    return -EDOM;
-  }
-
   ldout(cct, 5) << "update_item item " << item << " weight " << weight
                << " name " << name << " loc " << loc << dendl;
   int ret = 0;
index 816460d67963e31cc7a766c537603fdacb4d812e..6fe2955ffda7f3b7ee30cd757805044b486c8695 100644 (file)
@@ -775,20 +775,6 @@ TEST(CrushWrapper, insert_item) {
   delete c;
 }
 
-TEST(CrushWrapper, choose_args_disabled) {
-  auto *c = new CrushWrapper;
-  c->choose_args[0] = crush_choose_arg_map();
-
-  map<string,string> loc;
-  ASSERT_EQ(-EDOM, c->remove_item(g_ceph_context, 0, true));
-  ASSERT_EQ(-EDOM, c->insert_item(g_ceph_context, 0, 0.0, "", loc));
-  ASSERT_EQ(-EDOM, c->move_bucket(g_ceph_context, 0, loc));
-  ASSERT_EQ(-EDOM, c->link_bucket(g_ceph_context, 0, loc));
-  ASSERT_EQ(-EDOM, c->create_or_move_item(g_ceph_context, 0, 0.0, "", loc));
-
-  delete c;
-}
-
 TEST(CrushWrapper, remove_item) {
   auto *c = new CrushWrapper;