From fa687d387812ce95b7d8b26f7ca02ace0b59eda7 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 12 Dec 2021 01:25:45 +0300 Subject: [PATCH] Allow to configure OSD placement in node_placement --- mon/mon.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mon/mon.js b/mon/mon.js index cdd8db83..70b50218 100644 --- a/mon/mon.js +++ b/mon/mon.js @@ -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: [],