From 3bd3129a748538161c718b21e5e293773343ef16 Mon Sep 17 00:00:00 2001 From: Gustav Behm Date: Tue, 31 Oct 2023 13:04:54 +0100 Subject: [PATCH] Set Qemu's -smp option --- openbsd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openbsd b/openbsd index dc523fa..e3808f5 100755 --- a/openbsd +++ b/openbsd @@ -683,6 +683,7 @@ class Qemu: self.reboot = False self.memory = None + self.cpus = None self.disk = None self.hostname = None @@ -709,6 +710,8 @@ class Qemu: self.cmdline = qemu.base_cmdline.copy() self.cmdline += [ "-m", str(qemu.memory or 512) ] + if qemu.cpus: + self.cmdline += [ "-smp", str(qemu.cpus) ] if qemu.disk: drive = [ "file=" + qemu.disk ] @@ -1461,6 +1464,7 @@ async def do_base(args): with Files.from_args(args, base) as files: async with Autoinstall(base, files, mode="install") as ai: ai.qemu.memory = base.get("memory") + ai.qemu.cpus = base.get("cpus") # TODO: does this work for the bsd.rd? what = "phase(base)" timeout = base.get("timeout", 20*60) @@ -1489,6 +1493,7 @@ async def do_site(args, image=None): with Files.from_args(args, site) as files: async with Autoinstall(site, files, mode="upgrade") as ai: ai.qemu.memory = site.get("memory") + ai.qemu.cpus = site.get("cpus") # TODO: does this work for the bsd.rd? what = "phase(site)" timeout = site.get("timeout", 15*60) @@ -1517,6 +1522,7 @@ class Run: self.qemu.reboot = self.spec.get("reboot", False) self.qemu.disk = args.image self.qemu.memory = self.spec.get("memory") + self.qemu.cpus = self.spec.get("cpus") self.qemu.serial = Qemu.UNIX self.ssh_port = vars(args).get("ssh_port") or self.spec.get("ssh", {}).get("port", utils.random_ephemeral_port())