[lxc-devel] [lxd/master] vm: Add raw.qemu

stgraber on Github lxc-bot at linuxcontainers.org
Mon Nov 25 05:46:18 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191124/128033b0/attachment.bin>
-------------- next part --------------
From 995aea5f0aaaa279b4545483a0c1b0857604cdad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 25 Nov 2019 00:44:46 -0500
Subject: [PATCH 1/4] lxd: Add raw.qemu
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/vm_qemu.go | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lxd/vm_qemu.go b/lxd/vm_qemu.go
index 41c0e57292..43e1619a73 100644
--- a/lxd/vm_qemu.go
+++ b/lxd/vm_qemu.go
@@ -557,7 +557,24 @@ func (vm *vmQemu) Start(stateful bool) error {
 		return err
 	}
 
-	_, err = shared.RunCommand(qemuBinary, "-name", vm.Name(), "-uuid", vmUUID, "-daemonize", "-cpu", "host", "-nographic", "-serial", "chardev:console", "-nodefaults", "-readconfig", confFile, "-pidfile", vm.pidFilePath())
+	args := []string{
+		"-name", vm.Name(),
+		"-uuid", vmUUID,
+		"-daemonize",
+		"-cpu", "host",
+		"-nographic",
+		"-serial", "chardev:console",
+		"-nodefaults",
+		"-readconfig", confFile,
+		"-pidfile", vm.pidFilePath(),
+	}
+
+	if vm.expandedConfig["raw.qemu"] != "" {
+		fields := strings.Split(vm.expandedConfig["raw.qemu"], " ")
+		args = append(args, fields...)
+	}
+
+	_, err = shared.RunCommand(qemuBinary, args...)
 	if err != nil {
 		return err
 	}

From 6e6e0c466345aef0f5c8731bd768412ba184cf01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 25 Nov 2019 00:45:09 -0500
Subject: [PATCH 2/4] shared: Add raw.qemu
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>
---
 shared/instance.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/shared/instance.go b/shared/instance.go
index 70a121c4bb..c404cbf7c0 100644
--- a/shared/instance.go
+++ b/shared/instance.go
@@ -331,9 +331,10 @@ var KnownInstanceConfigKeys = map[string]func(value string) error{
 
 	// Caller is responsible for full validation of any raw.* value
 	"raw.apparmor": IsAny,
+	"raw.idmap":    IsAny,
 	"raw.lxc":      IsAny,
+	"raw.qemu":     IsAny,
 	"raw.seccomp":  IsAny,
-	"raw.idmap":    IsAny,
 
 	"volatile.apply_template":   IsAny,
 	"volatile.base_image":       IsAny,

From 989d356f87a165499503596104a59ceb903b9c59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 25 Nov 2019 00:45:14 -0500
Subject: [PATCH 3/4] doc: Add raw.qemu
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>
---
 doc/instances.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/instances.md b/doc/instances.md
index 087a36bde5..ed2074e064 100644
--- a/doc/instances.md
+++ b/doc/instances.md
@@ -64,6 +64,7 @@ nvidia.require.driver                           | string    | -
 raw.apparmor                                    | blob      | -                 | yes           | Apparmor profile entries to be appended to the generated profile
 raw.idmap                                       | blob      | -                 | no            | Raw idmap configuration (e.g. "both 1000 1000")
 raw.lxc                                         | blob      | -                 | no            | Raw LXC configuration to be appended to the generated one
+raw.qemu                                        | blob      | -                 | no            | Raw Qemu configuration to be appended to the generated command line
 raw.seccomp                                     | blob      | -                 | no            | Raw Seccomp configuration
 security.devlxd                                 | boolean   | true              | no            | Controls the presence of /dev/lxd in the instance
 security.devlxd.images                          | boolean   | false             | no            | Controls the availability of the /1.0/images API over devlxd

From 77ec272dcd6a56fd172ef239c492702d1e3581c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 25 Nov 2019 00:45:31 -0500
Subject: [PATCH 4/4] scripts/bash: Add raw.qemu
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>
---
 scripts/bash/lxd-client | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/bash/lxd-client b/scripts/bash/lxd-client
index 6365a6f4b1..9dcd8c5ce5 100644
--- a/scripts/bash/lxd-client
+++ b/scripts/bash/lxd-client
@@ -89,8 +89,8 @@ _have lxc && {
       limits.processes linux.kernel_modules migration.incremental.memory \
       migration.incremental.memory.goal nvidia.runtime \
       nvidia.driver.capabilities nvidia.require.cuda nvidia.require.driver \
-      migration.incremental.memory.iterations raw.apparmor raw.idmap raw.lxc \
-      raw.seccomp security.idmap.base security.idmap.isolated \
+      migration.incremental.memory.iterations raw.apparmor raw.idmap raw.qemu \
+      raw.lxc raw.seccomp security.idmap.base security.idmap.isolated \
       security.idmap.size security.devlxd security.devlxd.images \
       security.nesting security.privileged security.protection.delete \
       security.protection.shift security.syscalls.blacklist \


More information about the lxc-devel mailing list