提交 4f397746 编写于 作者: P Peter Krempa

API: Add VIR_DOMAIN_JOB_ERRMSG domain job statistics field

In some cases it's useful to report the error which caused the domain
job to fail. Add an optional field for holding the error message so that
it can be later retrieved from statistics of a completed job.

Add the field name macro and code for extracting it in virsh.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 72186f9c
...@@ -3612,6 +3612,15 @@ typedef enum { ...@@ -3612,6 +3612,15 @@ typedef enum {
*/ */
# define VIR_DOMAIN_JOB_SUCCESS "success" # define VIR_DOMAIN_JOB_SUCCESS "success"
/**
* VIR_DOMAIN_JOB_ERRMSG:
*
* virDomainGetJobStats field: Present only in statistics for a completed job.
* Optional error message for a failed job.
*/
# define VIR_DOMAIN_JOB_ERRMSG "errmsg"
/** /**
* VIR_DOMAIN_JOB_DISK_TEMP_USED: * VIR_DOMAIN_JOB_DISK_TEMP_USED:
* virDomainGetJobStats field: current usage of temporary disk space for the * virDomainGetJobStats field: current usage of temporary disk space for the
......
...@@ -6226,6 +6226,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) ...@@ -6226,6 +6226,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
unsigned long long value; unsigned long long value;
unsigned int flags = 0; unsigned int flags = 0;
int ivalue; int ivalue;
const char *svalue;
int op; int op;
int rc; int rc;
size_t i; size_t i;
...@@ -6506,6 +6507,13 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) ...@@ -6506,6 +6507,13 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"), val, unit); vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"), val, unit);
} }
if ((rc = virTypedParamsGetString(params, nparams, VIR_DOMAIN_JOB_ERRMSG,
&svalue)) < 0) {
goto save_error;
} else if (rc == 1) {
vshPrint(ctl, "%-17s %s\n", _("Error message:"), svalue);
}
ret = true; ret = true;
cleanup: cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册