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 <adking@redhat.com>
This commit is contained in:
Adam King 2023-07-27 15:44:47 -04:00
parent 7195fb2ae1
commit 3e8ad229f7
3 changed files with 7 additions and 2 deletions

View 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)

View 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 }}

View 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