Allow to configure OSD placement in node_placement

master
Vitaliy Filippov 2021-12-12 01:25:45 +03:00
parent 2c7556e536
commit fa687d3878
1 changed files with 9 additions and 6 deletions

View File

@ -709,10 +709,13 @@ class Mon
for (const node_id in this.state.config.node_placement||{})
{
const node_cfg = this.state.config.node_placement[node_id];
if (!node_id || /^\d/.exec(node_id) ||
!node_cfg.level || !levels[node_cfg.level])
if (/^\d+$/.exec(node_id))
{
// All nodes must have non-empty non-numeric IDs and valid levels
node_cfg.level = 'osd';
}
if (!node_id || !node_cfg.level || !levels[node_cfg.level])
{
// All nodes must have non-empty IDs and valid levels
continue;
}
tree[node_id] = { id: node_id, level: node_cfg.level, parent: node_cfg.parent, children: [] };
@ -745,10 +748,10 @@ class Mon
.reduce((a, c) => { a[c] = true; return a; }, {});
}
delete tree[osd_num].children;
if (!tree[tree[osd_num].parent])
if (!tree[stat.host])
{
tree[tree[osd_num].parent] = {
id: tree[osd_num].parent,
tree[stat.host] = {
id: stat.host,
level: 'host',
parent: null,
children: [],