From 9eb3b99b99b0b8c6c4e5f75e59c2e4835a9d6796 Mon Sep 17 00:00:00 2001 From: Gil Bregman Date: Wed, 11 Sep 2024 17:06:19 +0300 Subject: [PATCH] mgr/cephadm: Make the discovery and gateway IPs configurable in NVMEof configuration Fixes https://tracker.ceph.com/issues/68030 Signed-off-by: Gil Bregman --- src/pybind/mgr/cephadm/services/nvmeof.py | 9 ++++++++- .../templates/services/nvmeof/ceph-nvmeof.conf.j2 | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/services/nvmeof.py b/src/pybind/mgr/cephadm/services/nvmeof.py index b91427dcace0f..2ceb6208fce47 100644 --- a/src/pybind/mgr/cephadm/services/nvmeof.py +++ b/src/pybind/mgr/cephadm/services/nvmeof.py @@ -47,10 +47,17 @@ def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonD transport_tcp_options = json.dumps(spec.transport_tcp_options) if spec.transport_tcp_options else None name = '{}.{}'.format(utils.name_to_config_section('nvmeof'), nvmeof_gw_id) rados_id = name[len('client.'):] if name.startswith('client.') else name + addr = host_ip + discovery_addr = host_ip + if spec.addr and spec.addr != "0.0.0.0": + addr = spec.addr + if spec.discovery_addr and spec.discovery_addr != "0.0.0.0": + discovery_addr = spec.discovery_addr context = { 'spec': spec, 'name': name, - 'addr': host_ip, + 'addr': addr, + 'discovery_addr': discovery_addr, 'port': spec.port, 'spdk_log_level': 'WARNING', 'rpc_socket_dir': '/var/tmp/', 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 644ca586ba93f..dbe29004771ad 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 @@ -32,7 +32,7 @@ max_log_directory_backups = {{ spec.max_log_directory_backups }} log_directory = {{ spec.log_directory }} [discovery] -addr = {{ addr }} +addr = {{ discovery_addr }} port = {{ spec.discovery_port }} [ceph]