1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-10 05:17:59 +03:00

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
This commit is contained in:
Peter Krempa 2012-08-09 15:12:12 +02:00
parent 54264111ff
commit e9a24e3e3d
3 changed files with 10 additions and 2 deletions

View File

@ -277,6 +277,8 @@ typedef enum {
VIR_ERR_MIGRATE_UNSAFE = 81, /* Migration is not safe */
VIR_ERR_OVERFLOW = 82, /* integer overflow */
VIR_ERR_BLOCK_COPY_ACTIVE = 83, /* action prevented by block copy job */
VIR_ERR_OPERATION_UNSUPPORTED = 84, /* The requested operation is not
supported */
} virErrorNumber;
/**

View File

@ -3652,11 +3652,11 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
if (virJSONValueObjectGetNumberUlong(inserted, \
FIELD, \
&reply->STORE) < 0) { \
virReportError(VIR_ERR_INTERNAL_ERROR, \
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \
_("block_io_throttle field '%s' missing " \
"in qemu's output"), \
#STORE); \
goto cleanup; \
goto cleanup; \
}
static int
qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result,

View File

@ -1185,6 +1185,12 @@ virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = _("block copy still active: %s");
break;
case VIR_ERR_OPERATION_UNSUPPORTED:
if (!info)
errmsg = _("Operation not supported");
else
errmsg = _("Operation not supported: %s");
break;
}
return errmsg;
}