diff options
author | yuryalekseev <yuryalekseev@yandex-team.com> | 2023-03-04 17:40:17 +0300 |
---|---|---|
committer | yuryalekseev <yuryalekseev@yandex-team.com> | 2023-03-04 17:40:17 +0300 |
commit | 09e6a0fd898751bd4f2b188c128e684fe1bcc196 (patch) | |
tree | 42398a19c89b2449c07ac647f5ae3d1877dd0cb7 | |
parent | 9005771de7b0f90c0512ffeff145a77f6fba11b9 (diff) | |
download | ydb-09e6a0fd898751bd4f2b188c128e684fe1bcc196.tar.gz |
Add RetrieveDevices to TQueryBaseConfig and use it from device list.
-rw-r--r-- | ydb/apps/dstool/lib/common.py | 8 | ||||
-rw-r--r-- | ydb/apps/dstool/lib/dstool_cmd_device_list.py | 2 | ||||
-rw-r--r-- | ydb/core/mind/bscontroller/cmds_storage_pool.cpp | 44 | ||||
-rw-r--r-- | ydb/core/protos/blobstorage_config.proto | 1 |
4 files changed, 30 insertions, 25 deletions
diff --git a/ydb/apps/dstool/lib/common.py b/ydb/apps/dstool/lib/common.py index 1260db5a856..6d983b6df80 100644 --- a/ydb/apps/dstool/lib/common.py +++ b/ydb/apps/dstool/lib/common.py @@ -399,9 +399,9 @@ def invoke_wipe_request(request): @inmemcache('base_config_and_storage_pools') -def fetch_base_config_and_storage_pools(): +def fetch_base_config_and_storage_pools(retrieveDevices=False): request = kikimr_bsconfig.TConfigRequest(Rollback=True) - request.Command.add().QueryBaseConfig.CopyFrom(kikimr_bsconfig.TQueryBaseConfig()) + request.Command.add().QueryBaseConfig.CopyFrom(kikimr_bsconfig.TQueryBaseConfig(RetrieveDevices=retrieveDevices)) request.Command.add().ReadStoragePool.BoxId = (1 << 64) - 1 response = invoke_bsc_request(request) assert not response.Success @@ -411,8 +411,8 @@ def fetch_base_config_and_storage_pools(): return dict(BaseConfig=response.Status[0].BaseConfig, StoragePools=response.Status[1].StoragePool) -def fetch_base_config(): - return fetch_base_config_and_storage_pools()['BaseConfig'] +def fetch_base_config(retrieveDevices=False): + return fetch_base_config_and_storage_pools(retrieveDevices)['BaseConfig'] def fetch_storage_pools(): diff --git a/ydb/apps/dstool/lib/dstool_cmd_device_list.py b/ydb/apps/dstool/lib/dstool_cmd_device_list.py index 130ae4bacf2..ed3391c9d5e 100644 --- a/ydb/apps/dstool/lib/dstool_cmd_device_list.py +++ b/ydb/apps/dstool/lib/dstool_cmd_device_list.py @@ -10,7 +10,7 @@ def add_options(p): def do(args): - base_config = common.fetch_base_config() + base_config = common.fetch_base_config(retrieveDevices=True) node_to_fqdn = common.fetch_node_to_fqdn_map() all_columns = [ diff --git a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp index 2438db453c8..acc1805d1cd 100644 --- a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp +++ b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp @@ -448,27 +448,31 @@ namespace NKikimr::NBsController { // settings->AddSerialManagementStage(Self.SerialManagementStage); } - void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TQueryBaseConfig& /*cmd*/, TStatus& status) { + void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TQueryBaseConfig& cmd, TStatus& status) { NKikimrBlobStorage::TBaseConfig *pb = status.MutableBaseConfig(); - DrivesSerials.ForEach([&](const auto& serial, const auto& driveInfo) { - auto device = pb->AddDevice(); - device->SetSerialNumber(serial.Serial); - device->SetBoxId(driveInfo.BoxId); - if (driveInfo.NodeId) { - device->SetNodeId(driveInfo.NodeId.GetRef()); - } - if (driveInfo.PDiskId) { - device->SetPDiskId(driveInfo.PDiskId.GetRef()); - } - if (driveInfo.Path) { - device->SetPath(driveInfo.Path.GetRef()); - } - if (driveInfo.Guid) { - device->SetGuid(driveInfo.Guid.GetRef()); - } - device->SetLifeStage(driveInfo.LifeStage); - device->SetType(driveInfo.PDiskType); - }); + + if (cmd.GetRetrieveDevices()) { + DrivesSerials.ForEach([&](const auto& serial, const auto& driveInfo) { + auto device = pb->AddDevice(); + device->SetSerialNumber(serial.Serial); + device->SetBoxId(driveInfo.BoxId); + if (driveInfo.NodeId) { + device->SetNodeId(driveInfo.NodeId.GetRef()); + } + if (driveInfo.PDiskId) { + device->SetPDiskId(driveInfo.PDiskId.GetRef()); + } + if (driveInfo.Path) { + device->SetPath(driveInfo.Path.GetRef()); + } + if (driveInfo.Guid) { + device->SetGuid(driveInfo.Guid.GetRef()); + } + device->SetLifeStage(driveInfo.LifeStage); + device->SetType(driveInfo.PDiskType); + }); + } + PDisks.ForEach([&](const TPDiskId& pdiskId, const TPDiskInfo& pdiskInfo) { Serialize(pb->AddPDisk(), pdiskId, pdiskInfo); }); diff --git a/ydb/core/protos/blobstorage_config.proto b/ydb/core/protos/blobstorage_config.proto index f1ff9712662..60761529612 100644 --- a/ydb/core/protos/blobstorage_config.proto +++ b/ydb/core/protos/blobstorage_config.proto @@ -252,6 +252,7 @@ message TProposeStoragePools { } message TQueryBaseConfig { + bool RetrieveDevices = 1; } message TReadSettings { |