From 04644c1d5896b493d6aaf9ab66f2302cf67a2ee3 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 22 Sep 2020 10:07:10 +0200 Subject: [PATCH] rbd: enable mapping and unmapping from a network namespace Make rbdplugin pod work in a non-initial network namespace (i.e. with "hostNetwork: false") by skipping waiting for udev events when mapping and unmapping images. CSI use case is very simple: all that is needed is a device node which is immediately fed to mkfs, so we should be able to tolerate udev not being finished with the device just fine. Fixes: #1323 Signed-off-by: Ilya Dryomov --- internal/rbd/rbd_attach.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/rbd/rbd_attach.go b/internal/rbd/rbd_attach.go index e2a73d2f7..71f264a93 100644 --- a/internal/rbd/rbd_attach.go +++ b/internal/rbd/rbd_attach.go @@ -215,7 +215,15 @@ func appendDeviceTypeAndOptions(cmdArgs []string, isNbd bool, userOptions string } cmdArgs = append(cmdArgs, "--device-type", accessType) + if !isNbd { + // Enable mapping and unmapping images from a non-initial network + // namespace (e.g. for Multus CNI). The network namespace must be + // owned by the initial user namespace. + cmdArgs = append(cmdArgs, "--options", "noudev") + } if userOptions != "" { + // userOptions is appended after, possibly overriding the above + // default options. cmdArgs = append(cmdArgs, "--options", userOptions) }