From: Daan De Meyer Date: Fri, 27 Mar 2026 13:24:00 +0000 (+0100) Subject: vmspawn: Use qemu config file for smp and memory X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=73c0a797893f2fb8dcf70d883bbef2b9163f015d;p=thirdparty%2Fsystemd.git vmspawn: Use qemu config file for smp and memory Pass -no-user-config while we're at it to avoid loading qemu config from /etc which is more likely to cause hard to debug issues rather than do something useful. --- diff --git a/src/vmspawn/vmspawn.c b/src/vmspawn/vmspawn.c index 18f2833ae7f..0de314ac183 100644 --- a/src/vmspawn/vmspawn.c +++ b/src/vmspawn/vmspawn.c @@ -2308,6 +2308,16 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { return r; } + r = qemu_config_section(config_file, "smp-opts", /* id= */ NULL, + "cpus", arg_cpus ?: "1"); + if (r < 0) + return r; + + r = qemu_config_section(config_file, "memory", /* id= */ NULL, + "size", mem); + if (r < 0) + return r; + r = qemu_config_section(config_file, "object", "rng0", "qom-type", "rng-random", "filename", "/dev/urandom"); @@ -2349,8 +2359,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) { /* Start building the cmdline for items that must remain as command line arguments */ cmdline = strv_new(qemu_binary, - "-smp", arg_cpus ?: "1", - "-m", mem); + "-no-user-config"); if (!cmdline) return log_oom();