]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vmspawn: Use qemu config file for smp and memory
authorDaan De Meyer <daan@amutable.com>
Fri, 27 Mar 2026 13:24:00 +0000 (14:24 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 2 Apr 2026 11:19:40 +0000 (13:19 +0200)
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.

src/vmspawn/vmspawn.c

index 18f2833ae7f310995324d95b235d7d32295b60ce..0de314ac183ab3f6f295cb089f7fb43a40975ea5 100644 (file)
@@ -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();