import subprocess
import tempfile
from typing import Dict, Tuple, Any, List, cast, Optional
+from configparser import ConfigParser
+from io import StringIO
from mgr_module import HandleCommandResult
from mgr_module import NFS_POOL_NAME as POOL_NAME
nodeid = f'{daemon_spec.service_name}.{daemon_spec.rank}'
+ nfs_idmap_conf = '/etc/ganesha/idmap.conf'
+
# create the RADOS recovery pool keyring
rados_user = f'{daemon_type}.{daemon_id}'
rados_keyring = self.create_keyring(daemon_spec)
"port": daemon_spec.ports[0] if daemon_spec.ports else 2049,
"bind_addr": bind_addr,
"haproxy_hosts": [],
+ "nfs_idmap_conf": nfs_idmap_conf,
}
if spec.enable_haproxy_protocol:
context["haproxy_hosts"] = self._haproxy_hosts()
logger.debug("selected haproxy_hosts: %r", context["haproxy_hosts"])
return self.mgr.template.render('services/nfs/ganesha.conf.j2', context)
+ # generate the idmap config
+ def get_idmap_conf() -> str:
+ idmap_conf = spec.idmap_conf
+ output = ''
+ if idmap_conf is not None:
+ cp = ConfigParser()
+ out = StringIO()
+ cp.read_dict(idmap_conf)
+ cp.write(out)
+ out.seek(0)
+ output = out.read()
+ out.close()
+ return output
+
# generate the cephadm config json
def get_cephadm_config() -> Dict[str, Any]:
config: Dict[str, Any] = {}
config['extra_args'] = ['-N', 'NIV_EVENT']
config['files'] = {
'ganesha.conf': get_ganesha_conf(),
+ 'idmap.conf': get_idmap_conf()
}
config.update(
self.get_config_and_keyring(
' Delegations = false;\n'
" RecoveryBackend = 'rados_cluster';\n"
' Minor_Versions = 1, 2;\n'
+ ' IdmapConf = "/etc/ganesha/idmap.conf";\n'
'}\n'
'\n'
'RADOS_KV {\n'
"%url rados://.nfs/foo/conf-nfs.foo"
)
nfs_expected_conf = {
- 'files': {'ganesha.conf': nfs_ganesha_txt},
+ 'files': {'ganesha.conf': nfs_ganesha_txt, 'idmap.conf': ''},
'config': '',
'extra_args': ['-N', 'NIV_EVENT'],
'keyring': (
extra_container_args: Optional[GeneralArgList] = None,
extra_entrypoint_args: Optional[GeneralArgList] = None,
enable_haproxy_protocol: bool = False,
+ idmap_conf: Optional[Dict[str, Dict[str, str]]] = None,
custom_configs: Optional[List[CustomConfig]] = None,
):
assert service_type == 'nfs'
self.port = port
self.virtual_ip = virtual_ip
self.enable_haproxy_protocol = enable_haproxy_protocol
+ self.idmap_conf = idmap_conf
def get_port_start(self) -> List[int]:
if self.port: