提交 e9a24e3e 编写于 作者: P Peter Krempa

virterror: Add error message for unsupported operations.

This patch introduces a new error code VIR_ERR_OPERATION_UNSUPPORTED to
mark error messages regarding operations that failed due to lack of
support on the hypervisor or other than libvirt issues.

The code is first used in reporting error if qemu does not support block
IO tuning variables yielding error message:
error: Unable to get block I/O throttle parameters
error: Operation not supported: block_io_throttle field
'total_bytes_sec' missing in qemu's output

instead of:
error: Unable to get block I/O throttle parameters
error: internal error cannot read total_bytes_sec
上级 54264111
...@@ -277,6 +277,8 @@ typedef enum { ...@@ -277,6 +277,8 @@ typedef enum {
VIR_ERR_MIGRATE_UNSAFE = 81, /* Migration is not safe */ VIR_ERR_MIGRATE_UNSAFE = 81, /* Migration is not safe */
VIR_ERR_OVERFLOW = 82, /* integer overflow */ VIR_ERR_OVERFLOW = 82, /* integer overflow */
VIR_ERR_BLOCK_COPY_ACTIVE = 83, /* action prevented by block copy job */ VIR_ERR_BLOCK_COPY_ACTIVE = 83, /* action prevented by block copy job */
VIR_ERR_OPERATION_UNSUPPORTED = 84, /* The requested operation is not
supported */
} virErrorNumber; } virErrorNumber;
/** /**
......
...@@ -3652,11 +3652,11 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon, ...@@ -3652,11 +3652,11 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
if (virJSONValueObjectGetNumberUlong(inserted, \ if (virJSONValueObjectGetNumberUlong(inserted, \
FIELD, \ FIELD, \
&reply->STORE) < 0) { \ &reply->STORE) < 0) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
_("block_io_throttle field '%s' missing " \ _("block_io_throttle field '%s' missing " \
"in qemu's output"), \ "in qemu's output"), \
#STORE); \ #STORE); \
goto cleanup; \ goto cleanup; \
} }
static int static int
qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result, qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result,
......
...@@ -1185,6 +1185,12 @@ virErrorMsg(virErrorNumber error, const char *info) ...@@ -1185,6 +1185,12 @@ virErrorMsg(virErrorNumber error, const char *info)
else else
errmsg = _("block copy still active: %s"); errmsg = _("block copy still active: %s");
break; break;
case VIR_ERR_OPERATION_UNSUPPORTED:
if (!info)
errmsg = _("Operation not supported");
else
errmsg = _("Operation not supported: %s");
break;
} }
return errmsg; return errmsg;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册