]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: fix the hang-up of cryptsetup on creating encrypted OSD
authorSatoru Takeuchi <satoru.takeuchi@gmail.com>
Fri, 24 Apr 2020 16:56:03 +0000 (16:56 +0000)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 21 May 2020 21:33:18 +0000 (23:33 +0200)
Creating encrypted OSD fails due to the container's dedicated ipc
namespace. Sharing the ipc namespace with host resolve this problem.

Here is the log.

 ```
 host# cephadm shell
 ...
 # cat spec.yaml
 service_type: osd
 service_id: example_osd_spec
 placement:
   host_pattern: '*'
 data_devices:
   all: true
 encrypted: true
 # ceph orch apply osd -i spec.yaml
 NAME             HOST       DATA     DB WAL
 example_osd_spec ubuntu1804 /dev/sdb -  -
 # ceph osd tree
 ID  CLASS  WEIGHT  TYPE NAME     STATUS  REWEIGHT  PRI-AFF
 -1              0  root default
  0              0  osd.0           down         0  1.00000
 ```

It happens because cryptsetup wait some semaphore forever. This
semaphore is acquired in the host namespace.

 ```
 # exit              # log out from shell
 host# pstree -p
 ...
            |                  |-containerd-shim(11804)-+-ceph-volume(11821)---cryptsetup(12004)
 ...
 host# ps --pid 12004 -o pid,comm,args,wchan
   PID COMMAND         COMMAND                     WCHAN
 12004 cryptsetup      /usr/sbin/cryptsetup --key- semtimedop
 host#
 ```

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
(cherry picked from commit bcdabfc96c15c83afc01c155eb6b424a609271ae)

src/cephadm/cephadm

index 7c4dc03eb54c7dfa2803505800cf302f53a89a44..55b21723759df2fe36312546b403f9b2228bbfe8 100755 (executable)
@@ -2120,6 +2120,7 @@ class CephContainer:
             'run',
             '--rm',
             '--net=host',
+            '--ipc=host',
         ] + self.container_args + priv + \
         cname + envs + \
         vols + entrypoint + \
@@ -2153,6 +2154,7 @@ class CephContainer:
             'run',
             '--rm',
             '--net=host',
+            '--ipc=host',
         ] + self.container_args + priv + envs + vols + [
             '--entrypoint', cmd[0],
             self.image