mirror of
https://github.com/ceph/ceph
synced 2025-03-06 08:20:12 +00:00
crush/CrushWrapper: reclassify: handle to-be-created buckets that we need twice
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
1028bf832a
commit
c2211e851d
@ -1813,6 +1813,7 @@ int CrushWrapper::reclassify(
|
||||
map<int,map<int,int>> new_class_bucket;
|
||||
map<int,string> new_bucket_names;
|
||||
map<int,map<string,string>> new_buckets;
|
||||
map<string,int> new_bucket_by_name;
|
||||
for (auto& i : classify_bucket) {
|
||||
const string& match = i.first; // prefix% or %suffix
|
||||
const string& new_class = i.second.first;
|
||||
@ -1878,6 +1879,9 @@ int CrushWrapper::reclassify(
|
||||
if (name_exists(basename)) {
|
||||
base_id = get_item_id(basename);
|
||||
cout << " have base " << base_id << std::endl;
|
||||
} else if (new_bucket_by_name.count(basename)) {
|
||||
base_id = new_bucket_by_name[basename];
|
||||
cout << " already creating base " << base_id << std::endl;
|
||||
} else {
|
||||
base_id = get_new_bucket_id();
|
||||
crush->buckets[-1-base_id] = crush_make_bucket(crush,
|
||||
@ -1887,6 +1891,7 @@ int CrushWrapper::reclassify(
|
||||
0, NULL, NULL);
|
||||
crush->buckets[-1-base_id]->id = base_id;
|
||||
name_map[base_id] = basename;
|
||||
new_bucket_by_name[basename] = base_id;
|
||||
cout << " created base " << base_id << std::endl;
|
||||
|
||||
new_buckets[base_id][default_parent_type_name] = default_parent;
|
||||
|
Loading…
Reference in New Issue
Block a user