[lxc-devel] [lxd/master] lxd/device/disk: Include network-config in cidata

stgraber on Github lxc-bot at linuxcontainers.org
Tue Nov 24 18:04:01 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/20201124/b73b4211/attachment.bin>
-------------- next part --------------
From 610d38f21c2eeff3c1f31f3edb30860d559bd2dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 24 Nov 2020 13:02:26 -0500
Subject: [PATCH] lxd/device/disk: Include network-config in cidata
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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lxd/device/disk.go b/lxd/device/disk.go
index ada3f82160..da29808a40 100644
--- a/lxd/device/disk.go
+++ b/lxd/device/disk.go
@@ -1757,6 +1757,15 @@ func (d *disk) generateVMConfigDrive() (string, error) {
 		return "", err
 	}
 
+	// Include a network-config file if the user configured it.
+	networkConfig := instanceConfig["user.network-config"]
+	if networkConfig != "" {
+		err = ioutil.WriteFile(filepath.Join(scratchDir, "network-config"), []byte(networkConfig), 0400)
+		if err != nil {
+			return "", err
+		}
+	}
+
 	// Append any custom meta-data to our predefined meta-data config.
 	metaData := fmt.Sprintf(`instance-id: %s
 local-hostname: %s


More information about the lxc-devel mailing list