[lxc-devel] [lxd/master] lxd/vm: Fix disk files and snap

stgraber on Github lxc-bot at linuxcontainers.org
Thu Feb 20 00:31:32 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200219/cc969ae4/attachment.bin>
-------------- next part --------------
From e2aab9a60ceee3347c9af802cdbf9068af876161 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 19 Feb 2020 19:31:15 -0500
Subject: [PATCH] lxd/vm: Fix disk files and snap
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/device/disk.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index 0faf207996..9f10a0d157 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -391,17 +391,17 @@ func (d *disk) startVM() (*deviceConfig.RunConfig, error) {
 		return &runConf, nil
 	} else if d.config["source"] != "" {
 		// This is a normal disk device or image.
-		if !shared.PathExists(d.config["source"]) {
+		if !shared.PathExists(shared.HostPath(d.config["source"])) {
 			return nil, fmt.Errorf("Cannot find disk source")
 		}
 
-		if shared.IsDir(d.config["source"]) {
+		if shared.IsDir(shared.HostPath(d.config["source"])) {
 			return nil, fmt.Errorf("Only block devices and disk images can be attached to VMs")
 		}
 
 		runConf.Mounts = []deviceConfig.MountEntryItem{
 			{
-				DevPath: d.config["source"],
+				DevPath: shared.HostPath(d.config["source"]),
 				DevName: d.name,
 			},
 		}


More information about the lxc-devel mailing list