From: Sage Weil Date: Thu, 4 May 2017 17:40:42 +0000 (-0500) Subject: crush/CrushWrapper: has_[incompat_]chooseargs() X-Git-Tag: v12.0.3~50^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=04b9e9f1a316523f6d5737df6f19c41a5ddf779c;p=ceph.git crush/CrushWrapper: has_[incompat_]chooseargs() We'll use this for feature bit compat checks with clients and osds. Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 7974b9a75014..ee6db9bc629a 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -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)) diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 91b5439f7c57..c47a5badc412 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -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;