[lxc-devel] [lxd/master] lxd: Add hypervisor detection

monstermunchkin on Github lxc-bot at linuxcontainers.org
Wed Nov 13 15:03:47 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 473 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191113/a610e3b8/attachment.bin>
-------------- next part --------------
From fe1cee3e23354da1036d4f194279a1386ec1d9df Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 13 Nov 2019 16:02:39 +0100
Subject: [PATCH] lxd: Add hypervisor detection

VMs can detect the LXD hypervisor by checking `dmidecode -s
system-product-name` which will then be set to `LXD`.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/vm_qemu.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/vm_qemu.go b/lxd/vm_qemu.go
index 2a87f9c893..3c11fd1a31 100644
--- a/lxd/vm_qemu.go
+++ b/lxd/vm_qemu.go
@@ -471,7 +471,7 @@ func (vm *vmQemu) Start(stateful bool) error {
 		return err
 	}
 
-	_, err = shared.RunCommand("qemu-system-x86_64", "-name", vm.Name(), "-uuid", vmUUID, "-daemonize", "-cpu", "host", "-nographic", "-serial", "chardev:console", "-nodefaults", "-readconfig", confFile, "-pidfile", vm.pidFilePath())
+	_, err = shared.RunCommand("qemu-system-x86_64", "-name", vm.Name(), "-uuid", vmUUID, "-daemonize", "-cpu", "host", "-nographic", "-serial", "chardev:console", "-smbios", "type=1,product=LXD", "-nodefaults", "-readconfig", confFile, "-pidfile", vm.pidFilePath())
 	if err != nil {
 		return err
 	}


More information about the lxc-devel mailing list