From: Adam King Date: Thu, 27 Jul 2023 19:44:47 +0000 (-0400) Subject: mgr/cephadm: add rados_id to nvmeof conf X-Git-Tag: v18.2.1~326^2~31 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b3c81c3358940a0365128e43ebaa18aa18daa39d;p=ceph.git mgr/cephadm: add rados_id to nvmeof conf This is going to be used as the rados_id to be set when connecting to the cluster using the keyring we generate for the nvmeof daemon. The python librados library defaults the name to "client.admin" and so if we don't provide a name or rados_id, we'll only be able to use nvmeof with the "client.admin" keyring Signed-off-by: Adam King (cherry picked from commit 3e8ad229f79a16bddd85a77bf5273f3751e33f56) --- diff --git a/src/pybind/mgr/cephadm/services/nvmeof.py b/src/pybind/mgr/cephadm/services/nvmeof.py index 62fcbd3d55f93..5f904301aa292 100644 --- a/src/pybind/mgr/cephadm/services/nvmeof.py +++ b/src/pybind/mgr/cephadm/services/nvmeof.py @@ -36,14 +36,17 @@ class NvmeofService(CephService): # TODO: check if we can force jinja2 to generate dicts with double quotes instead of using json.dumps transport_tcp_options = json.dumps(spec.transport_tcp_options) if spec.transport_tcp_options else None + name = '{}.{}'.format(utils.name_to_config_section('nvmeof'), igw_id) + rados_id = name[len('client.'):] if name.startswith('client.') else name context = { 'spec': spec, - 'name': '{}.{}'.format(utils.name_to_config_section('nvmeof'), igw_id), + 'name': name, 'addr': self.mgr.get_mgr_ip(), 'port': spec.port, 'log_level': 'WARN', 'rpc_socket': '/var/tmp/spdk.sock', - 'transport_tcp_options': transport_tcp_options + 'transport_tcp_options': transport_tcp_options, + 'rados_id': rados_id } gw_conf = self.mgr.template.render('services/nvmeof/ceph-nvmeof.conf.j2', context) diff --git a/src/pybind/mgr/cephadm/templates/services/nvmeof/ceph-nvmeof.conf.j2 b/src/pybind/mgr/cephadm/templates/services/nvmeof/ceph-nvmeof.conf.j2 index 86cc9eba79c1c..b6b063f08edd7 100644 --- a/src/pybind/mgr/cephadm/templates/services/nvmeof/ceph-nvmeof.conf.j2 +++ b/src/pybind/mgr/cephadm/templates/services/nvmeof/ceph-nvmeof.conf.j2 @@ -11,6 +11,7 @@ state_update_interval_sec = 5 [ceph] pool = {{ spec.pool }} config_file = /etc/ceph/ceph.conf +id = {{ rados_id }} [mtls] server_key = {{ spec.server_key }} diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index 26f5095db2305..84dc6d6a49814 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -379,6 +379,7 @@ state_update_interval_sec = 5 [ceph] pool = {pool} config_file = /etc/ceph/ceph.conf +id = nvmeof.{nvmeof_daemon_id} [mtls] server_key = ./server.key