cephadm: covert iscsi type to provide a customize_container_binds method

Convert the CephIscsi type's get_container_binds to
customize_container_binds and use it in the generic method.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2023-11-04 18:03:40 -04:00
parent f80cf438b3
commit 21563528d1

View File

@ -1087,16 +1087,16 @@ class CephIscsi(ContainerDaemonForm):
mounts['/dev'] = '/dev'
return mounts
@staticmethod
def get_container_binds():
# type: () -> List[List[str]]
binds = []
lib_modules = ['type=bind',
'source=/lib/modules',
'destination=/lib/modules',
'ro=true']
def customize_container_binds(
self, ctx: CephadmContext, binds: List[List[str]]
) -> None:
lib_modules = [
'type=bind',
'source=/lib/modules',
'destination=/lib/modules',
'ro=true',
]
binds.append(lib_modules)
return binds
@staticmethod
def get_version(ctx, container_id):
@ -2554,10 +2554,11 @@ def _write_custom_conf_files(
def get_container_binds(
ctx: CephadmContext, ident: 'DaemonIdentity'
) -> List[List[str]]:
binds = list()
binds: List[List[str]] = list()
if ident.daemon_type == CephIscsi.daemon_type:
binds.extend(CephIscsi.get_container_binds())
iscsi = CephIscsi.create(ctx, ident)
iscsi.customize_container_binds(ctx, binds)
if ident.daemon_type == CephNvmeof.daemon_type:
binds.extend(CephNvmeof.get_container_binds())
elif ident.daemon_type == CustomContainer.daemon_type: