]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crush/CrushWrapper: has_[incompat_]chooseargs()
authorSage Weil <sage@redhat.com>
Thu, 4 May 2017 17:40:42 +0000 (12:40 -0500)
committerSage Weil <sage@redhat.com>
Tue, 9 May 2017 16:32:55 +0000 (11:32 -0500)
We'll use this for feature bit compat checks with clients and osds.

Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h

index 7974b9a75014e698ec91afe9544f57fc4abab4d4..ee6db9bc629ab3211a4b7c62496062b7a1944e4c 100644 (file)
@@ -105,6 +105,19 @@ bool CrushWrapper::is_v5_rule(unsigned ruleid) const
   return false;
 }
 
+bool CrushWrapper::has_chooseargs() const
+{
+  return !choose_args.empty();
+}
+
+bool CrushWrapper::has_incompat_chooseargs() const
+{
+  // FIXME: if the chooseargs all have 1 position *and* do not remap IDs then
+  // we can fabricate a compatible crush map for legacy clients by swapping the
+  // choose_args weights in for the real weights.  until then,
+  return has_chooseargs();
+}
+
 int CrushWrapper::split_id_class(int i, int *idout, int *classout) const
 {
   if (!item_exists(i))
index 91b5439f7c57ef7eba024fbc97a5fc28ba213b28..c47a5badc412854f13db0846505e0912c142f6f3 100644 (file)
@@ -316,6 +316,8 @@ public:
   bool has_v3_rules() const;
   bool has_v4_buckets() const;
   bool has_v5_rules() const;
+  bool has_chooseargs() const;          // any chooseargs
+  bool has_incompat_chooseargs() const; // chooseargs that can't be made compat
 
   bool is_v2_rule(unsigned ruleid) const;
   bool is_v3_rule(unsigned ruleid) const;