From ae5af04fde590b2be3d6731053746819203bf15e Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 16 Apr 2024 02:19:55 +0300 Subject: [PATCH] Add noout flag for OSDs --- docs/config/pool.en.md | 14 +++++++++++++- docs/config/pool.ru.md | 11 ++++++++++- mon/mon.js | 7 ++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/config/pool.en.md b/docs/config/pool.en.md index fb7fb12fb..abc362f81 100644 --- a/docs/config/pool.en.md +++ b/docs/config/pool.en.md @@ -86,7 +86,11 @@ Parent node reference is required for intermediate tree nodes. Separate OSD settings are set in etc keys `/vitastor/config/osd/` in JSON format `{"":}`. -As of now, two settings are supported: +As of now, the following settings are supported: + +- [reweight](#reweight) +- [tags](#tags) +- [noout](#noout) ## reweight @@ -109,6 +113,14 @@ subsets and then use a specific subset for pool instead of all OSDs. For example you can mark SSD OSDs with tag "ssd" and HDD OSDs with "hdd" and such tags will work as device classes. +## noout + +- Type: boolean +- Default: false + +If set to true, [osd_out_time](monitor.en.md#osd_out_time) is ignored for this +OSD and it's never removed from data distribution by the monitor. + # Pool parameters ## name diff --git a/docs/config/pool.ru.md b/docs/config/pool.ru.md index a4ad09c39..4db99ebb3 100644 --- a/docs/config/pool.ru.md +++ b/docs/config/pool.ru.md @@ -85,10 +85,11 @@ Настройки отдельных OSD задаются в ключах etcd `/vitastor/config/osd/` в JSON-формате `{"":}`. -На данный момент поддерживаются две настройки: +На данный момент поддерживаются следующие настройки: - [reweight](#reweight) - [tags](#tags) +- [noout](#noout) ## reweight @@ -112,6 +113,14 @@ всех. Можно, например, пометить SSD OSD тегом "ssd", а HDD тегом "hdd", в этом смысле теги работают аналогично классам устройств. +## noout + +- Тип: булево (да/нет) +- Значение по умолчанию: false + +Если установлено в true, то [osd_out_time](monitor.ru.md#osd_out_time) для этого +OSD игнорируется и OSD не удаляется из распределения данных монитором. + # Параметры ## name diff --git a/mon/mon.js b/mon/mon.js index bd2d7e0bb..d4578f7a8 100644 --- a/mon/mon.js +++ b/mon/mon.js @@ -215,7 +215,7 @@ const etcd_tree = { }, */ pools: {}, osd: { - /* : { reweight?: 1, tags?: [ 'nvme', ... ] }, ... */ + /* : { reweight?: 1, tags?: [ 'nvme', ... ], noout?: true }, ... */ }, /* pgs: { hash: string, @@ -892,10 +892,11 @@ class Mon for (const osd_num of this.all_osds().sort((a, b) => a - b)) { const stat = this.state.osd.stats[osd_num]; - if (stat && stat.size && (this.state.osd.state[osd_num] || Number(stat.time) >= down_time)) + const osd_cfg = this.state.config.osd[osd_num]; + if (stat && stat.size && (this.state.osd.state[osd_num] || Number(stat.time) >= down_time || + osd_cfg && osd_cfg.noout)) { // Numeric IDs are reserved for OSDs - const osd_cfg = this.state.config.osd[osd_num]; let reweight = osd_cfg == null ? 1 : Number(osd_cfg.reweight); if (reweight < 0 || isNaN(reweight)) reweight = 1;