The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7144

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) ===
Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From e16ef85a171ff6959e30db579a44a4d44f883c5b Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Mon, 6 Apr 2020 17:02:49 +0100
Subject: [PATCH] lxd/storage: Create snapshot mount path before mounting

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/storage/backend_lxd.go    | 6 ++++++
 lxd/storage/drivers/volume.go | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 4621290a7f..03c4f55486 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -1888,6 +1888,12 @@ func (b *lxdBackend) MountInstanceSnapshot(inst 
instance.Instance, op *operation
        // Get the volume.
        vol := b.newVolume(volType, contentType, volStorageName, rootDiskConf)
 
+       // Create mount directory if missing.
+       err = vol.EnsureMountPath()
+       if err != nil {
+               return false, err
+       }
+
        return b.driver.MountVolumeSnapshot(vol, op)
 }
 
diff --git a/lxd/storage/drivers/volume.go b/lxd/storage/drivers/volume.go
index e52f7ad685..4b3acc8d65 100644
--- a/lxd/storage/drivers/volume.go
+++ b/lxd/storage/drivers/volume.go
@@ -164,6 +164,12 @@ func (v Volume) MountTask(task func(mountPath string, op 
*operations.Operation)
        if isSnap {
                unlock := locking.Lock(v.pool, string(v.volType), v.name)
 
+               // Create mount directory if missing.
+               err := v.EnsureMountPath()
+               if err != nil {
+                       return err
+               }
+
                ourMount, err := v.driver.MountVolumeSnapshot(v, op)
                if err != nil {
                        unlock()
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to