summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Belyakov <[email protected]>2026-07-14 14:21:39 +0300
committerGitHub <[email protected]>2026-07-14 14:21:39 +0300
commitf4df89d67f5707fa53815440fa73a8bc050db2a5 (patch)
tree0704efe62b4d1cfa11bcbebcba86275d59fd7daa
parentf7eabfea99384f81fbca3794cd3e89f62eab4201 (diff)
Add support for DiskScope field in ydbd_slice and cfg tools (#46301)
-rw-r--r--ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp9
-rw-r--r--ydb/core/mind/bscontroller/group_mapper_ut.cpp5
-rw-r--r--ydb/core/protos/config.proto1
-rw-r--r--ydb/library/actors/core/interconnect.h2
-rw-r--r--ydb/library/actors/protos/interconnect.proto2
-rw-r--r--ydb/library/yaml_config/protos/config.proto1
-rw-r--r--ydb/tools/cfg/base.py6
-rw-r--r--ydb/tools/cfg/dynamic.py2
-rw-r--r--ydb/tools/cfg/static.py6
-rw-r--r--ydb/tools/cfg/types.py5
-rw-r--r--ydb/tools/cfg/validation.py1
11 files changed, 34 insertions, 6 deletions
diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp
index 2c0f965c8b0..d5aab8185e2 100644
--- a/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp
+++ b/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp
@@ -131,7 +131,8 @@ public:
s == "dc" ? 10 :
s == "room" ? 20 :
s == "rack" ? 30 :
- s == "body" ? 40 : 0;
+ s == "body" ? 40 :
+ s == "disk_scope" ? 50 : 0;
if (!level) {
ythrow yexception() << "unknown distinction level provided: \"" << s << "\"";
}
@@ -217,6 +218,11 @@ public:
if (pdiskInfo.Type == DesiredPDiskType) {
pdisks.push_back(pdiskInfo);
+ std::optional<TString> diskScope;
+ if (drive.HasDiskScope()) {
+ diskScope.emplace(drive.GetDiskScope());
+ }
+
mapper.RegisterPDisk({
.PDiskId{pdiskInfo.NodeId, pdiskInfo.PDiskId},
.Location = pdiskInfo.Location,
@@ -226,6 +232,7 @@ public:
.SpaceAvailable = 0,
.Operational = true,
.Decommitted = false,
+ .DiskScope = diskScope,
});
pdiskMap.emplace(NBsController::TPDiskId{pdiskInfo.NodeId, pdiskInfo.PDiskId}, pdisks.size() - 1);
diff --git a/ydb/core/mind/bscontroller/group_mapper_ut.cpp b/ydb/core/mind/bscontroller/group_mapper_ut.cpp
index 741a001b3c5..b3d6fa459dc 100644
--- a/ydb/core/mind/bscontroller/group_mapper_ut.cpp
+++ b/ydb/core/mind/bscontroller/group_mapper_ut.cpp
@@ -586,9 +586,10 @@ public:
for (ui32 failDomain = 0; failDomain < geom.GetNumFailDomainsPerFailRealm(); ++failDomain) {
for (ui32 vdisk = 0; vdisk < geom.GetNumVDisksPerFailDomain(); ++vdisk) {
const auto pdiskId = group[failRealm][failDomain][vdisk];
+ const TPDiskRecord& record = PDisks.at(pdiskId);
pdisks[pdiskId] = NLayoutChecker::TPDiskLayoutPosition(domainMapper,
- PDisks.at(pdiskId).GetLocation(),
- PDisks.at(pdiskId).DiskScope,
+ record.GetLocation(),
+ record.DiskScope,
pdiskId,
geom
);
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index 6cdb7184692..f8fd27d4301 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -415,6 +415,7 @@ message TBlobStorageFormatConfig {
optional uint64 RoomId = 9;
optional uint64 BodyId = 10;
optional NKikimrBlobStorage.TPDiskConfig PDiskConfig = 11;
+ optional string DiskScope = 12;
}
repeated TDrive Drive = 1;
diff --git a/ydb/library/actors/core/interconnect.h b/ydb/library/actors/core/interconnect.h
index 70b51a85d53..33a99a62669 100644
--- a/ydb/library/actors/core/interconnect.h
+++ b/ydb/library/actors/core/interconnect.h
@@ -23,6 +23,8 @@ namespace NActors {
Module = 20,
Rack = 30,
Unit = 40,
+ // value 50 is used for PDisk domain mapping
+ // DiskScope = 50,
};
};
diff --git a/ydb/library/actors/protos/interconnect.proto b/ydb/library/actors/protos/interconnect.proto
index 3c8212a8268..db536449002 100644
--- a/ydb/library/actors/protos/interconnect.proto
+++ b/ydb/library/actors/protos/interconnect.proto
@@ -32,6 +32,8 @@ message TNodeLocation {
optional string Module = 20 [(PrintName) = "M"];
optional string Rack = 30 [(PrintName) = "R"];
optional string Unit = 40 [(PrintName) = "U"];
+ // value 50 is used for PDisk domain mapping
+ // optional string DiskScope = 50 [(PrintName) = "DS"];
}
message TClusterUUIDs {
diff --git a/ydb/library/yaml_config/protos/config.proto b/ydb/library/yaml_config/protos/config.proto
index 54d64992e00..7afaa1a5ff4 100644
--- a/ydb/library/yaml_config/protos/config.proto
+++ b/ydb/library/yaml_config/protos/config.proto
@@ -77,6 +77,7 @@ message TExtendedHostConfigDrive {
optional uint32 SlotSizeInUnits = 8;
reserved 9; // optional uint64 InferPDiskSlotCountFromUnitSize = 9 [(NMarkers.CopyTo) = "THostConfigDrive"]; // deprecated
reserved 10; // optional uint32 InferPDiskSlotCountMax = 10 [(NMarkers.CopyTo) = "THostConfigDrive"]; // deprecated
+ optional string DiskScope = 11 [(NMarkers.CopyTo) = "THostConfigDrive"];
}
message THosts {
diff --git a/ydb/tools/cfg/base.py b/ydb/tools/cfg/base.py
index 541f1298397..d0bb80c5965 100644
--- a/ydb/tools/cfg/base.py
+++ b/ydb/tools/cfg/base.py
@@ -63,13 +63,14 @@ def merge_with_default(dft, override):
class KiKiMRDrive(object):
- def __init__(self, type, path, shared_with_os=False, expected_slot_count=None, kind=None, pdisk_config=None):
+ def __init__(self, type, path, shared_with_os=False, expected_slot_count=None, kind=None, pdisk_config=None, disk_scope=None):
self.type = type
self.path = path
self.shared_with_os = shared_with_os
self.pdisk_config = pdisk_config
self.expected_slot_count = expected_slot_count
self.kind = kind
+ self.disk_scope = disk_scope
def __eq__(self, other):
return (
@@ -79,10 +80,11 @@ class KiKiMRDrive(object):
and self.expected_slot_count == other.expected_slot_count
and self.kind == other.kind
and self.pdisk_config == other.pdisk_config
+ and self.disk_scope == other.disk_scope
)
def __hash__(self):
- return hash("\0".join(map(str, (self.type, self.path, self.shared_with_os, self.expected_slot_count, self.kind, self.pdisk_config))))
+ return hash("\0".join(map(str, (self.type, self.path, self.shared_with_os, self.expected_slot_count, self.kind, self.pdisk_config, self.disk_scope))))
Domain = collections.namedtuple(
diff --git a/ydb/tools/cfg/dynamic.py b/ydb/tools/cfg/dynamic.py
index a3a0cb539b9..f4acce76b85 100644
--- a/ydb/tools/cfg/dynamic.py
+++ b/ydb/tools/cfg/dynamic.py
@@ -189,6 +189,8 @@ class DynamicConfigGenerator(object):
Type=drive.type,
Kind=drive.kind,
)
+ if drive.disk_scope is not None:
+ kwargs.update(DiskScope=drive.disk_scope)
if drive.pdisk_config is not None:
pc = pdisk_config.TPDiskConfig()
utils.wrap_parse_dict(drive.pdisk_config, pc)
diff --git a/ydb/tools/cfg/static.py b/ydb/tools/cfg/static.py
index fd6fb0d7e92..006c13834ba 100644
--- a/ydb/tools/cfg/static.py
+++ b/ydb/tools/cfg/static.py
@@ -1293,6 +1293,9 @@ class StaticConfigGenerator(object):
if drive.expected_slot_count is not None:
drive_pb.PDiskConfig.ExpectedSlotCount = drive.expected_slot_count
+ if drive.disk_scope is not None:
+ drive_pb.DiskScope = drive.disk_scope
+
# Full support of `pdisk_config`, not just copying selected fields manually
# from other non-typed locations
if drive.pdisk_config is not None:
@@ -1373,6 +1376,9 @@ class StaticConfigGenerator(object):
if drive.expected_slot_count is not None:
drive_pb.PDiskConfig.ExpectedSlotCount = drive.expected_slot_count
+ if drive.disk_scope is not None:
+ drive_pb.DiskScope = drive.disk_scope
+
my_group = self._read_generated_bs_config(
group.get("erasure"),
str(self.__cluster_details.min_fail_domains),
diff --git a/ydb/tools/cfg/types.py b/ydb/tools/cfg/types.py
index 914605a79df..3b7486fcdb3 100644
--- a/ydb/tools/cfg/types.py
+++ b/ydb/tools/cfg/types.py
@@ -202,6 +202,7 @@ class FailDomainType(enum.IntEnum):
Room = 20
Rack = 30
Body = 40
+ Disk_Scope = 50
Disk = 256
def __str__(self):
@@ -226,7 +227,8 @@ class FailDomainType(enum.IntEnum):
@staticmethod
def is_body_fail_domain(actual_faildomain):
- return str(actual_faildomain) in {str(FailDomainType.Body), str(FailDomainType.Disk)}
+ return str(actual_faildomain) in {str(FailDomainType.Body), str(FailDomainType.Disk),
+ str(FailDomainType.Disk_Scope)}
DistinctionLevels = {
@@ -234,6 +236,7 @@ DistinctionLevels = {
FailDomainType.Room: (10, 20, 10, 30),
FailDomainType.Rack: (10, 20, 10, 40),
FailDomainType.Body: (10, 20, 10, 50),
+ FailDomainType.Disk_Scope: (10, 20, 10, 60),
FailDomainType.Disk: (10, 20, 10, 256),
}
diff --git a/ydb/tools/cfg/validation.py b/ydb/tools/cfg/validation.py
index a75d66f9268..136fcaa3647 100644
--- a/ydb/tools/cfg/validation.py
+++ b/ydb/tools/cfg/validation.py
@@ -161,6 +161,7 @@ DRIVE_SCHEMA = {
"properties": {},
},
"kind": dict(type="integer"),
+ "disk_scope": dict(type="string"),
},
"required": ["type", "path"],
"additionalProperties": False,