From nobody Fri Apr 26 09:44:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1574694125; cv=none; d=zohomail.com; s=zohoarc; b=DrDl1789k3AA8TC70DRvGT5rmg6VXUksAPGX/ZY3rL0JVBVCAtFHnvTUq1ope4mRPrCQd3TsXx33lYTUuis2QlEOHNFgofKIZmkBCgDsMHnJ9W0cY2/gc1wrlqWmfYlyPssAYzu3nZSZ1KxKx50FIhoJt1AqD5ph5vqZlCjixoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574694125; 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=7ZRGPC1K4Od2jY8pzjGrGz8YheXKRndQZC+ucvNhn/0=; b=djkYX5S2ycqj2rehtP9pydFeoY4rMtJE8Jx8TZDmN5gkWIrPabqx8QSPouOgEdzXbPO/BTrbZQEnko4yA2KXyi95OJuu/Jdjh5OEGzTIXdLyrxR0goUhJAa9noJPjRyDk/e2g+owPLuTkXSTp4gd4SaqjV+HWABmysY8kAaL0wo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1574694125074579.8250415501855; Mon, 25 Nov 2019 07:02:05 -0800 (PST) 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-62-5J_smLOdMS6nWBd0ZeX_-A-1; Mon, 25 Nov 2019 10:02:01 -0500 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 0EA488005A7; Mon, 25 Nov 2019 15:01:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE3D119C69; Mon, 25 Nov 2019 15:01:53 +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 79CCB41F03; Mon, 25 Nov 2019 15:01:53 +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 xAPF1ngd022044 for ; Mon, 25 Nov 2019 10:01:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id EC1535D6AE; Mon, 25 Nov 2019 15:01:49 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73E805D6A0 for ; Mon, 25 Nov 2019 15:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574694122; 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=7ZRGPC1K4Od2jY8pzjGrGz8YheXKRndQZC+ucvNhn/0=; b=Ir2G/MN3HsYLSMPI0y+HWnt2hR+wudiz7OGqIKE5zQfT6vgK8ToZJAAq7eUit3Ii4C50dE 8uecLTlpvpKCAlnxWxkqfdDG2cRojC9HCpkfzaS9Mc2ARfRSYUFe3TaXozMVr8UakuZaCP ZLJS1bzD0YY4RjTezWcIhubUsbwV9BM= From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 25 Nov 2019 16:01:34 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/9] virsh: domjobinfo: Add switch to print raw fields 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-MC-Unique: 5J_smLOdMS6nWBd0ZeX_-A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce --rawstats which prints all statistics fields from the new API similarly to how the virsh event handler prints them. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tools/virsh-domain.c | 24 +++++++++++++++++++++--- tools/virsh.pod | 6 +++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 81229fa5ca..325d748b49 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6033,6 +6033,10 @@ static const vshCmdOptDef opts_domjobinfo[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("print statistics for any kind of job (even failed ones)= ") }, + {.name =3D "rawstats", + .type =3D VSH_OT_BOOL, + .help =3D N_("print the raw data returned by libvirt") + }, {.name =3D NULL} }; @@ -6124,6 +6128,8 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) int ivalue; int op; int rc; + size_t i; + bool rawstats =3D vshCommandOptBool(cmd, "rawstats"); VSH_REQUIRE_OPTION("keep-completed", "completed"); @@ -6143,9 +6149,9 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) if (virshDomainJobStatsToDomainJobInfo(params, nparams, &info) < 0) goto cleanup; } else if (last_error->code =3D=3D VIR_ERR_NO_SUPPORT) { - if (flags) { - vshError(ctl, "%s", _("Optional flags are not supported by the= " - "daemon")); + if (flags !=3D 0 || rawstats) { + vshError(ctl, "%s", + _("Optional flags or --rawstats are not supported by = the daemon")); goto cleanup; } vshDebug(ctl, VSH_ERR_DEBUG, "detailed statistics not supported\n"= ); @@ -6155,6 +6161,18 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) if (rc < 0) goto cleanup; + if (rawstats) { + vshPrint(ctl, "Job type: %d\n\n", info.type); + + for (i =3D 0; i < nparams; i++) { + g_autofree char *par =3D virTypedParameterToString(¶ms[i]); + vshPrint(ctl, "%s: %s\n", params[i].field, NULLSTR(par)); + } + + ret =3D true; + goto cleanup; + } + vshPrint(ctl, "%-17s %-12s\n", _("Job type:"), virshDomainJobToString(info.type)); diff --git a/tools/virsh.pod b/tools/virsh.pod index e5428976a0..951cb738a0 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1381,7 +1381,7 @@ Returns basic information about the domain. Abort the currently running domain job. =3Ditem B I [I<--completed>] [I<--keep-completed>] -[I<--anystats>] +[I<--anystats>] [I<--rawstats>] Returns information about jobs running on a domain. I<--completed> tells virsh to return information about a recently finished job. Statistics of @@ -1391,6 +1391,10 @@ I<--keep-completed> is used) or when libvirtd is res= tarted. Normally only statistics for running and successful completed jobs are pri= nted. I<--anystats> can be used to display statistics also for failed jobs. +In case I<--rawstats> is used, all fields are printed as received from the +server without any attempts to interpred the data. The "Job type:" field is +special, since it's reported by the API and not part of stats. + Note that time information returned for completed migrations may be completely irrelevant unless both source and destination hosts have synchronized time (i.e., NTP daemon is running --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list