From a73dc19ce9a528f18c02f39e62c831ad7d60955c Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 13 Sep 2025 23:33:51 -0400 Subject: [PATCH] engine: resources: Fix virt hotplug At some point, this seems to have rotted, since I assume upstream started requiring this updated XML spec. Fix it now. --- engine/resources/virt.go | 3 ++- modules/virtualization/main.mcl | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/resources/virt.go b/engine/resources/virt.go index 4f1ad7c7..c7cf34e5 100644 --- a/engine/resources/virt.go +++ b/engine/resources/virt.go @@ -939,7 +939,8 @@ func (obj *VirtRes) getDomainXML() string { if i < obj.CPUs { enabled = "yes" } - b += fmt.Sprintf("", i, enabled) + // all vcpus must have either set or unset order + b += fmt.Sprintf("", i, enabled, i+1) } b += fmt.Sprintf("") } else { diff --git a/modules/virtualization/main.mcl b/modules/virtualization/main.mcl index 64254aa6..a1759cfd 100644 --- a/modules/virtualization/main.mcl +++ b/modules/virtualization/main.mcl @@ -138,11 +138,11 @@ class vm($name, $config) { $mac_6 = strings.substr($hex, 2, 3) + strings.substr($hex, 3, 4) # TODO: support $hex[2] or $hex[2:2] ? $mac_tail = "01:" + $mac_5 + ":" + $mac_6 - # XXX: with hotcpus => true AND cpus => 2 I get: - # domainCreate failed: virError(Code=67, Domain=10, Message='unsupported configuration: all vcpus must have either set or unset order') + $cpus = $config->cpus || 2 + virt "${name}" { uri => "qemu:///session", - cpus => 2, + cpus => $cpus, maxcpus => 8, memory => 1024*1024*16, # 16G of RAM state => "running", @@ -170,7 +170,7 @@ class vm($name, $config) { username => "", password => "", }, - hotcpus => false, # no fun today! + hotcpus => true, # "that's hot!" restartondiverge => "", restartonrefresh => false,