mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 18:30:03 +00:00
qemu: Respect the JSON schema for hot plug
When hot-plugging CPUs on QEMU, we send a QMP command with JSON
arguments. QEMU 9.2 recently became more strict[1] enforcing the
JSON schema for QMP parameters. As a result, running Kata Containers
with QEMU 9.2 results in a message complaining that the core-id
parameter is expected to be an integer:
```
qmp hotplug cpu, cpuID=cpu-0 socketID=1, error:
QMP command failed:
Invalid parameter type for 'core-id', expected: integer
```
Fix that by changing the core-id, socket-id and thread-id to be
integer values.
[1]: be93fd5372
Fixes: #11633
Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
This commit is contained in:
committed by
Christophe de Dinechin
parent
163f04a918
commit
ec480dc438
@@ -2197,20 +2197,20 @@ func (q *qemu) hotplugAddCPUs(amount uint32) (uint32, error) {
|
||||
// CPU type, i.e host-x86_64-cpu
|
||||
driver := hc.Type
|
||||
cpuID := fmt.Sprintf("cpu-%d", len(q.state.HotpluggedVCPUs))
|
||||
socketID := fmt.Sprintf("%d", hc.Properties.Socket)
|
||||
dieID := fmt.Sprintf("%d", hc.Properties.Die)
|
||||
coreID := fmt.Sprintf("%d", hc.Properties.Core)
|
||||
threadID := fmt.Sprintf("%d", hc.Properties.Thread)
|
||||
socketID := hc.Properties.Socket
|
||||
dieID := hc.Properties.Die
|
||||
coreID := hc.Properties.Core
|
||||
threadID := hc.Properties.Thread
|
||||
|
||||
// If CPU type is IBM pSeries, Z or arm virt, we do not set socketID and threadID
|
||||
if machine.Type == "pseries" || machine.Type == QemuCCWVirtio || machine.Type == "virt" {
|
||||
socketID = ""
|
||||
threadID = ""
|
||||
dieID = ""
|
||||
socketID = -1
|
||||
threadID = -1
|
||||
dieID = -1
|
||||
}
|
||||
|
||||
if err := q.qmpMonitorCh.qmp.ExecuteCPUDeviceAdd(q.qmpMonitorCh.ctx, driver, cpuID, socketID, dieID, coreID, threadID, romFile); err != nil {
|
||||
q.Logger().WithField("hotplug", "cpu").Warnf("qmp hotplug cpu, cpuID=%s socketID=%s, error: %v", cpuID, socketID, err)
|
||||
q.Logger().WithField("hotplug", "cpu").Warnf("qmp hotplug cpu, cpuID=%s socketID=%d, error: %v", cpuID, socketID, err)
|
||||
// don't fail, let's try with other CPU
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user