From nobody Sun Feb 8 22:20:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587030966; cv=none; d=zohomail.com; s=zohoarc; b=YkWWpLuH2WFYOAwVI+tSHIbUnKtIbZRUO8TIFuSAP16GMRSdE5HneNjqsHdaf2RapNr1e+I9BUDhag+3C9mFeu5l4ZPcg9LPXmkXudlpb/8bl1feFFIVAiro0diqus2JPaX2lOwlICM4s8DOqP6H+31Ixy/65SVIwzDYH8A3AHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587030966; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6I2ZOlfggfHLblS8Vz0AL1J+qt8PMKlHnSGcC41/cd0=; b=eAK5YOuEOjt+M7A4/RGfW/8A+POHuXkRGc4uoh+AgG1kqgjzRbxqoNlYIH1UtWz4LfuuaZ1XKT/XarwmtbnC0DZ4xwz6eHISH4HYTRgpuNbmywuSMZ1eGigyGIAVsANw3b/Q9Cm/2dLS5tT92pAgRwXwxdH6Z3V1bIEWhZEqBtQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1587030966696104.41560123923534; Thu, 16 Apr 2020 02:56:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-ldlPGa4ePGiLqXgrSMmkfQ-1; Thu, 16 Apr 2020 05:56:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F862108442D; Thu, 16 Apr 2020 09:55:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F3102719A; Thu, 16 Apr 2020 09:55:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DA1AF18089C8; Thu, 16 Apr 2020 09:55:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03G9tsbi020193 for ; Thu, 16 Apr 2020 05:55:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id B243D5DA7B; Thu, 16 Apr 2020 09:55:54 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2676A5DA2C for ; Thu, 16 Apr 2020 09:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587030965; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6I2ZOlfggfHLblS8Vz0AL1J+qt8PMKlHnSGcC41/cd0=; b=Qzv/moPLP6Wv68tH2v18aMhAjBpMsZBmYrc7Ve12yUS23b9qU87UKx/fgOa5EGMYtgHTJl j5gpZ22ezGIk/ZYZI3mko2JNyL0B1TGCXjeWwCRKGj95rO4W20sIlMESgfJMixuvil2jBw mwt7vNIqyvDl1YMogP2H/yf1jWZNtbs= X-MC-Unique: ldlPGa4ePGiLqXgrSMmkfQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/5] API: Add VIR_DOMAIN_JOB_ERRMSG domain job statistics field Date: Thu, 16 Apr 2020 11:55:44 +0200 Message-Id: <6644d8cbb4e37fac2de9be36a780ed76e5220a87.1587030883.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake --- include/libvirt/libvirt-domain.h | 9 +++++++++ tools/virsh-domain.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index b440818ec2..f129e6a1af 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3612,6 +3612,15 @@ typedef enum { */ # 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 t= he diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d52eb7bc2f..f2dc41cb31 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6228,6 +6228,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) unsigned long long value; unsigned int flags =3D 0; int ivalue; + const char *svalue; int op; int rc; size_t i; @@ -6508,6 +6509,13 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"= ), val, unit); } + if ((rc =3D virTypedParamsGetString(params, nparams, VIR_DOMAIN_JOB_ER= RMSG, + &svalue)) < 0) { + goto save_error; + } else if (rc =3D=3D 1) { + vshPrint(ctl, "%-17s %s\n", _("Error message:"), svalue); + } + ret =3D true; cleanup: --=20 2.26.0