Skip to content

Commit 43d5e45

Browse files
authored
Fill some storage pool-related fields automatically to simplify configuration YAML (#5763)
1 parent 8e415f0 commit 43d5e45

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

ydb/core/cms/console/console_tenants_manager.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ class TPoolManip : public TActorBootstrapped<TPoolManip> {
118118
void AllocatePool(const TActorContext &ctx)
119119
{
120120
auto request = MakeHolder<TEvBlobStorage::TEvControllerConfigRequest>();
121-
request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(Pool->Config);
121+
auto *pool = request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool();
122+
pool->CopyFrom(Pool->Config);
123+
if (!pool->GetKind()) {
124+
pool->SetKind(Pool->Kind);
125+
}
122126

123127
BLOG_D(LogPrefix << "send pool request: " << request->Record.ShortDebugString());
124128

ydb/core/mind/bscontroller/cmds_storage_pool.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55
namespace NKikimr::NBsController {
66

77
void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TDefineStoragePool& cmd, TStatus& status) {
8+
TBoxId boxId = cmd.GetBoxId();
9+
if (!boxId && Boxes.Get().size() == 1) {
10+
boxId = Boxes.Get().begin()->first;
11+
}
12+
813
ui64 storagePoolId = cmd.GetStoragePoolId();
914
if (!storagePoolId) {
1015
ui64 maxPoolId = 0;
1116

1217
// TODO: optimize linear search
1318

1419
const auto &pools = StoragePools.Get();
15-
for (auto it = pools.lower_bound({cmd.GetBoxId(), 0});
16-
it != pools.end() && std::get<0>(it->first) == cmd.GetBoxId();
20+
for (auto it = pools.lower_bound({boxId, 0});
21+
it != pools.end() && std::get<0>(it->first) == boxId;
1722
++it) {
1823
const ui64 id = std::get<1>(it->first);
1924
const TStoragePoolInfo &info = it->second;
@@ -39,7 +44,7 @@ namespace NKikimr::NBsController {
3944
}
4045
}
4146

42-
const TBoxStoragePoolId id(cmd.GetBoxId(), storagePoolId);
47+
const TBoxStoragePoolId id(boxId, storagePoolId);
4348
const ui64 nextGen = CheckGeneration(cmd, StoragePools.Get(), id);
4449

4550
TStoragePoolInfo storagePool;
@@ -90,12 +95,12 @@ namespace NKikimr::NBsController {
9095
storagePool.RandomizeGroupMapping = cmd.GetRandomizeGroupMapping();
9196

9297
for (const auto &userId : cmd.GetUserId()) {
93-
storagePool.UserIds.emplace(cmd.GetBoxId(), storagePoolId, userId);
98+
storagePool.UserIds.emplace(boxId, storagePoolId, userId);
9499
}
95100

96101
for (const auto &item : cmd.GetPDiskFilter()) {
97102
TStoragePoolInfo::TPDiskFilter filter;
98-
filter.BoxId = cmd.GetBoxId();
103+
filter.BoxId = boxId;
99104
filter.StoragePoolId = storagePoolId;
100105

101106
bool hasTypeProperty = false;

0 commit comments

Comments
 (0)