]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: add rados_id to nvmeof conf
authorAdam King <adking@redhat.com>
Thu, 27 Jul 2023 19:44:47 +0000 (15:44 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:36:14 +0000 (13:36 -0400)
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 <adking@redhat.com>
(cherry picked from commit 3e8ad229f79a16bddd85a77bf5273f3751e33f56)

src/pybind/mgr/cephadm/services/nvmeof.py
src/pybind/mgr/cephadm/templates/services/nvmeof/ceph-nvmeof.conf.j2
src/pybind/mgr/cephadm/tests/test_services.py

index 62fcbd3d55f932345585f864fd546b19b0500311..5f904301aa292a0906de54d4437757e5e906eaff 100644 (file)
@@ -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)
 
index 86cc9eba79c1cece7fcaecef6945185c77e6a5f4..b6b063f08edd7fa47d3bb0874b6ee2784b5a89ba 100644 (file)
@@ -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 }}
index 26f5095db2305d120ea177c64547fe5be9d24ccb..84dc6d6a4981465d4e25880a81ac8fe45b665a83 100644 (file)
@@ -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