]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: give ceph-iscsi permissions to configfs
authorMatthew Oliver <moliver@suse.com>
Tue, 5 May 2020 06:17:06 +0000 (16:17 +1000)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 21 May 2020 21:33:18 +0000 (23:33 +0200)
The cephadm container mounts the configfs and then bind mounts (-v) it
into the container. Currently the container is not a priviliaged
container which leads to 2 problems:

 1. The container can't insert the iscsi_target_mod kernel module; and
 2. The container can't write to the configfs as that's only writeable
    by root.

We _can_ get around 1, by preloading the kernel module. I.E add it the
systemd unit file. But that doesn't help with 2.

I've tried mounting the configfs with uid and gid options, but configfs
doesn't use them.

If we make the container a priviliged container then magically both 1
and 2 are solved. We don't need to preload the module so that's one less
workaround. But more importantly, configfs can be written to so we can
create ISCSI targets etc.

So that's what this patch does, it makes iscsi containers privileged
containers by setting the CephContainer --priviliged while creating it.

Fixes: https://tracker.ceph.com/issues/45252
Signed-off-by: Matthew Oliver <moliver@suse.com>
(cherry picked from commit 9b7dcb894c370570bf1e16982508eadb8b0c6f32)

src/cephadm/cephadm

index 934b1f6017d032b1162f2b63748c2e215cd2bc50..9260b1218cc8febf5c87401bdee1040f9d5c265b 100755 (executable)
@@ -1679,6 +1679,9 @@ def get_container(fsid, daemon_type, daemon_id,
     elif daemon_type == CephIscsi.daemon_type:
         entrypoint = CephIscsi.entrypoint
         name = '%s.%s' % (daemon_type, daemon_id)
+        # So the container can modprobe iscsi_target_mod and have write perms
+        # to configfs we need to make this a privileged container.
+        privileged = True
     else:
         entrypoint = ''
         name = ''