Adjust CLI test cases accordingly.
Note that the reclassify outputs changed slightly because the original
maps have min/max_size that vary between rules, so we can't get the exact
same output.
Signed-off-by: Sage Weil <sage@newdream.net>
min_x = 0;
max_x = 1023;
}
+ if (min_rep < 0 && max_rep < 0) {
+ cerr << "must specify --num-rep or both --min-rep and --max-rep" << std::endl;
+ return -EINVAL;
+ }
// initial osd weights
vector<__u32> weight;
err << "rule " << r << " dne" << std::endl;
continue;
}
- int minr = min_rep, maxr = max_rep;
- if (min_rep < 0 || max_rep < 0) {
- minr = crush.get_rule_mask_min_size(r);
- maxr = crush.get_rule_mask_max_size(r);
- }
if (output_statistics)
err << "rule " << r << " (" << crush.get_rule_name(r)
<< "), x = " << min_x << ".." << max_x
- << ", numrep = " << minr << ".." << maxr
+ << ", numrep = " << min_rep << ".." << max_rep
<< std::endl;
- for (int nr = minr; nr <= maxr; nr++) {
+ for (int nr = min_rep; nr <= max_rep; nr++) {
vector<int> per(crush.get_max_devices());
map<int,int> sizes;
err << "rule " << r << " dne" << std::endl;
continue;
}
- int minr = min_rep, maxr = max_rep;
- if (min_rep < 0 || max_rep < 0) {
- minr = crush.get_rule_mask_min_size(r);
- maxr = crush.get_rule_mask_max_size(r);
- }
int bad = 0;
- for (int nr = minr; nr <= maxr; nr++) {
+ for (int nr = min_rep; nr <= max_rep; nr++) {
for (int x = min_x; x <= max_x; ++x) {
vector<int> out;
crush.do_rule(r, x, out, nr, weight, 0);
if (bad) {
ret = -1;
}
- int max = (maxr - minr + 1) * (max_x - min_x + 1);
+ int max = (max_rep - min_rep + 1) * (max_x - min_x + 1);
double ratio = (double)bad / (double)max;
cout << "rule " << r << " had " << bad << "/" << max
<< " mismatched mappings (" << ratio << ")" << std::endl;
# end crush map
# tunables before reweight
- $ crushtool -i "$map" --set-straw-calc-version 0 --reweight --test --show-utilization --max-x 100 --min-x 1
+ $ crushtool -i "$map" --set-straw-calc-version 0 --reweight --test --show-utilization --max-x 100 --min-x 1 --min-rep 1 --max-rep 10
rule 0 (replicated_rule), x = 1..100, numrep = 1..10
rule 0 (replicated_rule) num_rep 1 result size == 1:\t100/100 (esc)
device 0:\t\t stored : 4\t expected : 4 (esc)
device 23:\t\t stored : 13\t expected : 20 (esc)
device 24:\t\t stored : 18\t expected : 20 (esc)
crushtool successfully built or modified map. Use '-o <file>' to write it out.
- $ crushtool -i "$map" --set-straw-calc-version 1 --reweight --test --show-utilization --max-x 100 --min-x 1
+ $ crushtool -i "$map" --set-straw-calc-version 1 --reweight --test --show-utilization --max-x 100 --min-x 1 --min-rep 1 --max-rep 10
rule 0 (replicated_rule), x = 1..100, numrep = 1..10
rule 0 (replicated_rule) num_rep 1 result size == 1:\t100/100 (esc)
device 1:\t\t stored : 1\t expected : 4 (esc)
moving items from -23 (ttipod001-cephosd-1-ssd) to -7 (ttipod001-cephosd-1)
moving items from -22 (ttipod001-cephosd-2-ssd) to -8 (ttipod001-cephosd-2)
moving items from -21 (ssd) to -5 (default)
- $ crushtool -i $TESTDIR/crush-classes/a --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/a --compare foo --min-rep 1 --max-rep 10
rule 0 had 0/10240 mismatched mappings (0)
rule 1 had 0/10240 mismatched mappings (0)
maps appear equivalent
moving items from -9 (node-21-ssd) to -25 (node-21)
moving items from -8 (node-20-ssd) to -18 (node-20)
moving items from -7 (ssd) to -13 (default)
- $ crushtool -i $TESTDIR/crush-classes/d --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/d --compare foo --min-rep 1 --max-rep 10
rule 0 had 0/10240 mismatched mappings (0)
rule 1 had 0/10240 mismatched mappings (0)
maps appear equivalent
this one has weird node weights, so *lots* of mappings change...
- $ crushtool -i $TESTDIR/crush-classes/e --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/e --compare foo --min-rep 1 --max-rep 10
rule 0 had 6540/10240 mismatched mappings (0.638672)
rule 1 had 8417/10240 mismatched mappings (0.821973)
warning: maps are NOT equivalent
wonky crush weights on Ceph-Stor1, so a small number of mappings change
because the new map has a strictly summing hierarchy.
- $ crushtool -i $TESTDIR/crush-classes/c --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/c --compare foo --min-rep 1 --max-rep 10
rule 0 had 158/10240 mismatched mappings (0.0154297)
- rule 1 had 62/5120 mismatched mappings (0.0121094)
+ rule 1 had 138/10240 mismatched mappings (0.0134766)
rule 2 had 0/10240 mismatched mappings (0)
warning: maps are NOT equivalent
[1]
renumbering bucket -83 -> -55
renumbering bucket -73 -> -56
renumbering bucket -69 -> -57
- $ crushtool -i $TESTDIR/crush-classes/beesly --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/beesly --compare foo --min-rep 1 --max-rep 10
rule 0 had 0/10240 mismatched mappings (0)
rule 1 had 0/10240 mismatched mappings (0)
rule 2 had 0/10240 mismatched mappings (0)
renumbering bucket -4 -> -11
renumbering bucket -3 -> -13
renumbering bucket -2 -> -14
- $ crushtool -i $TESTDIR/crush-classes/flax --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/flax --compare foo --min-rep 1 --max-rep 10
rule 0 had 0/10240 mismatched mappings (0)
maps appear equivalent
renumbering bucket -14 -> -200
renumbering bucket -5 -> -201
renumbering bucket -2 -> -202
- $ crushtool -i $TESTDIR/crush-classes/gabe2 --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/gabe2 --compare foo --min-rep 1 --max-rep 10
rule 0 had 627/10240 mismatched mappings (0.0612305)
- rule 1 had 422/6144 mismatched mappings (0.0686849)
+ rule 1 had 652/10240 mismatched mappings (0.0636719)
warning: maps are NOT equivalent
[1]
new bucket -155 missing parent, adding at {root=default}
new bucket -154 missing parent, adding at {root=default}
- $ crushtool -i $TESTDIR/crush-classes/b --compare foo
- rule 0 had 0/3072 mismatched mappings (0)
- rule 1 had 0/4096 mismatched mappings (0)
+ $ crushtool -i $TESTDIR/crush-classes/b --compare foo --min-rep 1 --max-rep 10
+ rule 0 had 0/10240 mismatched mappings (0)
+ rule 1 had 0/10240 mismatched mappings (0)
maps appear equivalent
$ crushtool -i $TESTDIR/crush-classes/f --reclassify --reclassify-root default hdd -o foo
We expect some mismatches below because there are some ssd-labeled nodes under
default that we aren't changing the class on.
- $ crushtool -i $TESTDIR/crush-classes/f --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/f --compare foo --min-rep 1 --max-rep 10
rule 0 had 627/10240 mismatched mappings (0.0612305)
- rule 1 had 422/6144 mismatched mappings (0.0686849)
+ rule 1 had 652/10240 mismatched mappings (0.0636719)
warning: maps are NOT equivalent
[1]
moving items from -4 (sata-osd14) to -87 (osd14)
moving items from -3 (sata-osd10) to -86 (osd10)
moving items from -2 (sata-osd11) to -85 (osd11)
- $ crushtool -i $TESTDIR/crush-classes/g --compare foo
+ $ crushtool -i $TESTDIR/crush-classes/g --compare foo --min-rep 1 --max-rep 10
rule 0 had 0/10240 mismatched mappings (0)
rule 1 had 0/10240 mismatched mappings (0)
maps appear equivalent
$ crushtool -c "$TESTDIR/set-choose.crushmap.txt" -o set-choose.crushmap
- $ crushtool -i set-choose.crushmap --test --show-mappings --show-statistics --set-straw-calc-version 0
+ $ crushtool -i set-choose.crushmap --test --show-mappings --show-statistics --set-straw-calc-version 0 --min-rep 2 --max-rep 3
rule 0 (choose), x = 0..1023, numrep = 2..3
CRUSH rule 0 x 0 [0,3]
CRUSH rule 0 x 1 [0,8]
CRUSH rule 5 x 1023 [3,2,8]
rule 5 (chooseleaf-set) num_rep 3 result size == 3:\t1024/1024 (esc)
crushtool successfully built or modified map. Use '-o <file>' to write it out.
- $ crushtool -i set-choose.crushmap --test --show-mappings --show-statistics --weight 0 0 --weight 1 0 --weight 3 0 --weight 4 0 --set-straw-calc-version 0
+ $ crushtool -i set-choose.crushmap --test --show-mappings --show-statistics --weight 0 0 --weight 1 0 --weight 3 0 --weight 4 0 --set-straw-calc-version 0 --min-rep 2 --max-rep 3
rule 0 (choose), x = 0..1023, numrep = 2..3
CRUSH rule 0 x 0 [2,5]
CRUSH rule 0 x 1 [2,8]
CRUSH rule 5 x 1023 [5,2,8]
rule 5 (chooseleaf-set) num_rep 3 result size == 3:\t1024/1024 (esc)
crushtool successfully built or modified map. Use '-o <file>' to write it out.
- $ crushtool -i set-choose.crushmap --test --show-mappings --show-statistics --weight 0 0 --weight 3 0 --weight 4 .5 --weight 5 0 --weight 6 .1 --weight 7 0 --set-straw-calc-version 0
+ $ crushtool -i set-choose.crushmap --test --show-mappings --show-statistics --weight 0 0 --weight 3 0 --weight 4 .5 --weight 5 0 --weight 6 .1 --weight 7 0 --set-straw-calc-version 0 --min-rep 2 --max-rep 3
rule 0 (choose), x = 0..1023, numrep = 2..3
CRUSH rule 0 x 0 [2,4]
CRUSH rule 0 x 1 [2,8]
- $ crushtool -i "$TESTDIR/test-map-a.crushmap" --test --show-mappings --show-statistics --rule 0 --set-choose-local-tries 0 --set-choose-local-fallback-tries 0 --set-choose-total-tries 50 --set-chooseleaf-descend-once 1
+ $ crushtool -i "$TESTDIR/test-map-a.crushmap" --test --show-mappings --show-statistics --rule 0 --set-choose-local-tries 0 --set-choose-local-fallback-tries 0 --set-choose-total-tries 50 --set-chooseleaf-descend-once 1 --min-rep 1 --max-rep 10
rule 0 (data), x = 0..1023, numrep = 1..10
CRUSH rule 0 x 0 [36]
CRUSH rule 0 x 1 [876]
- $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 0 --set-choose-local-tries 0 --set-choose-local-fallback-tries 0 --set-choose-total-tries 50 --set-chooseleaf-descend-once 1 --set-chooseleaf-vary-r 1 --weight 12 0 --weight 20 0 --weight 30 0
+ $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 0 --set-choose-local-tries 0 --set-choose-local-fallback-tries 0 --set-choose-total-tries 50 --set-chooseleaf-descend-once 1 --set-chooseleaf-vary-r 1 --weight 12 0 --weight 20 0 --weight 30 0 --min-rep 1 --max-rep 10
rule 0 (data), x = 0..1023, numrep = 1..10
CRUSH rule 0 x 0 [101]
CRUSH rule 0 x 1 [80]
$ crushtool -c "$TESTDIR/test-map-firstn-indep.txt" -o "$TESTDIR/test-map-firstn-indep.crushmap"
- $ crushtool -i "$TESTDIR/test-map-firstn-indep.crushmap" --test --rule 0 --x 1 --show-bad-mappings
+ $ crushtool -i "$TESTDIR/test-map-firstn-indep.crushmap" --test --rule 0 --x 1 --show-bad-mappings --min-rep 1 --max-rep 10
bad mapping rule 0 x 1 num_rep 9 result [93,80,88,87,56,50,53,72]
bad mapping rule 0 x 1 num_rep 10 result [93,80,88,87,56,50,53,72]
- $ crushtool -i "$TESTDIR/test-map-firstn-indep.crushmap" --test --rule 1 --x 1 --show-bad-mappings
+ $ crushtool -i "$TESTDIR/test-map-firstn-indep.crushmap" --test --rule 1 --x 1 --show-bad-mappings --min-rep 1 --max-rep 10
bad mapping rule 1 x 1 num_rep 3 result [93,56]
bad mapping rule 1 x 1 num_rep 4 result [93,56]
bad mapping rule 1 x 1 num_rep 5 result [93,56]
- $ crushtool -i "$TESTDIR/test-map-hammer-tunables.crushmap" --test --show-mappings --show-statistics --rule 0 --weight 12 0 --weight 20 0 --weight 30 0
+ $ crushtool -i "$TESTDIR/test-map-hammer-tunables.crushmap" --test --show-mappings --show-statistics --rule 0 --weight 12 0 --weight 20 0 --weight 30 0 --min-rep 1 --max-rep 10
rule 0 (data), x = 0..1023, numrep = 1..10
CRUSH rule 0 x 0 [101]
CRUSH rule 0 x 1 [80]
- $ crushtool -i "$TESTDIR/test-map-indep.crushmap" --test --show-mappings --show-statistics --rule 1 --set-choose-local-tries 0 --set-choose-local-fallback-tries 0 --set-choose-total-tries 50 --set-chooseleaf-descend-once 2
+ $ crushtool -i "$TESTDIR/test-map-indep.crushmap" --test --show-mappings --show-statistics --rule 1 --set-choose-local-tries 0 --set-choose-local-fallback-tries 0 --set-choose-total-tries 50 --set-chooseleaf-descend-once 2 --min-rep 1 --max-rep 10
rule 1 (metadata), x = 0..1023, numrep = 1..10
CRUSH rule 1 x 0 [36]
CRUSH rule 1 x 1 [876]
- $ crushtool -i "$TESTDIR/test-map-jewel-tunables.crushmap" --test --show-mappings --show-statistics --rule 0 --weight 12 0 --weight 20 0 --weight 30 0
+ $ crushtool -i "$TESTDIR/test-map-jewel-tunables.crushmap" --test --show-mappings --show-statistics --rule 0 --weight 12 0 --weight 20 0 --weight 30 0 --min-rep 1 --max-rep 10
rule 0 (data), x = 0..1023, numrep = 1..10
CRUSH rule 0 x 0 [101]
CRUSH rule 0 x 1 [80]
- $ crushtool -i "$TESTDIR/test-map-a.crushmap" --test --show-mappings --show-statistics --rule 0
+ $ crushtool -i "$TESTDIR/test-map-a.crushmap" --test --show-mappings --show-statistics --rule 0 --min-rep 1 --max-rep 10
rule 0 (data), x = 0..1023, numrep = 1..10
CRUSH rule 0 x 0 [36]
CRUSH rule 0 x 1 [876]
- $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 0 --weight 0 0 --weight 4 0 --weight 9 0
+ $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 0 --weight 0 0 --weight 4 0 --weight 9 0 --min-rep 2 --max-rep 4
rule 3 (delltestrule), x = 0..1023, numrep = 2..4
CRUSH rule 3 x 0 [94,85]
CRUSH rule 3 x 1 [73,78]
- $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 1 --weight 0 0 --weight 4 0 --weight 9 0
+ $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 1 --weight 0 0 --weight 4 0 --weight 9 0 --min-rep 2 --max-rep 4
rule 3 (delltestrule), x = 0..1023, numrep = 2..4
CRUSH rule 3 x 0 [94,6]
CRUSH rule 3 x 1 [73,52]
- $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 2 --weight 0 0 --weight 4 0 --weight 9 0
+ $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 2 --weight 0 0 --weight 4 0 --weight 9 0 --min-rep 2 --max-rep 4
rule 3 (delltestrule), x = 0..1023, numrep = 2..4
CRUSH rule 3 x 0 [94,45]
CRUSH rule 3 x 1 [73,78]
- $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 3 --weight 0 0 --weight 4 0 --weight 9 0
+ $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 3 --weight 0 0 --weight 4 0 --weight 9 0 --min-rep 2 --max-rep 4
rule 3 (delltestrule), x = 0..1023, numrep = 2..4
CRUSH rule 3 x 0 [94,85]
CRUSH rule 3 x 1 [73,78]
- $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 4 --weight 0 0 --weight 4 0 --weight 9 0
+ $ crushtool -i "$TESTDIR/test-map-vary-r.crushmap" --test --show-mappings --show-statistics --rule 3 --set-chooseleaf-vary-r 4 --weight 0 0 --weight 4 0 --weight 9 0 --min-rep 2 --max-rep 4
rule 3 (delltestrule), x = 0..1023, numrep = 2..4
CRUSH rule 3 x 0 [94,85]
CRUSH rule 3 x 1 [73,78]