Skip to content

Commit ae22fee

Browse files
authored
[ydbd_slice] add more compatibility with ydb configuration (#12658)
1 parent 919b8c1 commit ae22fee

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

ydb/tools/cfg/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,17 @@ def forbid_implicit_storage_pools(self):
353353
def _get_datacenter(self, host_description):
354354
if host_description.get("datacenter") is not None:
355355
return str(host_description.get("datacenter"))
356-
return str(self._walle.get_datacenter(host_description["name"]))
356+
return str(self._walle.get_datacenter(host_description.get("name", host_description.get("host"))))
357357

358358
def _get_rack(self, host_description):
359359
if host_description.get("rack") is not None:
360360
return str(host_description.get("rack"))
361-
return str(self._walle.get_rack(host_description["name"]))
361+
return str(self._walle.get_rack(host_description.get("name", host_description.get("host"))))
362362

363363
def _get_body(self, host_description):
364364
if host_description.get("body") is not None:
365365
return str(host_description.get("body"))
366-
return str(self._walle.get_body(host_description["name"]))
366+
return str(self._walle.get_body(host_description.get("name", host_description.get("host"))))
367367

368368
def _collect_drives_info(self, host_description):
369369
host_config_id = host_description.get("host_config_id", None)
@@ -381,7 +381,7 @@ def _collect_drives_info(self, host_description):
381381

382382
def __collect_host_info(self, node_id, host_description):
383383
return KiKiMRHost(
384-
hostname=host_description["name"],
384+
hostname=host_description.get("name", host_description.get("host")),
385385
node_id=host_description.get("node_id", node_id),
386386
drives=self._collect_drives_info(host_description),
387387
ic_port=host_description.get("ic_port", DEFAULT_INTERCONNECT_PORT),
@@ -475,7 +475,7 @@ def accepted_cluster_uuids(self):
475475
def host_configs(self):
476476
converted_host_configs = []
477477
for host_config in self.__cluster_description.get("host_configs", []):
478-
host_config_drives = host_config.get("drives", [])
478+
host_config_drives = host_config.get("drives", host_config.get("drive", []))
479479
converted_host_configs.append(
480480
HostConfig(
481481
host_config_id=host_config["host_config_id"],

ydb/tools/cfg/validation.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,22 @@
244244
"type": "integer",
245245
},
246246
"node_id": {"type": "integer", "minLength": 1},
247+
"host": {"type": "string", "minLength": 1},
247248
},
248-
"required": [
249-
"name",
249+
"oneOf": [
250+
{
251+
"additionalProperties": False
252+
},
253+
{
254+
"required": [
255+
"name"
256+
]
257+
},
258+
{
259+
"required": [
260+
"host"
261+
]
262+
}
250263
],
251264
}
252265

@@ -1012,7 +1025,7 @@
10121025

10131026

10141027
def _host_and_ic_port(host):
1015-
return "%s:%s" % (host["name"], str(host.get("ic_port", 19001)))
1028+
return "%s:%s" % (host.get("name", host.get("host")), str(host.get("ic_port", 19001)))
10161029

10171030

10181031
def checkNameServiceDuplicates(validator, allow_duplicates, instance, schema):

0 commit comments

Comments
 (0)