[lxc-devel] [lxd/master] lxd/instance/qemu: Follow symlink to lxd-agent

stgraber on Github lxc-bot at linuxcontainers.org
Wed Nov 25 02:48:35 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 441 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201124/4fe9020e/attachment.bin>
-------------- next part --------------
From 4ae8fa38c7bdca69b80662e97ca199de38324bf4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 24 Nov 2020 21:47:54 -0500
Subject: [PATCH] lxd/instance/qemu: Follow symlink to lxd-agent
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

For those few distros that use a symlink instead of the real thing.

Closes #8185

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/instance/drivers/driver_qemu.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 68cd144666..e0b1378f4a 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -1330,6 +1330,11 @@ func (d *qemu) generateConfigShare() error {
 		logger.Warnf("lxd-agent not found, skipping its inclusion in the VM config drive: %v", err)
 	} else {
 		// Install agent into config drive dir if found.
+		path, err = filepath.EvalSymlinks(path)
+		if err != nil {
+			return err
+		}
+
 		err = shared.FileCopy(path, filepath.Join(configDrivePath, "lxd-agent"))
 		if err != nil {
 			return err


More information about the lxc-devel mailing list