LOGROTATE_DIR,
LOG_DIR,
LOG_DIR_MODE,
- PIDS_LIMIT_UNLIMITED_PODMAN_VERSION,
SYSCTL_DIR,
UNIT_DIR,
)
unlimited_daemons.add(NFSGanesha.daemon_type)
if daemon_type not in unlimited_daemons:
return
- if (
- isinstance(ctx.container_engine, Podman)
- and ctx.container_engine.version >= PIDS_LIMIT_UNLIMITED_PODMAN_VERSION
- ):
- container_args.append('--pids-limit=-1')
- else:
- container_args.append('--pids-limit=0')
+ container_args.append(ctx.container_engine.unlimited_pids_option)
def get_container(
def EXE(self) -> str:
raise NotImplementedError()
+ @property
+ def unlimited_pids_option(self) -> str:
+ """The option to pass to the container engine for allowing unlimited
+ pids (processes).
+ """
+ return '--pids-limit=0'
+
def __str__(self) -> str:
return f'{self.EXE} ({self.path})'
CGROUPS_SPLIT_PODMAN_VERSION,
DEFAULT_MODE,
MIN_PODMAN_VERSION,
+ PIDS_LIMIT_UNLIMITED_PODMAN_VERSION,
)
from .exceptions import Error
"""Return true if this version of podman supports split cgroups."""
return self.version >= CGROUPS_SPLIT_PODMAN_VERSION
+ @property
+ def unlimited_pids_option(self) -> str:
+ """The option to pass to the container engine for allowing unlimited
+ pids (processes).
+ """
+ if self.version >= PIDS_LIMIT_UNLIMITED_PODMAN_VERSION:
+ return '--pids-limit=-1'
+ return '--pids-limit=0'
+
def service_args(
self, ctx: CephadmContext, service_name: str
) -> List[str]:
docker = mock.Mock(Docker)
docker.path = '/usr/bin/docker'
+ type(docker).unlimited_pids_option = Docker.unlimited_pids_option
return docker
# https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock
type(podman).supports_split_cgroups = Podman.supports_split_cgroups
type(podman).service_args = Podman.service_args
+ type(podman).unlimited_pids_option = Podman.unlimited_pids_option
return podman