ceph osd crush weight-set reweight-compat osd.0 2 || return 1
ceph osd crush tree
- ceph osd crush tree | grep host | grep '6.00000 5.00000' || return 1
+ ceph osd crush tree | grep host | grep '6.00000 5.00000' || return 1
run_osd $dir 2 || return 1
ceph osd crush tree
- ceph osd crush tree | grep host | grep '9.00000 5.00000' || return 1
+ ceph osd crush tree | grep host | grep '9.00000 5.00000' || return 1
ceph osd crush reweight osd.2 4
ceph osd crush tree
- ceph osd crush tree | grep host | grep '10.00000 5.00000' || return 1
+ ceph osd crush tree | grep host | grep '10.00000 5.00000' || return 1
ceph osd crush weight-set reweight-compat osd.2 4
ceph osd crush tree
- ceph osd crush tree | grep host | grep '10.00000 9.00000' || return 1
+ ceph osd crush tree | grep host | grep '10.00000 9.00000' || return 1
}
function TEST_move_bucket() {
ceph osd crush weight-set reweight-compat osd.0 2 || return 1
ceph osd crush weight-set reweight-compat osd.1 2 || return 1
ceph osd crush tree
- ceph osd crush tree | grep HOST | grep '6.00000 4.00000' || return 1
+ ceph osd crush tree | grep HOST | grep '6.00000 4.00000' || return 1
# moving a bucket adjusts the weights
ceph osd crush add-bucket RACK rack root=default || return 1
ceph osd crush move HOST rack=RACK || return 1
ceph osd crush tree
- ceph osd crush tree | grep HOST | grep '6.00000 4.00000' || return 1
- ceph osd crush tree | grep RACK | grep '6.00000 4.00000' || return 1
+ ceph osd crush tree | grep HOST | grep '6.00000 4.00000' || return 1
+ ceph osd crush tree | grep RACK | grep '6.00000 4.00000' || return 1
# weight-set reweight adjusts containing buckets
ceph osd crush weight-set reweight-compat osd.0 1 || return 1
ceph osd crush tree
- ceph osd crush tree | grep HOST | grep '6.00000 3.00000' || return 1
- ceph osd crush tree | grep RACK | grep '6.00000 3.00000' || return 1
+ ceph osd crush tree | grep HOST | grep '6.00000 3.00000' || return 1
+ ceph osd crush tree | grep RACK | grep '6.00000 3.00000' || return 1
# moving a leaf resets its weight-set to the canonical weight...
ceph config set mon osd_crush_update_weight_set true || return 1
ceph osd crush add-bucket FOO host root=default || return 1
ceph osd crush move osd.0 host=FOO || return 1
ceph osd crush tree
- ceph osd crush tree | grep osd.0 | grep '3.00000 3.00000' || return 1
- ceph osd crush tree | grep HOST | grep '3.00000 2.00000' || return 1
- ceph osd crush tree | grep RACK | grep '3.00000 2.00000' || return 1
+ ceph osd crush tree | grep osd.0 | grep '3.00000 3.00000' || return 1
+ ceph osd crush tree | grep HOST | grep '3.00000 2.00000' || return 1
+ ceph osd crush tree | grep RACK | grep '3.00000 2.00000' || return 1
# ...or to zero.
ceph config set mon osd_crush_update_weight_set false || return 1
ceph osd crush move osd.1 host=FOO || return 1
ceph osd crush tree
- ceph osd crush tree | grep osd.0 | grep '3.00000 3.00000' || return 1
- ceph osd crush tree | grep osd.1 | grep '3.00000 0' || return 1
- ceph osd crush tree | grep FOO | grep '6.00000 3.00000' || return 1
+ ceph osd crush tree | grep osd.0 | grep '3.00000 3.00000' || return 1
+ ceph osd crush tree | grep osd.1 | grep '3.00000 0' || return 1
+ ceph osd crush tree | grep FOO | grep '6.00000 3.00000' || return 1
}
main crush-choose-args "$@"
TextTable::TextTableColumn col = t.col[i];
out << string(t.indent, ' ')
<< pad(col.heading, col.width, col.hd_align)
- << ' ';
+ << t.column_separation;
}
out << endl;
TextTable::TextTableColumn col = t.col[j];
out << string(t.indent, ' ')
<< pad(t.row[i][j], col.width, col.col_align)
- << ' ';
+ << t.column_separation;
}
out << endl;
}
std::vector<TextTableColumn> col; // column definitions
unsigned int curcol, currow; // col, row being inserted into
unsigned int indent; // indent width when rendering
+ std::string column_separation = {" "};
protected:
std::vector<std::vector<std::string> > row; // row data array
*/
void set_indent(int i) { indent = i; }
+ /**
+ * Set column separation
+ *
+ * @param s String to separate columns
+ */
+ void set_column_separation(const std::string& s) {
+ column_separation = s;
+ }
+
/**
* Add item to table, perhaps on new row.
* table << val1 << val2 << TextTable::endrow;
t << "1" << 2 << 3 << TextTable::endrow;
std::ostringstream oss;
oss << t;
- ASSERT_STREQ("HEAD1 HEAD2 HEAD3 \n1 2 3 \n", oss.str().c_str());
+ ASSERT_STREQ("HEAD1 HEAD2 HEAD3 \n1 2 3 \n", oss.str().c_str());
}
TEST(TextTable, WidenAndClearShrink) {
// validate wide output
std::ostringstream oss;
oss << t;
- ASSERT_STREQ("1 \nwider \n", oss.str().c_str());
+ ASSERT_STREQ("1 \nwider \n", oss.str().c_str());
oss.str("");
// reset, validate single-char width output
t.clear();
t << "s";
oss << t;
- ASSERT_STREQ("1 \ns \n", oss.str().c_str());
+ ASSERT_STREQ("1 \ns \n", oss.str().c_str());
}
TEST(TextTable, Indent) {
t << "s";
std::ostringstream oss;
oss << t;
- ASSERT_STREQ(" 1 \n s \n", oss.str().c_str());
+ ASSERT_STREQ(" 1 \n s \n", oss.str().c_str());
}