Skip to content

Commit

Permalink
Merge pull request ceph#59738 from gbregman/main
Browse files Browse the repository at this point in the history
Make the discovery and gateway IPs configurable in NVMEof configuration
  • Loading branch information
gbregman authored Sep 11, 2024
2 parents 0537c19 + 9eb3b99 commit e5d6b43
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/pybind/mgr/cephadm/services/nvmeof.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 6 additions & 0 deletions src/python-common/ceph/deployment/service_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ def __init__(self,
service_id: Optional[str] = None,
name: Optional[str] = None,
group: Optional[str] = None,
addr: Optional[str] = None,
port: Optional[int] = None,
pool: Optional[str] = None,
enable_auth: bool = False,
Expand Down Expand Up @@ -1347,6 +1348,7 @@ def __init__(self,
transport_tcp_options: Optional[Dict[str, int]] =
{"in_capsule_data_size": 8192, "max_io_qpairs_per_ctrlr": 7},
tgt_cmd_extra_args: Optional[str] = None,
discovery_addr: Optional[str] = None,
discovery_port: Optional[int] = None,
log_level: Optional[str] = 'INFO',
log_files_enabled: Optional[bool] = True,
Expand Down Expand Up @@ -1378,6 +1380,8 @@ def __init__(self,

#: RADOS pool where ceph-nvmeof config data is stored.
self.pool = pool
#: ``addr`` address of the nvmeof gateway
self.addr = addr or "0.0.0.0"
#: ``port`` port of the nvmeof gateway
self.port = port or 5500
#: ``name`` name of the nvmeof gateway
Expand Down Expand Up @@ -1442,6 +1446,8 @@ def __init__(self,
self.transport_tcp_options: Optional[Dict[str, int]] = transport_tcp_options
#: ``tgt_cmd_extra_args`` extra arguments for the nvmf_tgt process
self.tgt_cmd_extra_args = tgt_cmd_extra_args
#: ``discovery_addr`` address of the discovery service
self.discovery_addr = discovery_addr or "0.0.0.0"
#: ``discovery_port`` port of the discovery service
self.discovery_port = discovery_port or 8009
#: ``log_level`` the nvmeof gateway log level
Expand Down

0 comments on commit e5d6b43

Please sign in to comment.