From 9fe779a6917ff7f6b95a5cb5e69c46d2cf821ec5 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 2 Jan 2024 00:50:23 +0300 Subject: [PATCH] Do not die on invalid pool configurations --- mon/mon.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mon/mon.js b/mon/mon.js index 558e4375..79df13e0 100644 --- a/mon/mon.js +++ b/mon/mon.js @@ -1349,8 +1349,8 @@ class Mon // Something has changed console.log('Pool configuration or OSD tree changed, re-optimizing'); // First re-optimize PGs, but don't look at history yet - const optimize_results = await Promise.all(Object.keys(this.state.config.pools) - .map(pool_id => this.generate_pool_pgs(pool_id, osd_tree, levels))); + const optimize_results = (await Promise.all(Object.keys(this.state.config.pools) + .map(pool_id => this.generate_pool_pgs(pool_id, osd_tree, levels)))).filter(r => r); // Then apply the modification in the form of an optimistic transaction, // each time considering new pg/history modifications (OSDs modify it during rebalance) while (!await this.apply_pool_pgs(optimize_results, up_osds, osd_tree, tree_hash)) @@ -1436,6 +1436,10 @@ class Mon async apply_pool_pgs(results, up_osds, osd_tree, tree_hash) { + if (!results.length) + { + return true; + } for (const pool_id in (this.state.config.pgs||{}).items||{}) { // We should stop all PGs when deleting a pool or changing its PG count