aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorserg-belyakov <serg-belyakov@ydb.tech>2023-12-14 11:35:51 +0300
committerserg-belyakov <serg-belyakov@ydb.tech>2023-12-14 12:52:09 +0300
commit90fe6772091959f61dc45f60551feab9da2f8166 (patch)
treeeec3035dba8185fd8ac1b96093439826fb8b4cc4
parentee2eaafb0dea43ffcd65a7ff2d80c38fbb5d63cc (diff)
downloadydb-90fe6772091959f61dc45f60551feab9da2f8166.tar.gz
Add fake PDisk key to kikimr_cfg, KIKIMR-20141
Fix multinode configure Add pdisk key config
-rw-r--r--ydb/core/blobstorage/nodewarden/node_warden_impl.cpp2
-rw-r--r--ydb/tools/cfg/base.py1
-rw-r--r--ydb/tools/cfg/static.py13
-rw-r--r--ydb/tools/cfg/templates.py7
4 files changed, 22 insertions, 1 deletions
diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
index c1ed9babac..66c6f1e0e2 100644
--- a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
+++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
@@ -666,7 +666,7 @@ bool NKikimr::ObtainPDiskKey(NPDisk::TMainKey *mainKey, const NKikimrProto::TKey
const ui8 *key;
ui32 keySize;
keys[i].Key.GetKeyBytes(&key, &keySize);
- Y_DEBUG_ABORT_UNLESS(keySize == sizeof(ui64));
+ Y_DEBUG_ABORT_UNLESS(keySize == 4 * sizeof(ui64));
mainKey->Keys.push_back(*(ui64*)key);
}
mainKey->IsInitialized = true;
diff --git a/ydb/tools/cfg/base.py b/ydb/tools/cfg/base.py
index bedc22719f..c3e1188f8c 100644
--- a/ydb/tools/cfg/base.py
+++ b/ydb/tools/cfg/base.py
@@ -293,6 +293,7 @@ class ClusterDetailsProvider(object):
self.static_cpu_count = self.__cluster_description.get("static_cpu_count", 20)
self.dynamic_cpu_count = self.__cluster_description.get("dynamic_cpu_count", 8)
self.blob_storage_config = self.__cluster_description.get("blob_storage_config")
+ self.pdisk_key_config = self.__cluster_description.get("pdisk_key_config", {})
if not self.need_txt_files and not self.use_new_style_kikimr_cfg:
assert "cannot remove txt files without new style kikimr cfg!"
diff --git a/ydb/tools/cfg/static.py b/ydb/tools/cfg/static.py
index e6249c53f1..09cb9bbba1 100644
--- a/ydb/tools/cfg/static.py
+++ b/ydb/tools/cfg/static.py
@@ -17,6 +17,7 @@ from ydb.core.protos import (
cms_pb2,
config_pb2,
feature_flags_pb2,
+ key_pb2,
netclassifier_pb2,
pqconfig_pb2,
resource_broker_pb2,
@@ -99,6 +100,7 @@ class StaticConfigGenerator(object):
"netclassifier.txt": None,
"pqcd.txt": None,
"failure_injection.txt": None,
+ "pdisk_key.txt": None,
}
self.__optional_config_files = set(
(
@@ -107,6 +109,7 @@ class StaticConfigGenerator(object):
"audit.txt",
"fq.txt",
"failure_injection.txt",
+ "pdisk_key.txt",
)
)
self._enable_cms_config_cache = template.get("enable_cms_config_cache", enable_cms_config_cache)
@@ -254,6 +257,14 @@ class StaticConfigGenerator(object):
return self.__proto_config("fq.txt").ByteSize() > 0
@property
+ def pdisk_key_txt(self):
+ return self.__proto_config("pdisk_key.txt", key_pb2.TKeyConfig, self.__cluster_details.pdisk_key_config)
+
+ @property
+ def pdisk_key_txt_enabled(self):
+ return self.__proto_config("pdisk_key.txt").ByteSize() > 0
+
+ @property
def mbus_enabled(self):
mbus_config = self.__cluster_details.get_service("message_bus_config")
return mbus_config is not None and len(mbus_config) > 0
@@ -499,6 +510,8 @@ class StaticConfigGenerator(object):
if self.hive_config.ByteSize() > 0:
app_config.HiveConfig.CopyFrom(self.hive_config)
app_config.MergeFrom(self.tracing_txt)
+ if self.pdisk_key_txt_enabled:
+ app_config.PDiskKeyConfig.CopyFrom(self.pdisk_key_txt)
return app_config
def __proto_config(self, config_file, config_class=None, cluster_details_for_field=None):
diff --git a/ydb/tools/cfg/templates.py b/ydb/tools/cfg/templates.py
index 7f509afe5e..266574e7a6 100644
--- a/ydb/tools/cfg/templates.py
+++ b/ydb/tools/cfg/templates.py
@@ -21,6 +21,7 @@ BASE_VARS = [
("kikimr_auth_token_file", "${kikimr_home}/token/kikimr.token"),
("kikimr_dyn_ns_file", "${kikimr_config}/dyn_ns.txt"),
("kikimr_tracing_file", "${kikimr_config}/tracing.txt"),
+ ("kikimr_pdisk_key_file", "${kikimr_config}/pdisk_key.txt"),
]
NODE_ID_LOCAL_VAR = """
@@ -154,6 +155,12 @@ if [ -f "${kikimr_dyn_ns_file}" ]; then
kikimr_arg="${kikimr_arg}${kikimr_dyn_ns_file:+ --dyn-nodes-file ${kikimr_dyn_ns_file}}"
fi
+if [ -f "${kikimr_pdisk_key_file}" ]; then
+ kikimr_arg="${kikimr_arg}${kikimr_pdisk_key_file:+ --pdisk-key-file ${kikimr_pdisk_key_file}}"
+else
+ echo "PDisk Key file not found!"
+fi
+
kikimr_arg="${kikimr_arg}${kikimr_ca:+ --ca=${kikimr_ca}}${kikimr_cert:+ --cert=${kikimr_cert}}${kikimr_key:+ --key=${kikimr_key}}"
kikimr_arg="${kikimr_arg} ${kikimr_tracing_file}"
"""