11#pragma once
22
33#include " pdisk_state.h"
4+ #include " pdisk_status.h"
45
56#include < ydb/core/protos/cms.pb.h>
67
78#include < util/datetime/base.h>
89#include < util/generic/hash.h>
910#include < util/generic/map.h>
11+ #include < util/generic/maybe.h>
1012
1113namespace NKikimr ::NCms {
1214
@@ -30,6 +32,8 @@ struct TCmsSentinelConfig {
3032 ui32 RoomRatio;
3133 ui32 RackRatio;
3234
35+ TMaybeFail<EPDiskStatus> EvictVDisksStatus;
36+
3337 void Serialize (NKikimrCms::TCmsConfig::TSentinelConfig &config) const {
3438 config.SetEnable (Enable);
3539 config.SetDryRun (DryRun);
@@ -45,6 +49,7 @@ struct TCmsSentinelConfig {
4549 config.SetRackRatio (RackRatio);
4650
4751 SaveStateLimits (config);
52+ SaveEvictVDisksStatus (config);
4853 }
4954
5055 void Deserialize (const NKikimrCms::TCmsConfig::TSentinelConfig &config) {
@@ -63,6 +68,8 @@ struct TCmsSentinelConfig {
6368
6469 auto newStateLimits = LoadStateLimits (config);
6570 StateLimits.swap (newStateLimits);
71+
72+ EvictVDisksStatus = LoadEvictVDisksStatus (config);
6673 }
6774
6875 void SaveStateLimits (NKikimrCms::TCmsConfig::TSentinelConfig &config) const {
@@ -129,6 +136,31 @@ struct TCmsSentinelConfig {
129136
130137 return stateLimits;
131138 }
139+
140+ static TMaybeFail<EPDiskStatus> LoadEvictVDisksStatus (const NKikimrCms::TCmsConfig::TSentinelConfig &config) {
141+ using EEvictVDisksStatus = NKikimrCms::TCmsConfig::TSentinelConfig;
142+ switch (config.GetEvictVDisksStatus ()) {
143+ case EEvictVDisksStatus::UNKNOWN:
144+ case EEvictVDisksStatus::FAULTY:
145+ return EPDiskStatus::FAULTY;
146+ case EEvictVDisksStatus::DISABLED:
147+ return Nothing ();
148+ }
149+ return EPDiskStatus::FAULTY;
150+ }
151+
152+ void SaveEvictVDisksStatus (NKikimrCms::TCmsConfig::TSentinelConfig &config) const {
153+ using EEvictVDisksStatus = NKikimrCms::TCmsConfig::TSentinelConfig;
154+
155+ if (EvictVDisksStatus.Empty ()) {
156+ config.SetEvictVDisksStatus (EEvictVDisksStatus::DISABLED);
157+ return ;
158+ }
159+
160+ if (*EvictVDisksStatus == EPDiskStatus::FAULTY) {
161+ config.SetEvictVDisksStatus (EEvictVDisksStatus::FAULTY);
162+ }
163+ }
132164};
133165
134166struct TCmsLogConfig {
0 commit comments