virtcontainers: add warn log record for qmp hotplug cpu error

The qmp command of hotplug cpu failed error was hidden. It didn't friendly for
the user tracing the hotplug cpu error. The PR help us to improve the hotplug
cpu error log. Add real qemu command error log for `failed to hot add vCPUs`.
Through the error message, we can get the reason of the failed qmp command
 for hotplug cpu operation.

Fixes: #5234

Signed-off-by: wangyongchao.bj <wangyongchao.bj@inspur.com>
This commit is contained in:
wangyongchao.bj 2022-09-22 18:39:05 +08:00
parent ce22a9f134
commit 04bbce8dc3

View File

@ -1913,6 +1913,7 @@ func (q *qemu) hotplugAddCPUs(amount uint32) (uint32, error) {
}
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)
// don't fail, let's try with other CPU
continue
}