From 00e664043697ec06475a02bbfb0670053aa79db4 Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Wed, 24 Apr 2024 21:19:50 +0100 Subject: [PATCH] create: Use libvirt's default machine type on non-x86[_64] arches Signed-off-by: Alberto Faria --- src/commands/create/domain.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/create/domain.rs b/src/commands/create/domain.rs index 6c6f94b..c16ad8f 100644 --- a/src/commands/create/domain.rs +++ b/src/commands/create/domain.rs @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later +use std::env; use std::fs::File; use std::io::{BufReader, Write}; @@ -61,7 +62,11 @@ fn generate( st(w, "memory", &[("unit", "b")], memory.as_str())?; s(w, "os", &[], |w| { - st(w, "type", &[("machine", "q35")], "hvm") + let attrs = match ["x86", "x86_64"].contains(&env::consts::ARCH) { + true => [("machine", "q35")].as_slice(), + false => [].as_slice(), // use libvirt's default + }; + st(w, "type", attrs, "hvm") })?; // fw_cfg requires ACPI