Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luminous: crush: fix CrushCompiler won't compile maps with empty shadow tree #17228

Merged
merged 2 commits into from Aug 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/crush/CrushCompiler.cc
Expand Up @@ -587,11 +587,10 @@ int CrushCompiler::parse_bucket(iter_t const& i)
if (verbose) err << "bucket " << name << " id " << maybe_id;
if (sub->children.size() > 2) {
string class_name = string_node(sub->children[3]);
if (!crush.class_exists(class_name)) {
err << " unknown device class '" << class_name << "'" << std::endl;
return -EINVAL;
}
int cid = crush.get_class_id(class_name);
// note that we do not verify class existence here,
// as this bucket might come from an empty shadow tree
// which currently has no OSDs but is still referenced by a rule!
int cid = crush.get_or_create_class_id(class_name);
if (class_id.count(cid) != 0) {
err << "duplicate device class " << class_name << " for bucket " << name << std::endl;
return -ERANGE;
Expand Down
2 changes: 1 addition & 1 deletion src/crush/CrushWrapper.cc
Expand Up @@ -1667,7 +1667,7 @@ int CrushWrapper::remove_rule(int ruleno)
crush->rules[ruleno] = NULL;
rule_name_map.erase(ruleno);
have_rmaps = false;
return 0;
return rebuild_roots_with_classes();
}

int CrushWrapper::bucket_adjust_item_weight(CephContext *cct, crush_bucket *bucket, int item, int weight)
Expand Down