From: Teoman ONAY Date: Tue, 31 May 2022 08:34:05 +0000 (+0200) Subject: Modify how Iscsi tcmu-runner container is started within systemd X-Git-Tag: v17.2.8~486^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5eb81043b2d04a489c2e64b10f82c11e32026f8;p=ceph.git Modify how Iscsi tcmu-runner container is started within systemd Modify Iscsi tcmu-runner container to be run demonized in the same systemd slice as all other ceph processes Signed-off-by: Teoman ONAY (cherry picked from commit 79c51938e88dc903f03faa42a94070ff8874a7fa) --- diff --git a/qa/workunits/cephadm/test_iscsi_pids_limit.sh b/qa/workunits/cephadm/test_iscsi_pids_limit.sh index c11fd0f7bdd..bed4cc9e274 100755 --- a/qa/workunits/cephadm/test_iscsi_pids_limit.sh +++ b/qa/workunits/cephadm/test_iscsi_pids_limit.sh @@ -10,6 +10,11 @@ ISCSI_CONT_IDS=$(sudo podman ps -qa --filter='name=iscsi') CONT_COUNT=$(echo ${ISCSI_CONT_IDS} | wc -w) test ${CONT_COUNT} -eq 2 +for i in ${ISCSI_CONT_IDS} +do + test $(sudo podman exec ${i} cat /sys/fs/cgroup/pids/pids.max) == max +done + for i in ${ISCSI_CONT_IDS} do sudo podman exec ${i} /bin/sh -c 'for j in {0..20000}; do sleep 300 & done' diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 47b245869d8..788b8494827 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -925,13 +925,12 @@ class CephIscsi(object): def get_tcmu_runner_container(self): # type: () -> CephContainer - tcmu_container = get_container(self.ctx, self.fsid, self.daemon_type, self.daemon_id) + # daemon_id, is used to generated the cid and pid files used by podman but as both tcmu-runner + # and rbd-target-api have the same daemon_id, it conflits and prevent the second container from + # starting. .tcmu runner is appened to the daemon_id to fix that. + tcmu_container = get_container(self.ctx, self.fsid, self.daemon_type, str(self.daemon_id) + '.tcmu') tcmu_container.entrypoint = '/usr/bin/tcmu-runner' tcmu_container.cname = self.get_container_name(desc='tcmu') - # remove extra container args for tcmu container. - # extra args could cause issue with forking service type - tcmu_container.container_args = [] - set_pids_limit_unlimited(self.ctx, tcmu_container.container_args) return tcmu_container ################################## @@ -2994,6 +2993,10 @@ def get_container_mounts(ctx, fsid, daemon_type, daemon_id, if daemon_type == CephIscsi.daemon_type: assert daemon_id data_dir = get_data_dir(fsid, ctx.data_dir, daemon_type, daemon_id) + # Removes ending ".tcmu" from data_dir a tcmu-runner uses the same data_dir + # as rbd-runner-api + if data_dir.endswith('.tcmu'): + data_dir = re.sub(r'\.tcmu$', '', data_dir) log_dir = get_log_dir(fsid, ctx.log_dir) mounts.update(CephIscsi.get_container_mounts(data_dir, log_dir)) @@ -3510,9 +3513,12 @@ def deploy_daemon_units( _write_container_cmd_to_bash(ctx, f, poststop, 'deactivate osd') elif daemon_type == CephIscsi.daemon_type: # make sure we also stop the tcmu container + runtime_dir = '/run' ceph_iscsi = CephIscsi.init(ctx, fsid, daemon_id) tcmu_container = ceph_iscsi.get_tcmu_runner_container() f.write('! ' + ' '.join(tcmu_container.stop_cmd()) + '\n') + f.write('! ' + 'rm ' + runtime_dir + '/ceph-%s@%s.%s.service-pid' % (fsid, daemon_type, str(daemon_id) + '.tcmu') + '\n') + f.write('! ' + 'rm ' + runtime_dir + '/ceph-%s@%s.%s.service-cid' % (fsid, daemon_type, str(daemon_id) + '.tcmu') + '\n') f.write(' '.join(CephIscsi.configfs_mount_umount(data_dir, mount=False)) + '\n') os.fchmod(f.fileno(), 0o600) os.rename(data_dir + '/unit.poststop.new',