Skip to content

Commit 050c0f9

Browse files
committed
Adding support for extra args by using the field tgt_cmd_extra_args
Signed-off-by: Redouane Kachach <[email protected]>
1 parent 5a043fe commit 050c0f9

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

src/cephadm/cephadm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,8 @@ def get_container_mounts(data_dir: str) -> Dict[str, str]:
10241024
mounts['/etc/ceph/ceph.client.admin.keyring'] = '/etc/ceph/keyring:z' # TODO: FIXME
10251025
mounts[os.path.join(data_dir, 'ceph-nvmeof.conf')] = '/src/ceph-nvmeof.conf:z'
10261026
mounts[os.path.join(data_dir, 'configfs')] = '/sys/kernel/config'
1027-
# mounts[log_dir] = '/var/log:z' # TODO: would we need a logdir?
1028-
mounts['/dev'] = '/dev'
1027+
mounts['/dev/hugepages'] = '/dev/hugepages'
1028+
mounts['/dev/vfio/vfio'] = '/dev/vfio/vfio'
10291029
return mounts
10301030

10311031
@staticmethod
@@ -1104,7 +1104,7 @@ def configfs_mount_umount(data_dir, mount=True):
11041104
@staticmethod
11051105
def get_sysctl_settings() -> List[str]:
11061106
return [
1107-
'vm.nr_hugepages = 2048',
1107+
'vm.nr_hugepages = 4096',
11081108
]
11091109

11101110

@@ -6552,7 +6552,7 @@ def _dispatch_deploy(
65526552
ports=daemon_ports)
65536553
elif daemon_type == CephNvmeof.daemon_type:
65546554
config, keyring = get_config_and_keyring(ctx)
6555-
uid, gid = 65534, 65534 # TODO: check this
6555+
uid, gid = 167, 167 # TODO: need to get properly the uid/gid
65566556
c = get_deployment_container(ctx, ctx.fsid, daemon_type, daemon_id)
65576557
deploy_daemon(ctx, ctx.fsid, daemon_type, daemon_id, c, uid, gid,
65586558
config=config, keyring=keyring,

src/pybind/mgr/cephadm/services/nvmeof.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import errno
22
import logging
3+
import json
34
from typing import List, cast, Optional
45

56
from mgr_module import HandleCommandResult
@@ -32,14 +33,17 @@ def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonD
3233
'mds', 'allow *',
3334
'mgr', 'allow *',
3435
'osd', 'allow *'])
36+
37+
# TODO: check if we can force jinja2 to generate dicts with double quotes instead of using json.dumps
38+
transport_tcp_options = json.dumps(spec.transport_tcp_options) if spec.transport_tcp_options else None
3539
context = {
3640
'spec': spec,
3741
'name': '{}.{}'.format(utils.name_to_config_section('nvmeof'), igw_id),
3842
'addr': self.mgr.get_mgr_ip(),
3943
'port': spec.port,
40-
'tgt_cmd_extra_args': None,
4144
'log_level': 'WARN',
4245
'rpc_socket': '/var/tmp/spdk.sock',
46+
'transport_tcp_options': transport_tcp_options
4347
}
4448
gw_conf = self.mgr.template.render('services/nvmeof/ceph-nvmeof.conf.j2', context)
4549

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ timeout = {{ spec.timeout }}
2525
log_level = {{ log_level }}
2626
conn_retries = {{ spec.conn_retries }}
2727
transports = {{ spec.transports }}
28-
{% if tgt_cmd_extra_args %}
29-
tgt_cmd_extra_args = {{ tgt_cmd_extra_args }}
28+
{% if transport_tcp_options %}
29+
transport_tcp_options = {{ transport_tcp_options }}
30+
{% endif %}
31+
{% if spec.tgt_cmd_extra_args %}
32+
tgt_cmd_extra_args = {{ spec.tgt_cmd_extra_args | tojson }}
3033
{% endif %}

src/pybind/mgr/cephadm/tests/test_services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ def test_nvmeof_config(self, _get_name, _run_cephadm, cephadm_module: CephadmOrc
392392
timeout = 60
393393
log_level = WARN
394394
conn_retries = 10
395-
transports = tcp\n"""
395+
transports = tcp
396+
transport_tcp_options = {{"in_capsule_data_size": 8192, "max_io_qpairs_per_ctrlr": 7}}\n"""
396397

397398
with with_host(cephadm_module, 'test'):
398399
with with_service(cephadm_module, NvmeofServiceSpec(service_id=pool,

src/python-common/ceph/deployment/service_spec.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,14 +1126,17 @@ def __init__(self,
11261126
tgt_path: Optional[str] = None,
11271127
timeout: Optional[int] = 60,
11281128
conn_retries: Optional[int] = 10,
1129-
transports: Optional[str] = "tcp",
1129+
transports: Optional[str] = 'tcp',
1130+
transport_tcp_options: Optional[Dict[str, int]] =
1131+
{"in_capsule_data_size": 8192, "max_io_qpairs_per_ctrlr": 7},
1132+
tgt_cmd_extra_args: Optional[str] = None,
11301133
placement: Optional[PlacementSpec] = None,
11311134
unmanaged: bool = False,
11321135
preview_only: bool = False,
11331136
config: Optional[Dict[str, str]] = None,
11341137
networks: Optional[List[str]] = None,
1135-
extra_container_args: Optional[List[str]] = None,
1136-
extra_entrypoint_args: Optional[List[str]] = None,
1138+
extra_container_args: Optional[GeneralArgList] = None,
1139+
extra_entrypoint_args: Optional[GeneralArgList] = None,
11371140
custom_configs: Optional[List[CustomConfig]] = None,
11381141
):
11391142
assert service_type == 'nvmeof'
@@ -1171,8 +1174,12 @@ def __init__(self,
11711174
self.timeout = timeout
11721175
#: ``conn_retries`` ceph connection retries number
11731176
self.conn_retries = conn_retries
1174-
#: ``transports`` TODO
1177+
#: ``transports`` tcp
11751178
self.transports = transports
1179+
#: List of extra arguments for transports in the form opt=value
1180+
self.transport_tcp_options: Optional[Dict[str, int]] = transport_tcp_options
1181+
#: ``tgt_cmd_extra_args`` extra arguments for the nvmf_tgt process
1182+
self.tgt_cmd_extra_args = tgt_cmd_extra_args
11761183

11771184
def get_port_start(self) -> List[int]:
11781185
return [5500, 4420, 8009]

0 commit comments

Comments
 (0)