[lxc-devel] [lxd/master] VM tweaks: no-user-config and chroot

tomponline on Github lxc-bot at linuxcontainers.org
Thu Dec 12 11:10:45 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 355 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191212/ce7a0dea/attachment.bin>
-------------- next part --------------
From 226e17eb60736c6b7f217c13ad29f250fd56a50f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 12 Dec 2019 10:48:17 +0000
Subject: [PATCH 1/2] lxd/instance/qemu/vm/qemu: Adds -no-user-config to qemu
 start flags

This option makes QEMU not load any of the user-provided config files on sysconfdir. We want to avoid any existing user config files from affecting how our VMs start.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/instance/qemu/vm_qemu.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxd/instance/qemu/vm_qemu.go b/lxd/instance/qemu/vm_qemu.go
index 9643c3247a..3dd7c28642 100644
--- a/lxd/instance/qemu/vm_qemu.go
+++ b/lxd/instance/qemu/vm_qemu.go
@@ -628,6 +628,7 @@ func (vm *Qemu) Start(stateful bool) error {
 		"-serial", "chardev:console",
 		"-nodefaults",
 		"-no-reboot",
+		"-no-user-config",
 		"-readconfig", confFile,
 		"-pidfile", vm.pidFilePath(),
 	}

From cc269600eafe33d8d11d64d93467f2b26233fd43 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 12 Dec 2019 10:55:15 +0000
Subject: [PATCH 2/2] lxd/instance/qemu/vm/qemu: Adds chroot flag to qemu start
 up command

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/instance/qemu/vm_qemu.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lxd/instance/qemu/vm_qemu.go b/lxd/instance/qemu/vm_qemu.go
index 3dd7c28642..f0c18f58ff 100644
--- a/lxd/instance/qemu/vm_qemu.go
+++ b/lxd/instance/qemu/vm_qemu.go
@@ -631,7 +631,9 @@ func (vm *Qemu) Start(stateful bool) error {
 		"-no-user-config",
 		"-readconfig", confFile,
 		"-pidfile", vm.pidFilePath(),
+		"-chroot", vm.Path(),
 	}
+
 	if shared.IsTrue(vm.expandedConfig["limits.memory.hugepages"]) {
 		args = append(args, "-mem-path", "/dev/hugepages/", "-mem-prealloc")
 	}


More information about the lxc-devel mailing list