mirror of
https://github.com/ceph/ceph
synced 2025-02-19 00:47:49 +00:00
Merge pull request #22127 from liewegas/wip-23386
crush: fix device_class_clone for unpopulated/empty weight-sets Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
commit
4af9bf1dcd
@ -213,4 +213,15 @@ ceph osd pool rm cool cool --yes-i-really-really-mean-it
|
||||
ceph osd pool rm cold cold --yes-i-really-really-mean-it
|
||||
ceph osd crush weight-set rm-compat
|
||||
|
||||
# weight set vs device classes vs move
|
||||
ceph osd crush weight-set create-compat
|
||||
ceph osd crush add-bucket fooo host
|
||||
ceph osd crush move fooo root=default
|
||||
ceph osd crush add-bucket barr rack
|
||||
ceph osd crush move barr root=default
|
||||
ceph osd crush move fooo rack=barr
|
||||
ceph osd crush rm fooo
|
||||
ceph osd crush rm barr
|
||||
ceph osd crush weight-set rm-compat
|
||||
|
||||
echo OK
|
||||
|
@ -1573,7 +1573,7 @@ int CrushWrapper::populate_classes(
|
||||
// accumulate weight values for each carg and bucket as we go. because it is
|
||||
// depth first, we will have the nested bucket weights we need when we
|
||||
// finish constructing the containing buckets.
|
||||
map<int,map<int,vector<int>>> cmap_item_weight; // cargs -> bno -> weights
|
||||
map<int,map<int,vector<int>>> cmap_item_weight; // cargs -> bno -> [bucket weight for each position]
|
||||
set<int> roots;
|
||||
find_nonshadow_roots(&roots);
|
||||
for (auto &r : roots) {
|
||||
@ -2182,8 +2182,10 @@ int CrushWrapper::device_class_clone(
|
||||
int item = copy->items[i];
|
||||
if (item >= 0) {
|
||||
n.weight_set[s].weights[i] = o.weight_set[s].weights[item_orig_pos[i]];
|
||||
} else {
|
||||
} else if ((*cmap_item_weight)[w.first].count(item)) {
|
||||
n.weight_set[s].weights[i] = (*cmap_item_weight)[w.first][item][s];
|
||||
} else {
|
||||
n.weight_set[s].weights[i] = 0;
|
||||
}
|
||||
bucket_weights[s] += n.weight_set[s].weights[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user