ceph osd tree down
ceph osd tree in
ceph osd tree out
+ ceph osd tree destroyed
ceph osd tree up in
ceph osd tree up out
ceph osd tree down in
ceph osd tree down out
ceph osd tree out down
expect_false ceph osd tree up down
+ expect_false ceph osd tree up destroyed
+ expect_false ceph osd tree down destroyed
+ expect_false ceph osd tree up down destroyed
expect_false ceph osd tree in out
expect_false ceph osd tree up foo
"print summary of OSD map", "osd", "r", "cli,rest")
COMMAND("osd tree " \
"name=epoch,type=CephInt,range=0,req=false " \
- "name=states,type=CephChoices,strings=up|down|in|out,n=N,req=false", \
+ "name=states,type=CephChoices,strings=up|down|in|out|destroyed,n=N,req=false", \
"print OSD tree", "osd", "r", "cli,rest")
COMMAND("osd ls " \
"name=epoch,type=CephInt,range=0,req=false", \
filter |= OSDMap::DUMP_IN;
} else if (s == "out") {
filter |= OSDMap::DUMP_OUT;
+ } else if (s == "destroyed") {
+ filter |= OSDMap::DUMP_DESTROYED;
} else {
ss << "unrecognized state '" << s << "'";
r = -EINVAL;
}
}
if ((filter & (OSDMap::DUMP_IN|OSDMap::DUMP_OUT)) ==
- (OSDMap::DUMP_IN|OSDMap::DUMP_OUT) ||
- (filter & (OSDMap::DUMP_UP|OSDMap::DUMP_DOWN)) ==
- (OSDMap::DUMP_UP|OSDMap::DUMP_DOWN)) {
- ss << "cannot specify both up and down or both in and out";
+ (OSDMap::DUMP_IN|OSDMap::DUMP_OUT)) {
+ ss << "cannot specify both 'in' and 'out'";
+ r = -EINVAL;
+ goto reply;
+ }
+ if (((filter & (OSDMap::DUMP_UP|OSDMap::DUMP_DOWN)) ==
+ (OSDMap::DUMP_UP|OSDMap::DUMP_DOWN)) ||
+ ((filter & (OSDMap::DUMP_UP|OSDMap::DUMP_DESTROYED)) ==
+ (OSDMap::DUMP_UP|OSDMap::DUMP_DESTROYED)) ||
+ ((filter & (OSDMap::DUMP_DOWN|OSDMap::DUMP_DESTROYED)) ==
+ (OSDMap::DUMP_DOWN|OSDMap::DUMP_DESTROYED))) {
+ ss << "can specify only one of 'up', 'down' and 'destroyed'";
r = -EINVAL;
goto reply;
}
: Parent(crush, osdmap_->get_pool_names()), osdmap(osdmap_), filter(f) { }
bool should_dump_leaf(int i) const override {
- if (((filter & OSDMap::DUMP_UP) && !osdmap->is_up(i)) ||
- ((filter & OSDMap::DUMP_DOWN) && !osdmap->is_down(i)) ||
- ((filter & OSDMap::DUMP_IN) && !osdmap->is_in(i)) ||
- ((filter & OSDMap::DUMP_OUT) && !osdmap->is_out(i))) {
- return false;
+ if (!filter) {
+ return true; // normal case
+ }
+ if (((filter & OSDMap::DUMP_UP) && osdmap->is_up(i)) ||
+ ((filter & OSDMap::DUMP_DOWN) && osdmap->is_down(i)) ||
+ ((filter & OSDMap::DUMP_IN) && osdmap->is_in(i)) ||
+ ((filter & OSDMap::DUMP_OUT) && osdmap->is_out(i)) ||
+ ((filter & OSDMap::DUMP_DESTROYED) && osdmap->is_destroyed(i))) {
+ return true;
}
- return true;
+ return false;
}
bool should_dump_empty_bucket() const override {
: Parent(crush, osdmap_->get_pool_names()), osdmap(osdmap_), filter(f) { }
bool should_dump_leaf(int i) const override {
- if (((filter & OSDMap::DUMP_UP) && !osdmap->is_up(i)) ||
- ((filter & OSDMap::DUMP_DOWN) && !osdmap->is_down(i)) ||
- ((filter & OSDMap::DUMP_IN) && !osdmap->is_in(i)) ||
- ((filter & OSDMap::DUMP_OUT) && !osdmap->is_out(i))) {
- return false;
+ if (!filter) {
+ return true; // normal case
+ }
+ if (((filter & OSDMap::DUMP_UP) && osdmap->is_up(i)) ||
+ ((filter & OSDMap::DUMP_DOWN) && osdmap->is_down(i)) ||
+ ((filter & OSDMap::DUMP_IN) && osdmap->is_in(i)) ||
+ ((filter & OSDMap::DUMP_OUT) && osdmap->is_out(i)) ||
+ ((filter & OSDMap::DUMP_DESTROYED) && osdmap->is_destroyed(i))) {
+ return true;
}
- return true;
+ return false;
}
bool should_dump_empty_bucket() const override {
void print_oneline_summary(ostream& out) const;
enum {
- DUMP_IN = 1, // only 'in' osds
- DUMP_OUT = 2, // only 'out' osds
- DUMP_UP = 4, // only 'up' osds
- DUMP_DOWN = 8, // only 'down' osds
+ DUMP_IN = 1, // only 'in' osds
+ DUMP_OUT = 2, // only 'out' osds
+ DUMP_UP = 4, // only 'up' osds
+ DUMP_DOWN = 8, // only 'down' osds
+ DUMP_DESTROYED = 16, // only 'destroyed' osds
};
void print_tree(Formatter *f, ostream *out, unsigned dump_flags=0) const;