[systemd-devel] [PATCH 2/2] detect-virt: dmi: look for KVM
Wei Huang
wei at redhat.com
Tue Nov 3 21:13:12 PST 2015
On 11/03/2015 03:19 PM, Andrew Jones wrote:
> Some guests (ARM, AArch64, x86-RHEL) have 'KVM' in the product name.
See bab27ea2 of qemu tree...
> Look for that first in order to more precisely report "kvm" when
> detecting a QEMU/KVM guest. Without this patch we report "qemu",
> even if KVM acceleration is in use on ARM/AArch64 guests.
> ---
> src/basic/virt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/basic/virt.c b/src/basic/virt.c
> index b0e33dc5f4d24..254dc7dba4dd9 100644
> --- a/src/basic/virt.c
> +++ b/src/basic/virt.c
> @@ -147,6 +147,7 @@ static int detect_vm_dmi(void) {
> #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
>
> static const char *const dmi_vendors[] = {
> + "/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */
> "/sys/class/dmi/id/sys_vendor",
> "/sys/class/dmi/id/board_vendor",
> "/sys/class/dmi/id/bios_vendor"
> @@ -156,6 +157,7 @@ static int detect_vm_dmi(void) {
> const char *vendor;
> int id;
> } dmi_vendor_table[] = {
> + { "KVM", VIRTUALIZATION_KVM },
> { "QEMU", VIRTUALIZATION_QEMU },
> /* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
> { "VMware", VIRTUALIZATION_VMWARE },
>
This should work for any QEMU target that supports smbios after
bab27ea2 commit. So I am OK with it.
reviewed-by: Wei Huang <wei at redhat.com>
More information about the systemd-devel
mailing list