mirror of https://gitee.com/openkylin/libvirt.git
qemu: Return real error message for block_set_io_throttle
This patch will also adjust the qemuMonitorJSONSetBlockIoThrottle error procession so that rather than returning/displaying: "error: internal error: Unexpected error" Fetch the actual error message from qemu and display that
This commit is contained in:
parent
d24835f2ae
commit
0ac8b70bb3
|
@ -4618,15 +4618,19 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virJSONValueObjectHasKey(result, "error")) {
|
if (virJSONValueObjectHasKey(result, "error")) {
|
||||||
if (qemuMonitorJSONHasError(result, "DeviceNotActive"))
|
if (qemuMonitorJSONHasError(result, "DeviceNotActive")) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("No active operation on device: %s"), device);
|
_("No active operation on device: %s"), device);
|
||||||
else if (qemuMonitorJSONHasError(result, "NotSupported"))
|
} else if (qemuMonitorJSONHasError(result, "NotSupported")) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("Operation is not supported for device: %s"), device);
|
_("Operation is not supported for device: %s"), device);
|
||||||
else
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virJSONValuePtr error = virJSONValueObjectGet(result, "error");
|
||||||
_("Unexpected error"));
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("unable to execute '%s', unexpected error: '%s'"),
|
||||||
|
qemuMonitorJSONCommandName(cmd),
|
||||||
|
qemuMonitorJSONStringifyError(error));
|
||||||
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue