diff options
author | yuryalekseev <yuryalekseev@yandex-team.com> | 2023-01-13 14:16:40 +0300 |
---|---|---|
committer | yuryalekseev <yuryalekseev@yandex-team.com> | 2023-01-13 14:16:40 +0300 |
commit | be6f1b53be888b4e18c1840d289c914b5bbd0f66 (patch) | |
tree | 992665163dd614fb4020c55ff06361b5b6a1ede8 | |
parent | da85f2e9985b3d1b2ac0d793b33fbcfd7d8ae97f (diff) | |
download | ydb-be6f1b53be888b4e18c1840d289c914b5bbd0f66.tar.gz |
Add cluster get to dstool.
-rw-r--r-- | ydb/apps/dstool/lib/commands.py | 5 | ||||
-rw-r--r-- | ydb/apps/dstool/lib/dstool_cmd_cluster_get.py | 52 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/bsc.cpp | 1 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/cmds_storage_pool.cpp | 17 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/config.h | 1 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/config_cmd.cpp | 2 | ||||
-rw-r--r-- | ydb/core/protos/blobstorage_config.proto | 9 | ||||
-rw-r--r-- | ydb/core/protos/counters_bs_controller.proto | 2 |
8 files changed, 86 insertions, 3 deletions
diff --git a/ydb/apps/dstool/lib/commands.py b/ydb/apps/dstool/lib/commands.py index c63fc8d352..8854d86e4e 100644 --- a/ydb/apps/dstool/lib/commands.py +++ b/ydb/apps/dstool/lib/commands.py @@ -24,6 +24,7 @@ import ydb.apps.dstool.lib.dstool_cmd_node_list as node_list import ydb.apps.dstool.lib.dstool_cmd_cluster_balance as cluster_balance import ydb.apps.dstool.lib.dstool_cmd_cluster_list as cluster_list +import ydb.apps.dstool.lib.dstool_cmd_cluster_get as cluster_get import ydb.apps.dstool.lib.dstool_cmd_cluster_set as cluster_set import ydb.apps.dstool.lib.dstool_cmd_cluster_workload_run as cluster_workload_run @@ -33,7 +34,7 @@ import ydb.apps.dstool.lib.common as common MODULE_PREFIX = 'ydb.apps.dstool.lib.dstool_cmd_' modules = [ - cluster_balance, cluster_set, cluster_list, cluster_workload_run, + cluster_balance, cluster_get, cluster_set, cluster_list, cluster_workload_run, node_list, box_list, pool_list, @@ -49,7 +50,7 @@ default_structure = [ ('pool', ['list']), ('box', ['list']), ('node', ['list']), - ('cluster', ['balance', 'set', ('workload', ['run']), 'list']), + ('cluster', ['balance', 'get', 'set', ('workload', ['run']), 'list']), ] diff --git a/ydb/apps/dstool/lib/dstool_cmd_cluster_get.py b/ydb/apps/dstool/lib/dstool_cmd_cluster_get.py new file mode 100644 index 0000000000..a1f50dcd98 --- /dev/null +++ b/ydb/apps/dstool/lib/dstool_cmd_cluster_get.py @@ -0,0 +1,52 @@ +import ydb.core.protos.blobstorage_config_pb2 as kikimr_bsconfig +import ydb.core.protos.blobstorage_disk_color_pb2 as disk_color +import ydb.apps.dstool.lib.table as table +import ydb.apps.dstool.lib.common as common + +description = 'Get cluster wide settings' + + +def add_options(p): + table.TableOutput([]).add_options(p) + + +def fetch_settings(args): + request = common.create_bsc_request(args) + request.Command.add().ReadSettings.CopyFrom(kikimr_bsconfig.TReadSettings()) + response = common.invoke_bsc_request(request) + assert len(response.Status) == 1 + assert response.Status[0].Success, 'ReadSettings failed with error: %s' % response.Status[0].ErrorDescription + return response.Status[0].Settings + + +def do(args): + columns = [ + 'DefaultMaxSlots', + 'EnableSelfHeal', + 'EnableDonorMode', + 'ScrubPeriodicitySeconds', + 'PDiskSpaceMarginPromille', + 'GroupReserveMin', + 'GroupReservePartPPM', + 'MaxScrubbedDisksAtOnce', + 'EnableGroupLayoutSanitizer', + 'PDiskSpaceColorBorder', + 'SerialManagementStage', + ] + + table_output = table.TableOutput(columns, default_visible_columns=columns) + + settings = fetch_settings(args) + row = {} + for attr in columns: + if not hasattr(settings, attr): + continue + value = getattr(settings, attr)[0] + if attr == 'PDiskSpaceColorBorder': + row[attr] = disk_color.TPDiskSpaceColor.E.Name(value) + elif attr == 'SerialManagementStage': + row[attr] = kikimr_bsconfig.TSerialManagementStage.E.Name(value) + else: + row[attr] = value + + table_output.dump([row], args) diff --git a/ydb/core/mind/bscontroller/bsc.cpp b/ydb/core/mind/bscontroller/bsc.cpp index 1f1d9f1e1f..e19f9dd1cb 100644 --- a/ydb/core/mind/bscontroller/bsc.cpp +++ b/ydb/core/mind/bscontroller/bsc.cpp @@ -356,6 +356,7 @@ ui32 TBlobStorageController::GetEventPriority(IEventHandle *ev) { case NKikimrBlobStorage::TConfigRequest::TCommand::kReadBox: case NKikimrBlobStorage::TConfigRequest::TCommand::kReadStoragePool: case NKikimrBlobStorage::TConfigRequest::TCommand::kReadDriveStatus: + case NKikimrBlobStorage::TConfigRequest::TCommand::kReadSettings: case NKikimrBlobStorage::TConfigRequest::TCommand::kQueryBaseConfig: case NKikimrBlobStorage::TConfigRequest::TCommand::kReadIntent: case NKikimrBlobStorage::TConfigRequest::TCommand::COMMAND_NOT_SET: diff --git a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp index d590081069..51275a8227 100644 --- a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp +++ b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp @@ -431,6 +431,23 @@ namespace NKikimr::NBsController { } } + void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TReadSettings& /*cmd*/, TStatus& status) { + auto settings = status.MutableSettings(); + + settings->AddDefaultMaxSlots(Self.DefaultMaxSlots); + settings->AddEnableSelfHeal(Self.SelfHealEnable); + settings->AddEnableDonorMode(Self.DonorMode); + settings->AddScrubPeriodicitySeconds(Self.ScrubPeriodicity.Seconds()); + settings->AddPDiskSpaceMarginPromille(Self.PDiskSpaceMarginPromille); + settings->AddGroupReserveMin(Self.GroupReserveMin); + settings->AddGroupReservePartPPM(Self.GroupReservePart); + settings->AddMaxScrubbedDisksAtOnce(Self.MaxScrubbedDisksAtOnce); + settings->AddPDiskSpaceColorBorder(Self.PDiskSpaceColorBorder); + settings->AddEnableGroupLayoutSanitizer(Self.GroupLayoutSanitizer); + // TODO: + // settings->AddSerialManagementStage(Self.SerialManagementStage); + } + void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TQueryBaseConfig& /*cmd*/, TStatus& status) { NKikimrBlobStorage::TBaseConfig *pb = status.MutableBaseConfig(); PDisks.ForEach([&](const TPDiskId& pdiskId, const TPDiskInfo& pdiskInfo) { diff --git a/ydb/core/mind/bscontroller/config.h b/ydb/core/mind/bscontroller/config.h index 0c46340d16..23cc993dac 100644 --- a/ydb/core/mind/bscontroller/config.h +++ b/ydb/core/mind/bscontroller/config.h @@ -266,6 +266,7 @@ namespace NKikimr { void ExecuteStep(const NKikimrBlobStorage::TReassignGroupDisk& cmd, TStatus& status); void ExecuteStep(const NKikimrBlobStorage::TMoveGroups& cmd, TStatus& status); void ExecuteStep(const NKikimrBlobStorage::TQueryBaseConfig& cmd, TStatus& status); + void ExecuteStep(const NKikimrBlobStorage::TReadSettings& cmd, TStatus& status); void ExecuteStep(const NKikimrBlobStorage::TDropDonorDisk& cmd, TStatus& status); void ExecuteStep(const NKikimrBlobStorage::TAddDriveSerial& cmd, TStatus& status); void ExecuteStep(const NKikimrBlobStorage::TRemoveDriveSerial& cmd, TStatus& status); diff --git a/ydb/core/mind/bscontroller/config_cmd.cpp b/ydb/core/mind/bscontroller/config_cmd.cpp index d53fc9400c..0ff4a74bc5 100644 --- a/ydb/core/mind/bscontroller/config_cmd.cpp +++ b/ydb/core/mind/bscontroller/config_cmd.cpp @@ -208,6 +208,7 @@ namespace NKikimr::NBsController { MAP_TIMING(UpdateDriveStatus, UPDATE_DRIVE_STATUS) MAP_TIMING(ReadDriveStatus, READ_DRIVE_STATUS) MAP_TIMING(ProposeStoragePools, PROPOSE_STORAGE_POOLS) + MAP_TIMING(ReadSettings, READ_SETTINGS) MAP_TIMING(QueryBaseConfig, QUERY_BASE_CONFIG) MAP_TIMING(MergeBoxes, MERGE_BOXES) MAP_TIMING(MoveGroups, MOVE_GROUPS) @@ -303,6 +304,7 @@ namespace NKikimr::NBsController { HANDLE_COMMAND(UpdateDriveStatus) HANDLE_COMMAND(ReadDriveStatus) HANDLE_COMMAND(ProposeStoragePools) + HANDLE_COMMAND(ReadSettings) HANDLE_COMMAND(QueryBaseConfig) HANDLE_COMMAND(ReassignGroupDisk) HANDLE_COMMAND(MergeBoxes) diff --git a/ydb/core/protos/blobstorage_config.proto b/ydb/core/protos/blobstorage_config.proto index f901fb2426..cf91ae5218 100644 --- a/ydb/core/protos/blobstorage_config.proto +++ b/ydb/core/protos/blobstorage_config.proto @@ -256,6 +256,9 @@ message TProposeStoragePools { message TQueryBaseConfig { } +message TReadSettings { +} + message TPDiskId { uint32 NodeId = 1; uint32 PDiskId = 2; @@ -453,6 +456,8 @@ message TUpdateSettings { repeated uint32 MaxScrubbedDisksAtOnce = 8; repeated NKikimrBlobStorage.TPDiskSpaceColor.E PDiskSpaceColorBorder = 9; repeated bool EnableGroupLayoutSanitizer = 10; + // TODO + // repeated TSerialManagementStage.E SerialManagementStage = 11; } message TBoxStoragePoolId { @@ -516,10 +521,11 @@ message TConfigRequest { TAllocateVirtualGroup AllocateVirtualGroup = 39; TDecommitGroups DecommitGroups = 40; TWipeVDisk WipeVDisk = 41; + TSanitizeGroup SanitizeGroup = 42; + TReadSettings ReadSettings = 43; // commands intended for internal use TReassignGroupDisk ReassignGroupDisk = 19; - TSanitizeGroup SanitizeGroup = 42; } } @@ -711,6 +717,7 @@ message TConfigResponse { repeated TWipeVDisk WipeVDisk = 17; TDeclareIntent Intent = 15; bool Already = 16; + TUpdateSettings Settings = 18; } repeated TStatus Status = 1; diff --git a/ydb/core/protos/counters_bs_controller.proto b/ydb/core/protos/counters_bs_controller.proto index 09066a997f..3ee52677c3 100644 --- a/ydb/core/protos/counters_bs_controller.proto +++ b/ydb/core/protos/counters_bs_controller.proto @@ -73,6 +73,8 @@ enum ECumulativeCounters { COUNTER_CONFIGCMD_REASSIGN_GROUP_DISK_USEC = 37 [(CounterOpts) = {Name: "ReassignGroupDisk"}]; COUNTER_DISK_SCRUB_QUANTUM_FINISHED = 38 [(CounterOpts) = {Name: "QuantumFinished"}]; + + COUNTER_CONFIGCMD_READ_SETTINGS_USEC = 39 [(CounterOpts) = {Name: "ReadSettings"}]; } enum EPercentileCounters { |