From nobody Sun Feb 8 21:41:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 149322161047112.925251992089215; Wed, 26 Apr 2017 08:46:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C69AD70722; Wed, 26 Apr 2017 15:46:48 +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 99CEB933EF; Wed, 26 Apr 2017 15:46:48 +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 12F5B18523D5; Wed, 26 Apr 2017 15:46:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3QFkXa7023511 for ; Wed, 26 Apr 2017 11:46:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6C68845B7; Wed, 26 Apr 2017 15:46:33 +0000 (UTC) Received: from mamuti.net (ovpn-204-68.brq.redhat.com [10.40.204.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92E10841EA for ; Wed, 26 Apr 2017 15:46:27 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 21882100278; Wed, 26 Apr 2017 17:46:27 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C69AD70722 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C69AD70722 From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 26 Apr 2017 17:46:19 +0200 Message-Id: <6c6d025835f9b8ae488cc618712ab8b430c23b7a.1493220416.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] Add VIR_DOMAIN_JOB_OPERATION typed parameter 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 26 Apr 2017 15:46:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The parameter is reported by virDomainGetJobStats API and VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event and it can be used to identify the operation (migration, snapshot, ...) to which the reported statistics belong. https://bugzilla.redhat.com/show_bug.cgi?id=3D1441563 Signed-off-by: Jiri Denemark --- include/libvirt/libvirt-domain.h | 25 +++++++++++++++++++++++++ tools/virsh-domain.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 501996bc8..c9e96a6c9 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -3117,6 +3117,31 @@ int virDomainGetJobStats(virDomainPtr domain, unsigned int flags); int virDomainAbortJob(virDomainPtr dom); =20 +typedef enum { + VIR_DOMAIN_JOB_OPERATION_UNKNOWN =3D 0, + VIR_DOMAIN_JOB_OPERATION_START =3D 1, + VIR_DOMAIN_JOB_OPERATION_SAVE =3D 2, + VIR_DOMAIN_JOB_OPERATION_RESTORE =3D 3, + VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN =3D 4, + VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT =3D 5, + VIR_DOMAIN_JOB_OPERATION_SNAPSHOT =3D 6, + VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT =3D 7, + VIR_DOMAIN_JOB_OPERATION_DUMP =3D 8, + +# ifdef VIR_ENUM_SENTINELS + VIR_DOMAIN_JOB_OPERATION_LAST +# endif +} virDomainJobOperation; + +/** + * VIR_DOMAIN_JOB_OPERATION: + * + * virDomainGetJobStats field: the operation which started the job as + * VIR_TYPED_PARAM_INT. The values correspond to the items in + * virDomainJobOperation enum. + */ +# define VIR_DOMAIN_JOB_OPERATION "operation" + /** * VIR_DOMAIN_JOB_TIME_ELAPSED: * diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index db8accfe4..0d19d0e01 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5658,6 +5658,26 @@ virshDomainJobToString(int type) return str ? _(str) : _("unknown"); } =20 +VIR_ENUM_DECL(virshDomainJobOperation); +VIR_ENUM_IMPL(virshDomainJobOperation, + VIR_DOMAIN_JOB_OPERATION_LAST, + N_("Unknown"), + N_("Start"), + N_("Save"), + N_("Restore"), + N_("Incoming migration"), + N_("Outgoing migration"), + N_("Snapshot"), + N_("Snapshot revert"), + N_("Dump")) + +static const char * +virshDomainJobOperationToString(int op) +{ + const char *str =3D virshDomainJobOperationTypeToString(op); + return str ? _(str) : _("unknown"); +} + static bool cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) { @@ -5671,6 +5691,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) unsigned long long value; unsigned int flags =3D 0; int ivalue; + int op; int rc; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) @@ -5740,6 +5761,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) goto cleanup; } =20 + op =3D VIR_DOMAIN_JOB_OPERATION_UNKNOWN; + if ((rc =3D virTypedParamsGetInt(params, nparams, + VIR_DOMAIN_JOB_OPERATION, &op)) < 0) + goto save_error; + + vshPrint(ctl, "%-17s %-12s\n", _("Operation:"), + virshDomainJobOperationToString(op)); + vshPrint(ctl, "%-17s %-12llu ms\n", _("Time elapsed:"), info.timeElaps= ed); if ((rc =3D virTypedParamsGetULLong(params, nparams, VIR_DOMAIN_JOB_TIME_ELAPSED_NET, --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list