From 18e21f82a92e31e5cbddfa45ab74e14218a5dc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Mon, 19 Feb 2024 15:16:07 +0100 Subject: [PATCH] mounts/validate: Don't check source exists with CreateMountpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't error out when mount source doesn't exist and mounts has `CreateMountpoint` option enabled. Signed-off-by: Paweł Gronowski (cherry picked from commit 05b883bdc836a2fd621452f58a2a2c02d253718c) Signed-off-by: Akihiro Suda --- volume/mounts/linux_parser.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/volume/mounts/linux_parser.go b/volume/mounts/linux_parser.go index bcabe45720f63..1013a6bae725f 100644 --- a/volume/mounts/linux_parser.go +++ b/volume/mounts/linux_parser.go @@ -94,7 +94,9 @@ func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSour if err != nil { return &errMountConfig{mnt, err} } - if !exists { + + createMountpoint := mnt.BindOptions != nil && mnt.BindOptions.CreateMountpoint + if !exists && !createMountpoint { return &errMountConfig{mnt, errBindSourceDoesNotExist(mnt.Source)} } }