forked from vitalif/vitastor
Allow to configure OSD placement in node_placement
parent
2c7556e536
commit
fa687d3878
15
mon/mon.js
15
mon/mon.js
|
@ -709,10 +709,13 @@ class Mon
|
||||||
for (const node_id in this.state.config.node_placement||{})
|
for (const node_id in this.state.config.node_placement||{})
|
||||||
{
|
{
|
||||||
const node_cfg = this.state.config.node_placement[node_id];
|
const node_cfg = this.state.config.node_placement[node_id];
|
||||||
if (!node_id || /^\d/.exec(node_id) ||
|
if (/^\d+$/.exec(node_id))
|
||||||
!node_cfg.level || !levels[node_cfg.level])
|
|
||||||
{
|
{
|
||||||
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
tree[node_id] = { id: node_id, level: node_cfg.level, parent: node_cfg.parent, children: [] };
|
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; }, {});
|
.reduce((a, c) => { a[c] = true; return a; }, {});
|
||||||
}
|
}
|
||||||
delete tree[osd_num].children;
|
delete tree[osd_num].children;
|
||||||
if (!tree[tree[osd_num].parent])
|
if (!tree[stat.host])
|
||||||
{
|
{
|
||||||
tree[tree[osd_num].parent] = {
|
tree[stat.host] = {
|
||||||
id: tree[osd_num].parent,
|
id: stat.host,
|
||||||
level: 'host',
|
level: 'host',
|
||||||
parent: null,
|
parent: null,
|
||||||
children: [],
|
children: [],
|
||||||
|
|
Loading…
Reference in New Issue