]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: make custom_configs work for tcmu-runner container 53072/head
authorAdam King <adking@redhat.com>
Mon, 21 Aug 2023 17:48:56 +0000 (13:48 -0400)
committerAdam King <adking@redhat.com>
Mon, 21 Aug 2023 17:54:13 +0000 (13:54 -0400)
This is intended to be a temporary workaround to make
custom config files be able to be mounted into
the tcmu-runner container. The hope is to refactor
cephadm's iscsi handling for squid, but a patch
like this could be useful for iscsi in older
releases where currently custom config files
are unusable for the tcmu-runner container

What this patch actually does is have us write the
custom config files to a dir for the tcmu-runner
container so that the rest of the logic works without
change. I thought this would be easier to remove later
than a patch that integrates more with the container
mounts or general deployment

The use case in mind is something like

service_type: iscsi
service_id: foo
service_name: iscsi.foo
placement:
  hosts:
  - host1
custom_configs:
  -  mount_path: /etc/tcmu/tcmu.conf
     content: |
       log_level = 4
spec:
  api_password: admin
  api_port: 5000
  api_user: admin
  pool: foo

which would allow users to modify the logging of the
tcmu-runner container for debugging purposes

Signed-off-by: Adam King <adking@redhat.com>
src/cephadm/cephadm.py

index 4ded78d64899b2b4057e9703249b711b7e4f7118..bd991dcb9b7730185ac3da75dcfa4ac131c106aa 100755 (executable)
@@ -3133,6 +3133,15 @@ def _write_custom_conf_files(ctx: CephadmContext, daemon_type: str, daemon_id: s
             file_path = os.path.join(custom_config_dir, os.path.basename(ccf['mount_path']))
             with write_new(file_path, owner=(uid, gid), encoding='utf-8') as f:
                 f.write(ccf['content'])
+            # temporary workaround to make custom config files work for tcmu-runner
+            # container we deploy with iscsi until iscsi is refactored
+            if daemon_type == 'iscsi':
+                tcmu_config_dir = custom_config_dir + '.tcmu'
+                if not os.path.exists(tcmu_config_dir):
+                    makedirs(tcmu_config_dir, uid, gid, 0o755)
+                tcmu_file_path = os.path.join(tcmu_config_dir, os.path.basename(ccf['mount_path']))
+                with write_new(tcmu_file_path, owner=(uid, gid), encoding='utf-8') as f:
+                    f.write(ccf['content'])
 
 
 def get_parm(option: str) -> Dict[str, str]: