The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7554
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Convert to absolute from /. Skip if mount point doesn't exist and can't be created. See https://discuss.linuxcontainers.org/t/lxd-4-2-error-when-attaching-additional-disk-to-vm/8215 Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 5a6b4127a71e12c6b9d96276a0e207fa12f78dff Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Fri, 19 Jun 2020 10:59:51 +0100 Subject: [PATCH] lxd-agent/main/agent: Fix 9p mount when relative target path is supplied Convert to absolute from /. Skip if mount point doesn't exist and can't be created. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd-agent/main_agent.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lxd-agent/main_agent.go b/lxd-agent/main_agent.go index 74e01068ef..887428f12f 100644 --- a/lxd-agent/main_agent.go +++ b/lxd-agent/main_agent.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "os/signal" + "strings" "time" "github.com/pkg/errors" @@ -211,10 +212,16 @@ func (c *cmdAgent) mountHostShares() { } for _, mount := range agentMounts { + // Convert relative mounts to absolute from / otherwise dir creation fails or mount fails. + if !strings.HasPrefix(mount.Target, "/") { + mount.Target = fmt.Sprintf("/%s", mount.Target) + } + if !shared.PathExists(mount.Target) { err := os.MkdirAll(mount.Target, 0755) if err != nil { logger.Errorf("Failed to create mount target %q", mount.Target) + continue // Don't try to mount if mount point can't be created. } }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel