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: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
*/
# 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:
* virDomainGetJobStats field: current usage of temporary disk space for the
unsigned long long value;
unsigned int flags = 0;
int ivalue;
+ const char *svalue;
int op;
int rc;
size_t i;
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;
cleanup: