rule replicated_rule {
id 0
type replicated
- min_size 1
- max_size 10
step take default
step chooseleaf firstn 0 type rack
step emit
rule replicated_rule {
id 0
type replicated
- min_size 1
- max_size 10
step take default class hdd
step chooseleaf firstn 0 type rack
step emit
{ "rule_id": 1,
"rule_name": "erasurepool",
"type": 3,
- "min_size": 3,
- "max_size": 20,
"steps": [
{ "op": "take",
"item": -1,
{ "rule_id": 1,
"rule_name": "erasurepool",
"type": 3,
- "min_size": 3,
- "max_size": 20,
"steps": [
{ "op": "take",
"item": -1,
rule erasurepool {
id 1
type erasure
- min_size 3
- max_size 20
step set_chooseleaf_tries 5
step set_choose_tries 100
step take default
out << "\ttype " << crush.get_rule_type(i) << "\n";
}
- out << "\tmin_size " << crush.get_rule_mask_min_size(i) << "\n";
- out << "\tmax_size " << crush.get_rule_mask_max_size(i) << "\n";
-
for (int j=0; j<crush.get_rule_len(i); j++) {
switch (crush.get_rule_op(i, j)) {
case CRUSH_RULE_NOOP:
else
ceph_abort();
- int minsize = int_node(i->children[start+4]);
- int maxsize = int_node(i->children[start+6]);
-
- int steps = i->children.size() - start - 8;
- //err << "num steps " << steps << std::endl;
+ // ignore min_size+max_size and find first step
+ int step_start = 0;
+ int steps = 0;
+ for (unsigned p = start + 3; p < i->children.size()-1; ++p) {
+ string tag = string_node(i->children[p]);
+ if (tag == "min_size" || tag == "max_size") {
+ cerr << "WARNING: " << tag << " is no longer supported, ignoring" << std::endl;
+ ++p;
+ continue;
+ }
+ // has to be a step--grammer doesn't recognized anything else
+ assert(i->children[p].value.id().to_long() == crush_grammar::_step);
+ step_start = p;
+ steps = i->children.size() - p - 1;
+ break;
+ }
+ //err << "num steps " << steps << " start " << step_start << std::endl;
if (crush.rule_exists(ruleno)) {
err << "rule " << ruleno << " already exists" << std::endl;
return -1;
}
- int r = crush.add_rule(ruleno, steps, type, minsize, maxsize);
+ int r = crush.add_rule(ruleno, steps, type);
if (r != ruleno) {
err << "unable to add rule id " << ruleno << " for rule '" << rname
<< "'" << std::endl;
}
int step = 0;
- for (iter_t p = i->children.begin() + start + 7; step < steps; p++) {
+ for (iter_t p = i->children.begin() + step_start; step < steps; p++) {
iter_t s = p->children.begin() + 1;
int stepid = s->value.id().to_long();
switch (stepid) {
int steps = 3;
if (mode == "indep")
steps = 5;
- int min_rep = mode == "firstn" ? 1 : 3;
- int max_rep = mode == "firstn" ? 10 : 20;
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_rep, max_rep);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
ceph_assert(rule);
int step = 0;
if (mode == "indep") {
continue;
encode(crush->rules[i]->len, bl);
- encode(crush->rules[i]->mask, bl);
+
+ /*
+ * legacy crush_rule_mask was
+ *
+ * struct crush_rule_mask {
+ * __u8 ruleset;
+ * __u8 type;
+ * __u8 min_size;
+ * __u8 max_size;
+ * };
+ *
+ * encode ruleset=ruleid, and min/max of 1/100
+ */
+ encode((__u8)i, bl); // ruleset == ruleid
+ encode(crush->rules[i]->type, bl);
+ if (HAVE_FEATURE(features, SERVER_QUINCY)) {
+ encode((__u8)1, bl); // min_size = 1
+ encode((__u8)100, bl); // max_size = 100
+ } else {
+ encode(crush->rules[i]->deprecated_min_size, bl);
+ encode(crush->rules[i]->deprecated_max_size, bl);
+ }
+
for (unsigned j=0; j<crush->rules[i]->len; j++)
encode(crush->rules[i]->steps[j], bl);
}
decode(len, blp);
crush->rules[i] = reinterpret_cast<crush_rule*>(calloc(1, crush_rule_size(len)));
crush->rules[i]->len = len;
- decode(crush->rules[i]->mask, blp);
+
+ __u8 ruleset; // ignore + discard
+ decode(ruleset, blp);
+ if (ruleset != i) {
+ throw ::ceph::buffer::malformed_input("crush ruleset_id != rule_id; encoding is too old");
+ }
+ decode(crush->rules[i]->type, blp);
+ decode(crush->rules[i]->deprecated_min_size, blp);
+ decode(crush->rules[i]->deprecated_max_size, blp);
+
for (unsigned j=0; j<crush->rules[i]->len; j++)
decode(crush->rules[i]->steps[j], blp);
}
if (get_rule_name(rule_id))
f->dump_string("rule_name", get_rule_name(rule_id));
f->dump_int("type", get_rule_type(rule_id));
- f->dump_int("min_size", get_rule_mask_min_size(rule_id));
- f->dump_int("max_size", get_rule_mask_max_size(rule_id));
f->open_array_section("steps");
for (int j=0; j<get_rule_len(rule_id); j++) {
f->open_object_section("step");
typedef mempool::osdmap::map<int64_t,std::string> name_map_t;
}
-WRITE_RAW_ENCODER(crush_rule_mask) // it's all u8's
-
inline void encode(const crush_rule_step &s, ceph::buffer::list &bl)
{
using ceph::encode;
int get_rule_type(unsigned ruleno) const {
crush_rule *r = get_rule(ruleno);
if (IS_ERR(r)) return -1;
- return r->mask.type;
- }
- int get_rule_mask_min_size(unsigned ruleno) const {
- crush_rule *r = get_rule(ruleno);
- if (IS_ERR(r)) return -1;
- return r->mask.min_size;
- }
- int get_rule_mask_max_size(unsigned ruleno) const {
- crush_rule *r = get_rule(ruleno);
- if (IS_ERR(r)) return -1;
- return r->mask.max_size;
+ return r->type;
}
int get_rule_op(unsigned ruleno, unsigned step) const {
crush_rule_step *s = get_rule_step(ruleno, step);
/* modifiers */
- int add_rule(int ruleno, int len, int type, int minsize, int maxsize) {
+ int add_rule(int ruleno, int len, int type) {
if (!crush) return -ENOENT;
- crush_rule *n = crush_make_rule(len, ruleno, type, minsize, maxsize);
+ crush_rule *n = crush_make_rule(len, type);
ceph_assert(n);
ruleno = crush_add_rule(crush, n, ruleno);
return ruleno;
}
- int set_rule_mask_max_size(unsigned ruleno, int max_size) {
- crush_rule *r = get_rule(ruleno);
- if (IS_ERR(r)) return -1;
- return r->mask.max_size = max_size;
- }
int set_rule_step(unsigned ruleno, unsigned step, int op, int arg1, int arg2) {
if (!crush) return -ENOENT;
crush_rule *n = get_rule(ruleno);
int find_first_rule(int type) const {
for (size_t i = 0; i < crush->max_rules; ++i) {
if (crush->rules[i]
- && crush->rules[i]->mask.type == type) {
+ && crush->rules[i]->type == type) {
return i;
}
}
return r;
}
-struct crush_rule *crush_make_rule(int len, int ruleid, int type, int minsize, int maxsize)
+struct crush_rule *crush_make_rule(int len, int type)
{
struct crush_rule *rule;
rule = malloc(crush_rule_size(len));
if (!rule)
return NULL;
rule->len = len;
- rule->mask.ruleset = ruleid; // these always match now
- rule->mask.type = type;
- rule->mask.min_size = minsize;
- rule->mask.max_size = maxsize;
+ rule->type = type;
+ rule->deprecated_min_size = 1;
+ rule->deprecated_max_size = 100;
return rule;
}
/** @ingroup API
*
* Allocate an empty crush_rule structure large enough to store __len__ steps.
- * Steps can be added to a rule via crush_rule_set_step().
- *
- * The rule is designed to allow crush_do_rule() to get at least __minsize__ items
- * and at most __maxsize__ items.
- *
- * The __type__ is defined by the caller and will be used by
- * crush_find_rule() when looking for a rule and by
- * __CRUSH_RULE_CHOOSE*__ steps when looking for items.
+ * Steps can be added to a rule via crush_rule_set_step().
*
* The caller is responsible for deallocating the returned pointer via
* crush_destroy_rule().
* If __malloc(3)__ fails, return NULL.
*
* @param len number of steps in the rule
- * @param ruleid user defined value
* @param type user defined value
- * @param minsize minimum number of items the rule can map
- * @param maxsize maximum number of items the rule can map
*
* @returns a pointer to the newly created rule or NULL
*/
-extern struct crush_rule *crush_make_rule(int len, int ruleid, int type, int minsize, int maxsize);
+extern struct crush_rule *crush_make_rule(int len, int type);
/** @ingroup API
*
* Set the __pos__ step of the __rule__ to an operand and up to two arguments.
#define CRUSH_CHOOSE_N 0
#define CRUSH_CHOOSE_N_MINUS(x) (-(x))
-/*
- * The rule mask is used to describe what the rule is intended for.
- * Given a ruleset and size of output set, we search through the
- * rule list for a matching rule_mask.
- */
-struct crush_rule_mask {
- __u8 ruleset; /* always matches rule_id now */
- __u8 type;
- __u8 min_size;
- __u8 max_size;
-};
-
struct crush_rule {
__u32 len;
- struct crush_rule_mask mask;
+ __u8 __unused_was_rule_mask_ruleset;
+ __u8 type;
+ __u8 deprecated_min_size;
+ __u8 deprecated_max_size;
struct crush_rule_step steps[0];
};
step_emit );
crushrule = str_p("rule") >> !name >> '{'
>> (str_p("id") | str_p("ruleset")) >> posint
- >> str_p("type") >> ( str_p("replicated") | str_p("erasure") )
- >> str_p("min_size") >> posint
- >> str_p("max_size") >> posint
+ >> str_p("type") >> ( str_p("replicated") | str_p("erasure") )
+ >> !(str_p("min_size") >> posint)
+ >> !(str_p("max_size") >> posint)
>> +step
>> '}';
if (ruleid < 0)
return ruleid;
- crush.set_rule_mask_max_size(ruleid, get_chunk_count());
return ruleid;
}
}
int steps = 4 + rule_steps.size();
- int min_rep = 3;
- int max_rep = get_chunk_count();
int ret;
- ret = crush.add_rule(rno, steps, pg_pool_t::TYPE_ERASURE,
- min_rep, max_rep);
+ ret = crush.add_rule(rno, steps, pg_pool_t::TYPE_ERASURE);
ceph_assert(ret == rno);
int step = 0;
rule data {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule metadata {
\tid 1 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule rbd {
\tid 2 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
$ crushtool -i six --add-item 6 1.0 device6 --loc host host0 --loc cluster cluster0 -o seven > /dev/null
$ crushtool -i seven --add-item 7 1.0 device7 --loc host host0 --loc cluster cluster0 -o eight > /dev/null
$ crushtool -d eight -o final
- $ cmp final "$TESTDIR/tree.template.final"
+ $ diff final "$TESTDIR/tree.template.final"
rule data {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule metadata {
\tid 1 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule rbd {
\tid 2 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule simple-rule {
\tid 3 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule data {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule metadata {
\tid 1 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule rbd {
\tid 2 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take cluster0 (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
# end crush map
$ crushtool -d two -o final
- $ cmp final "$TESTDIR/simple.template.two"
+ $ diff final "$TESTDIR/simple.template.two"
$ crushtool -i two --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o three 2>/dev/null >/dev/null || echo FAIL
FAIL
$ crushtool -i two --remove-item device1 -o four > /dev/null
$ crushtool -d four -o final
- $ cmp final "$TESTDIR/simple.template.four"
+ $ diff final "$TESTDIR/simple.template.four"
$ crushtool -i two --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o five > /dev/null
$ crushtool -d five -o final
- $ cmp final "$TESTDIR/simple.template.five"
+ $ diff final "$TESTDIR/simple.template.five"
$ crushtool -i five --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o six > /dev/null
$ crushtool -i five --show-location 1
cluster\tcluster0 (esc)
host\thost1 (esc)
$ crushtool -d six -o final
- $ cmp final "$TESTDIR/simple.template.five"
+ $ diff final "$TESTDIR/simple.template.five"
$ crushtool -i one --add-item 0 2.0 device0 --loc host fake --loc cluster cluster0 -o two > /dev/null
$ crushtool -d two -o final
- $ cmp final "$TESTDIR/simple.template.adj.two"
+ $ diff final "$TESTDIR/simple.template.adj.two"
#
# update the weight of device0 in host=host0, it will not affect the weight of device0 in host=fake
$ crushtool -i two --update-item 0 3.0 device0 --loc host host0 --loc cluster cluster0 -o three > /dev/null
$ crushtool -d three -o final
- $ cmp final "$TESTDIR/simple.template.adj.three"
+ $ diff final "$TESTDIR/simple.template.adj.three"
rule replicated_rule {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take root (esc)
\tstep chooseleaf firstn 0 type node (esc)
\tstep emit (esc)
rule rule-firstn {
id 0
type replicated
- min_size 1
- max_size 10
step take root
step choose firstn 0 type osd
step emit
rule rule-indep {
id 1
type erasure
- min_size 1
- max_size 10
step take root
step choose indep 0 type osd
step emit
rule replicated_rule {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take root (esc)
\tstep chooseleaf firstn 0 type root (esc)
\tstep emit (esc)
rule rule-r0 {
id 0
type replicated
- min_size 1
- max_size 3
step take host0
step choose firstn 0 type osd
step emit
rule rule-r1 {
id 0
type replicated
- min_size 1
- max_size 1
step take host0
step choose firstn 0 type osd
step emit
rule rule-r2 {
id 0
type replicated
- min_size 1
- max_size 2
step take host0
step choose firstn 0 type osd
step emit
rule rule-r3 {
id 0
type replicated
- min_size 2
- max_size 3
step take host0
step choose indep 0 type osd
step emit
rule rule-r4 {
id 0
type replicated
- min_size 4
- max_size 5
step take host0
step choose indep 0 type osd
step emit
rule rule-e0 {
id 0
type erasure
- min_size 1
- max_size 10
step take host0
step choose indep 0 type osd
step emit
rule rule-e1 {
id 1
type erasure
- min_size 1
- max_size 10
step take host0
step choose indep 0 type osd
step emit
rule data {
id 3
type replicated
- min_size 2
- max_size 2
step take root
step chooseleaf firstn 0 type rack
step emit
"rule_id": 3,
"rule_name": "data",
"type": 1,
- "min_size": 2,
- "max_size": 2,
"steps": [
{
"op": "take",
$ cmp nto.compiled nto.recompiled
$ crushtool -c "$TESTDIR/missing-bucket.crushmap.txt"
+ WARNING: min_size is no longer supported, ignoring
+ WARNING: max_size is no longer supported, ignoring
in rule 'rule-bad' item 'root-404' not defined
[1]
rule data-ssd {
id 1
type replicated
- min_size 2
- max_size 2
step take root class ssd
step chooseleaf firstn 0 type rack
step emit
rule data-hdd {
id 2
type replicated
- min_size 2
- max_size 2
step take root class hdd
step chooseleaf firstn 0 type rack
step emit
rule data {
id 3
type replicated
- min_size 2
- max_size 2
step take root
step chooseleaf firstn 0 type rack
step emit
$ crushtool -c "$TESTDIR/empty-default.cushmap.txt"
+ WARNING: min_size is no longer supported, ignoring
+ WARNING: max_size is no longer supported, ignoring
crushtool successfully built or modified map. Use '-o <file>' to write it out.
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 1
type replicated
- min_size 2
- max_size 2
step take root
step chooseleaf firstn 0 type rack
step emit
$ crushtool -c $TESTDIR/rules.txt --create-replicated-rule foo default host -o one > /dev/null
+ WARNING: min_size is no longer supported, ignoring
+ WARNING: max_size is no longer supported, ignoring
$ crushtool -d one
# begin crush map
rule data {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take default (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule foo {
\tid 1 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take default (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
$ crushtool -c $TESTDIR/rules.txt --create-replicated-rule foo-ssd default host -o two --device-class ssd > /dev/null
+ WARNING: min_size is no longer supported, ignoring
+ WARNING: max_size is no longer supported, ignoring
$ crushtool -d two
# begin crush map
rule data {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take default (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule foo-ssd {
\tid 1 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take default class ssd (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule choose {
id 0
type replicated
- min_size 2
- max_size 3
step take root0
step choose firstn 0 type host
step choose firstn 1 type device
rule choose-two {
id 1
type replicated
- min_size 2
- max_size 3
step take root0
step choose firstn 0 type device
step emit
rule chooseleaf {
id 2
type replicated
- min_size 2
- max_size 3
step take root0
step chooseleaf firstn 0 type host
step emit
rule choose-set {
id 3
type replicated
- min_size 2
- max_size 3
step set_choose_tries 3
step set_choose_local_tries 2
step set_choose_local_fallback_tries 2
rule choose-set-two {
id 4
type replicated
- min_size 2
- max_size 3
step set_choose_tries 3
step set_choose_local_tries 2
step set_choose_local_fallback_tries 2
rule chooseleaf-set {
id 5
type replicated
- min_size 2
- max_size 3
step set_choose_tries 3
step set_choose_local_tries 2
step set_choose_local_fallback_tries 2
rule first_rule {
id 0
type replicated
- min_size 1
- max_size 10
step take root
step choose firstn 0 type device
step emit
rule indep_rule {
id 1
type erasure
- min_size 3
- max_size 20
step set_chooseleaf_tries 5
step take root
step choose indep 0 type device
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster1
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster1
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule replicated_rule {
id 0
type replicated
- min_size 1
- max_size 10
step take default
step chooseleaf firstn 0 type host
step emit
rule myrule {
id 0
type replicated
- min_size 1
- max_size 10
step take root
step choose firstn 2 type rack
step chooseleaf indep 4 type host
rule myrule1 {
id 1
type replicated
- min_size 1
- max_size 10
step take root
step choose firstn 2 type rack
step chooseleaf indep 1 type host
rule data {
id 0
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule metadata {
id 1
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule rbd {
id 2
type replicated
- min_size 1
- max_size 10
step take cluster0
step chooseleaf firstn 0 type host
step emit
rule replicated_rule {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take default (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
rule replicated_rule {
\tid 0 (esc)
\ttype replicated (esc)
- \tmin_size 1 (esc)
- \tmax_size 10 (esc)
\tstep take default (esc)
\tstep chooseleaf firstn 0 type host (esc)
\tstep emit (esc)
// choose + choose
{
cout << "take + choose + choose + choose + emit" << std::endl;
- int rule = c.add_rule(2, 5, 0, 1, 10);
+ int rule = c.add_rule(2, 5, 0);
ASSERT_EQ(2, rule);
c.set_rule_step_take(rule, 0, bno);
c.set_rule_step_choose_indep(rule, 1, 2, 2);
}
int ret;
int ruleno = 0;
- ret = c->add_rule(ruleno, 4, 123, 1, 20);
+ ret = c->add_rule(ruleno, 4, 123);
ceph_assert(ret == ruleno);
ret = c->set_rule_step(ruleno, 0, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 10, 0);
ceph_assert(ret == 0);
}
string root_name = "default";
int root = crush.get_item_id(root_name);
- int min_size = 3;
- int max_size = 4;
int steps = 6;
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_size, max_size);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
int step = 0;
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0);
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0);
if (!crush.rule_exists(rno))
break;
}
- int min_size = 3;
- int max_size = 3;
int steps = 7;
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_size, max_size);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
int step = 0;
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0);
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0);
if (!crush.rule_exists(rno))
break;
}
- int min_size = 3;
- int max_size = 3;
int steps = 7;
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_size, max_size);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
int step = 0;
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0);
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0);
if (!crush.rule_exists(rno))
break;
}
- int min_size = 3;
- int max_size = 3;
int steps = 8;
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_size, max_size);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
int step = 0;
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0);
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0);
int dc1 = crush.get_item_id(dc_1);
string dc_2 = "dc-1";
int dc2 = crush.get_item_id(dc_2);
- int min_size = 1;
- int max_size = 20;
int steps = 8;
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_size, max_size);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
int step = 0;
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0);
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0);
if (!crush.rule_exists(rno))
break;
}
- int min_size = 1;
- int max_size = 20;
int steps = 6;
string root_name = "default";
int root = crush.get_item_id(root_name);
- crush_rule *rule = crush_make_rule(steps, rno, rule_type, min_size, max_size);
+ crush_rule *rule = crush_make_rule(steps, rule_type);
int step = 0;
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSELEAF_TRIES, 5, 0);
crush_rule_set_step(rule, step++, CRUSH_RULE_SET_CHOOSE_TRIES, 100, 0);