The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7998
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From 87e44ddcf8dfaa843b7375601aba550182217020 Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Thu, 8 Oct 2020 09:22:56 +0200 Subject: [PATCH 1/2] lxd/instance/drivers: Enable USB for VMs This enables USB for VMs. Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- lxd/instance/drivers/driver_qemu_templates.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxd/instance/drivers/driver_qemu_templates.go b/lxd/instance/drivers/driver_qemu_templates.go index 6950919840..2e825176b0 100644 --- a/lxd/instance/drivers/driver_qemu_templates.go +++ b/lxd/instance/drivers/driver_qemu_templates.go @@ -23,7 +23,7 @@ type = "pseries" type = "s390-ccw-virtio" {{end -}} accel = "kvm" -usb = "off" +usb = "on" graphics = "off" {{if eq .architecture "x86_64" -}} From a6c11f1114c67cb1c18a2c9ba83a5feeb92e5820 Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Thu, 8 Oct 2020 10:06:49 +0200 Subject: [PATCH 2/2] lxd/instance/drivers: Add USB controller to QEMU config This adds a USB controller to the QEMU config. Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- lxd/instance/drivers/driver_qemu.go | 11 +++++++++++ lxd/instance/drivers/driver_qemu_templates.go | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go index 62c1de7117..0b697cbf58 100644 --- a/lxd/instance/drivers/driver_qemu.go +++ b/lxd/instance/drivers/driver_qemu.go @@ -1749,6 +1749,17 @@ func (vm *qemu) generateQemuConfigFile(busName string, devConfs []*deviceConfig. return "", err } + devBus, devAddr, multi = bus.allocate(busFunctionGroupGeneric) + err = qemuUSB.Execute(sb, map[string]interface{}{ + "bus": bus.name, + "devBus": devBus, + "devAddr": devAddr, + "multifunction": multi, + }) + if err != nil { + return "", err + } + devBus, devAddr, multi = bus.allocate(busFunctionGroupNone) err = qemuSCSI.Execute(sb, map[string]interface{}{ "bus": bus.name, diff --git a/lxd/instance/drivers/driver_qemu_templates.go b/lxd/instance/drivers/driver_qemu_templates.go index 2e825176b0..c1b383bc6b 100644 --- a/lxd/instance/drivers/driver_qemu_templates.go +++ b/lxd/instance/drivers/driver_qemu_templates.go @@ -497,3 +497,14 @@ x-vga = "on" multifunction = "on" {{- end }} `)) + +var qemuUSB = template.Must(template.New("qemuUSB").Parse(` +# USB controller +[device "qemu_usb"] +driver = "qemu-xhci" +bus = "{{.devBus}}" +addr = "{{.devAddr}}" +{{if .multifunction -}} +multifunction = "on" +{{- end }} +`))
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel