It is not a fatal error if some monitor command is not supported. So we should not return -1 when human-monitor-command is not supported. Set reply_str to "unknown command: 'human-monitor-command'", and the caller can deal this error the same as the command that we want to run by human-monitor-command. Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> --- src/qemu/qemu_monitor_json.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 13d12c8..7ec4ce7 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -694,6 +694,16 @@ qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon, if (!cmd || qemuMonitorJSONCommandWithFd(mon, cmd, scm_fd, &reply) < 0) goto cleanup; + if (qemuMonitorJSONHasError(reply, "CommandNotFound")) { + *reply_str = strdup("unknown command: 'human-monitor-command'"); + if (!*reply_str) { + virReportOOMError(); + goto cleanup; + } + ret = 0; + goto cleanup; + } + if (qemuMonitorJSONCheckError(cmd, reply)) goto cleanup; -- 1.7.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list