From ce81bc5ce829bb673d9a7a316e12612146e635e7 Mon Sep 17 00:00:00 2001 From: Wen Congyang Date: Tue, 15 Mar 2011 16:53:06 +0800 Subject: [PATCH] qemu: Fallback to HMP when cpu_set QMP command is not found --- src/qemu/qemu_monitor_json.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 95fd39c256..152afbac76 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1450,7 +1450,14 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, if (!cmd) return -1; - ret = qemuMonitorJSONCommand(mon, cmd, &reply); + if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0) + goto cleanup; + + if (qemuMonitorJSONHasError(reply, "CommandNotFound")) { + VIR_DEBUG0("cpu_set command not found, trying HMP"); + ret = qemuMonitorTextSetCPU(mon, cpu, online); + goto cleanup; + } if (ret == 0) { /* XXX See if CPU soft-failed due to lack of ACPI */ @@ -1468,10 +1475,7 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, ret = 1; } -#if 0 cleanup: -#endif - virJSONValueFree(cmd); virJSONValueFree(reply); return ret; -- 2.39.5