diff options
author | Samuel Just <sjust@redhat.com> | 2023-11-22 00:39:23 +0100 |
---|---|---|
committer | Samuel Just <sjust@redhat.com> | 2024-02-04 06:00:11 +0100 |
commit | 8fba03fe42a4981cb40c58c5f8b8c6f7524f6178 (patch) | |
tree | 0fc912d04d562aa7e824dcf56f629f72ee410d0d /src/crush | |
parent | doc/dev/crush-msr.rst: add developer summary of crush msr (diff) | |
download | ceph-8fba03fe42a4981cb40c58c5f8b8c6f7524f6178.tar.xz ceph-8fba03fe42a4981cb40c58c5f8b8c6f7524f6178.zip |
mon/OSDMonitor: generalize rule type check for pools
Add rule_valid_for_pool_type to CrushWrapper to generalize
rule type <-> pool type mapping to include the new MSR
types.
Signed-off-by: Samuel Just <sjust@redhat.com>
Diffstat (limited to 'src/crush')
-rw-r--r-- | src/crush/CrushWrapper.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index f71f6d6ea79..77f70d10049 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -602,6 +602,20 @@ public: if (have_rmaps) rule_name_rmap[name] = i; } + bool rule_valid_for_pool_type(int rule_id, int ptype) const { + auto rule_type = get_rule_type(rule_id); + switch (ptype) { + case CEPH_PG_TYPE_REPLICATED: + return rule_type == CRUSH_RULE_TYPE_REPLICATED || + rule_type == CRUSH_RULE_TYPE_MSR_FIRSTN; + case CEPH_PG_TYPE_ERASURE: + return rule_type == CRUSH_RULE_TYPE_ERASURE || + rule_type == CRUSH_RULE_TYPE_MSR_INDEP; + default: + ceph_abort_msg("impossible"); + } + } + bool is_shadow_item(int id) const { const char *name = get_item_name(id); return name && !is_valid_crush_name(name); |