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: v19.0.0~681^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3e8ad229f79a16bddd85a77bf5273f3751e33f56;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 --- diff --git a/src/pybind/mgr/cephadm/services/nvmeof.py b/src/pybind/mgr/cephadm/services/nvmeof.py index 62fcbd3d55f9..5f904301aa29 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 86cc9eba79c1..b6b063f08edd 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 25e557631e11..e4e7709e096d 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