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.
This commit is contained in:
James Shubin
2025-09-13 23:33:51 -04:00
parent bcf57f8581
commit a73dc19ce9
2 changed files with 6 additions and 5 deletions

View File

@@ -939,7 +939,8 @@ func (obj *VirtRes) getDomainXML() string {
if i < obj.CPUs { if i < obj.CPUs {
enabled = "yes" enabled = "yes"
} }
b += fmt.Sprintf("<vcpu id='%d' enabled='%s' hotpluggable='yes'/>", i, enabled) // all vcpus must have either set or unset order
b += fmt.Sprintf("<vcpu id='%d' enabled='%s' hotpluggable='yes' order='%d'/>", i, enabled, i+1)
} }
b += fmt.Sprintf("</vcpus>") b += fmt.Sprintf("</vcpus>")
} else { } else {

View File

@@ -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_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 $mac_tail = "01:" + $mac_5 + ":" + $mac_6
# XXX: with hotcpus => true AND cpus => 2 I get: $cpus = $config->cpus || 2
# domainCreate failed: virError(Code=67, Domain=10, Message='unsupported configuration: all vcpus must have either set or unset order')
virt "${name}" { virt "${name}" {
uri => "qemu:///session", uri => "qemu:///session",
cpus => 2, cpus => $cpus,
maxcpus => 8, maxcpus => 8,
memory => 1024*1024*16, # 16G of RAM memory => 1024*1024*16, # 16G of RAM
state => "running", state => "running",
@@ -170,7 +170,7 @@ class vm($name, $config) {
username => "", username => "",
password => "", password => "",
}, },
hotcpus => false, # no fun today! hotcpus => true, # "that's hot!"
restartondiverge => "", restartondiverge => "",
restartonrefresh => false, restartonrefresh => false,