This function asserts it is not committing in error cases, because it is supposed
to be run first in a trial mode, and then in a commit mode. But I wanted the
asserts to be more informative than that when they are printed, so I included
the failure condition as an OR clause in the assert.
Unfortunately, a few of them were either written wrong or became wrong due to
code movement. Fix these so they are valid and convey the desired information.
Reported-by: Ronen Friedman <rfriedma@redhat.com>
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
if (retval == -1) {
ss << dividing_bucket << " is not a valid crush bucket type";
*errcode = -ENOENT;
- ceph_assert(!commit || dividing_id != -1);
+ ceph_assert(!commit || retval != -1);
return;
}
vector<int> subtrees;
if (new_crush_rule_result < 0) {
ss << "unrecognized crush rule " << new_crush_rule;
*errcode = new_crush_rule_result;
- ceph_assert(!commit || new_crush_rule_result);
+ ceph_assert(!commit || (new_crush_rule_result > 0));
return;
}
__u8 new_rule = static_cast<__u8>(new_crush_rule_result);
if (bucket_count != 2) {
ss << "currently we only support 2-site stretch clusters!";
*errcode = -EINVAL;
- ceph_assert(!commit);
+ ceph_assert(!commit || bucket_count == 2);
return;
}
// TODO: check CRUSH rules for pools so that we are appropriately divided