From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789417793329.73072404973607; Tue, 8 May 2018 07:23:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1D9A82100; Tue, 8 May 2018 14:23:35 +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 AD3E0201588E; Tue, 8 May 2018 14:23:35 +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 5D1DE180BADB; Tue, 8 May 2018 14:23:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENTCY003898 for ; Tue, 8 May 2018 10:23:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id CDDF428DC6; Tue, 8 May 2018 14:23:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0C7016E24; Tue, 8 May 2018 14:23:29 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48822C073D51; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:22:55 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:29 +0800 Message-Id: <20180508142040.18593-2-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 01/12] virsh: Move the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 08 May 2018 14:23:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" centralize the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h to avoid unnecessary duplicated definition Signed-off-by: Lin Ma --- tools/virsh-domain-monitor.c | 3 --- tools/virsh-domain.c | 3 --- tools/virsh-snapshot.c | 3 --- tools/virsh.h | 3 +++ 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 8e071779b4..071619d0e3 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -40,9 +40,6 @@ #include "virxml.h" #include "virstring.h" =20 -#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \ - VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags) - VIR_ENUM_DECL(virshDomainIOError) VIR_ENUM_IMPL(virshDomainIOError, VIR_DOMAIN_DISK_ERROR_LAST, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 598d2fa4a4..aa11a81638 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -65,9 +65,6 @@ # define SA_SIGINFO 0 #endif =20 -#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \ - VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags) - #define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \ {.name =3D "persistent", \ .type =3D VSH_OT_BOOL, \ diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index e4908eea70..812fa91333 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -42,9 +42,6 @@ #include "virxml.h" #include "conf/snapshot_conf.h" =20 -#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \ - VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags) - /* Helper for snapshot-create and snapshot-create-as */ static bool virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer, diff --git a/tools/virsh.h b/tools/virsh.h index f2213ebb57..9e717ef574 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -82,6 +82,9 @@ .completer_flags =3D cflags, \ } =20 +#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \ + VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags) + # define VIRSH_COMMON_OPT_CONFIG(_helpstr) \ {.name =3D "config", \ .type =3D VSH_OT_BOOL, \ --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789409589316.96503060501425; Tue, 8 May 2018 07:23:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 423493133E70; Tue, 8 May 2018 14:23:28 +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 068DF30B4988; Tue, 8 May 2018 14:23:28 +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 8375C5BBE7; Tue, 8 May 2018 14:23:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENO1E003837 for ; Tue, 8 May 2018 10:23:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id A092E30BAAC3; Tue, 8 May 2018 14:23:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9485F30BAAC1; Tue, 8 May 2018 14:23:24 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4DA36356E3; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:22:57 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:30 +0800 Message-Id: <20180508142040.18593-3-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 02/12] virsh: Add domain name completion to 'migrate-postcopy' command 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 08 May 2018 14:23:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-domain.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index aa11a81638..ace5c02871 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11213,11 +11213,7 @@ static const vshCmdInfo info_migrate_postcopy[] = =3D { }; =20 static const vshCmdOptDef opts_migrate_postcopy[] =3D { - {.name =3D "domain", - .type =3D VSH_OT_DATA, - .flags =3D VSH_OFLAG_REQ, - .help =3D N_("domain name, id or uuid") - }, + VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D NULL} }; =20 --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789422382633.9397643455283; Tue, 8 May 2018 07:23:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5C24C0C275F; Tue, 8 May 2018 14:23:40 +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 9F1382015884; Tue, 8 May 2018 14:23:40 +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 55E7E180BADB; Tue, 8 May 2018 14:23:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENQ9U003855 for ; Tue, 8 May 2018 10:23:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id F350472307; Tue, 8 May 2018 14:23:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA61C69F03; Tue, 8 May 2018 14:23:24 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5260C30BA34C; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:22:59 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:31 +0800 Message-Id: <20180508142040.18593-4-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 03/12] virsh: Conditionally Ignore the first entry in list of completions 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 08 May 2018 14:23:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The first entry in the returned array is the substitution for TEXT. It causes unnecessary output if other commands or options share the same prefix, e.g. $ virsh des des desc destroy or $ virsh domblklist --d --d --details --domain This patch fixes the above issue. Signed-off-by: Lin Ma --- tools/vsh.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index 73ec007e56..57f7589b53 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3458,6 +3458,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) const vshCmdOpt *opt =3D NULL; char **matches =3D NULL, **iter; virBuffer buf =3D VIR_BUFFER_INITIALIZER; + int n; =20 if (vshCommandOptStringQuiet(ctl, cmd, "string", &arg) <=3D 0) goto cleanup; @@ -3493,8 +3494,11 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) if (!(matches =3D vshReadlineCompletion(arg, 0, 0))) goto cleanup; =20 - for (iter =3D matches; *iter; iter++) + for (n =3D 0, iter =3D matches; *iter; iter++, n++) { + if (n =3D=3D 0 && matches[1]) + continue; printf("%s\n", *iter); + } =20 ret =3D true; cleanup: --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789417850723.254980611835; Tue, 8 May 2018 07:23:37 -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 296193004864; Tue, 8 May 2018 14:23:36 +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 E1395608F0; Tue, 8 May 2018 14:23:35 +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 8E343180BAE5; Tue, 8 May 2018 14:23:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENP6P003847 for ; Tue, 8 May 2018 10:23:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9401130BAAC3; Tue, 8 May 2018 14:23:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AFEA30BAAC0; Tue, 8 May 2018 14:23:25 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5924E4E4CA; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:00 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:32 +0800 Message-Id: <20180508142040.18593-5-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 04/12] virsh: Create macros for VSH_OT_STRING "domain" option 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.40]); Tue, 08 May 2018 14:23:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/virsh.h b/tools/virsh.h index 9e717ef574..b1b641bc41 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -110,6 +110,17 @@ .help =3D _helpstr \ } =20 +# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, cflags) \ + {.name =3D "domain", \ + .type =3D VSH_OT_STRING, \ + .help =3D _helpstr, \ + .completer =3D virshDomainNameCompleter, \ + .completer_flags =3D cflags, \ + } + +#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \ + VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflag= s) + typedef struct _virshControl virshControl; typedef virshControl *virshControlPtr; =20 --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789418095236.50827085934804; Tue, 8 May 2018 07:23:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A63DC034DC8; Tue, 8 May 2018 14:23:36 +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 E8D7630BAAC0; Tue, 8 May 2018 14:23:35 +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 90B0D5BBE4; Tue, 8 May 2018 14:23:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENQ3s003863 for ; Tue, 8 May 2018 10:23:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 508E8601A2; Tue, 8 May 2018 14:23:26 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 44B1B600D2; Tue, 8 May 2018 14:23:25 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6122C30BA34E; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:02 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:33 +0800 Message-Id: <20180508142040.18593-6-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 05/12] virsh: Apply macro for current VSH_OT_STRING "domain" options 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 08 May 2018 14:23:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These VSH_OT_STRING "domain" options support domain name completion now. Signed-off-by: Lin Ma --- tools/virsh-domain.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ace5c02871..30da953446 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9592,10 +9592,8 @@ static const vshCmdInfo info_qemu_monitor_event[] = =3D { }; =20 static const vshCmdOptDef opts_qemu_monitor_event[] =3D { - {.name =3D "domain", - .type =3D VSH_OT_STRING, - .help =3D N_("filter by domain name, id or uuid") - }, + VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), + 0), {.name =3D "event", .type =3D VSH_OT_STRING, .help =3D N_("filter by event name") @@ -10148,11 +10146,7 @@ static const vshCmdOptDef opts_domxmltonative[] = =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("target config data type format") }, - {.name =3D "domain", - .type =3D VSH_OT_STRING, - .flags =3D VSH_OFLAG_REQ_OPT, - .help =3D N_("domain name, id or uuid") - }, + VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(0), {.name =3D "xml", .type =3D VSH_OT_STRING, .help =3D N_("xml data file to export from") @@ -13339,10 +13333,8 @@ static const vshCmdInfo info_event[] =3D { }; =20 static const vshCmdOptDef opts_event[] =3D { - {.name =3D "domain", - .type =3D VSH_OT_STRING, - .help =3D N_("filter by domain name, id, or uuid") - }, + VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), + 0), {.name =3D "event", .type =3D VSH_OT_STRING, .help =3D N_("which event type to wait for") --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789428205763.3390437781014; Tue, 8 May 2018 07:23:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D597830B96E8; Tue, 8 May 2018 14:23:46 +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 A53592015884; Tue, 8 May 2018 14:23:46 +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 5119A5BBE5; Tue, 8 May 2018 14:23:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENS7l003881 for ; Tue, 8 May 2018 10:23:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C594100195F; Tue, 8 May 2018 14:23:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5460C100195A; Tue, 8 May 2018 14:23:25 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F907883A5; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:04 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:34 +0800 Message-Id: <20180508142040.18593-7-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 06/12] vshReadlineParse: Ignore vshReadlineOptionsGenerator for VSH_OT_ARGV options 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 14:23:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Currently the VSH_OT_ARGV options don't support complete, But some of VSH_OT_ARGV options are gonna support complete in upcoming patches. Once applied the upcoming completion patches for VSH_OT_ARGV options, If we don't ignore VSH_OT_ARGV here, The vshReadlineOptionsGenerator will be called, Hence complete output will consist of the result by command completer + the result by option completer, It's confusing. e.g. $ virsh domstats --domain --backing --interface --list-paused --perf --vcpu --balloon leap42.3 --list-persistent --raw win10 --block --list-active --list-running sles12sp3 --cpu-total --list-inactive --list-shutoff sles15 --enforce --list-other --list-transient --state After this patch and the upcoming completion patches: $ virsh domstats --domain leap42.3 sles12sp3 sles15 win10 Signed-off-by: Lin Ma --- tools/vsh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index 57f7589b53..e45bb0d825 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2824,7 +2824,9 @@ vshReadlineParse(const char *text, int state) if (!cmd) { list =3D vshReadlineCommandGenerator(text); } else { - if (!opt || (opt->type !=3D VSH_OT_DATA && opt->type !=3D VSH_= OT_STRING)) + if (!opt || (opt->type !=3D VSH_OT_DATA && + opt->type !=3D VSH_OT_STRING && + opt->type !=3D VSH_OT_ARGV)) list =3D vshReadlineOptionsGenerator(text, cmd, partial); =20 if (opt && opt->completer) { --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789409756951.7790377739067; Tue, 8 May 2018 07:23:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AF0E3004400; Tue, 8 May 2018 14:23:28 +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 CBCA5171E8; Tue, 8 May 2018 14:23:27 +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 1BAE0180BADB; Tue, 8 May 2018 14:23:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENOwP003832 for ; Tue, 8 May 2018 10:23:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8AA4930BAAC2; Tue, 8 May 2018 14:23:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80F0830BAAC1; Tue, 8 May 2018 14:23:24 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E876C03D462; Tue, 8 May 2018 14:23:08 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:05 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:35 +0800 Message-Id: <20180508142040.18593-8-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 08 May 2018 14:23:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 08 May 2018 14:23:23 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 07/12] virsh: Create macros for VSH_OT_ARGV "domain" option 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 14:23:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/virsh.h b/tools/virsh.h index b1b641bc41..4353ff46d4 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -121,6 +121,18 @@ #define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \ VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflag= s) =20 +# define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \ + {.name =3D "domain", \ + .type =3D VSH_OT_ARGV, \ + .flags =3D VSH_OFLAG_NONE, \ + .help =3D _helpstr, \ + .completer =3D virshDomainNameCompleter, \ + .completer_flags =3D cflags, \ + } + +#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \ + VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags) + typedef struct _virshControl virshControl; typedef virshControl *virshControlPtr; =20 --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789423546860.9135790968974; Tue, 8 May 2018 07:23:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFB048046C; Tue, 8 May 2018 14:23:41 +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 8BD317652E; Tue, 8 May 2018 14:23:41 +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 431385BBEB; Tue, 8 May 2018 14:23:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENdXp003923 for ; Tue, 8 May 2018 10:23:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6F7732015896; Tue, 8 May 2018 14:23:39 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 44B3C20158AE; Tue, 8 May 2018 14:23:39 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C003883B8; Tue, 8 May 2018 14:23:23 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:07 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:36 +0800 Message-Id: <20180508142040.18593-9-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 08 May 2018 14:23:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 08 May 2018 14:23:38 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 08/12] virsh: Apply macro for current VSH_OT_ARGV "domain" options 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 08 May 2018 14:23:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-domain-monitor.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 071619d0e3..fa93f3a312 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1991,11 +1991,7 @@ static const vshCmdOptDef opts_domstats[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("add backing chain information to block stats"), }, - {.name =3D "domain", - .type =3D VSH_OT_ARGV, - .flags =3D VSH_OFLAG_NONE, - .help =3D N_("list of domains to get stats for"), - }, + VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("list of domains to get stats for")= , 0), {.name =3D NULL} }; =20 --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789424487993.7799443347928; Tue, 8 May 2018 07:23:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBC49804F5; Tue, 8 May 2018 14:23:42 +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 88B5D30BAAC2; Tue, 8 May 2018 14:23:42 +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 39299180BADC; Tue, 8 May 2018 14:23:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENd0U003914 for ; Tue, 8 May 2018 10:23:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 587AD100195A; Tue, 8 May 2018 14:23:39 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50EE81001F3B; Tue, 8 May 2018 14:23:39 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C596356EA; Tue, 8 May 2018 14:23:23 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:09 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:37 +0800 Message-Id: <20180508142040.18593-10-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 08 May 2018 14:23:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 08 May 2018 14:23:38 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 09/12] vshReadlineOptionsGenerator: Add already provided VSH_OT_ARGV options to list 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 08 May 2018 14:23:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It's helpful for users while they type certain kind of VSH_OT_ARGV options. e.g. $ virsh domstats --domain sles12sp3 --d Signed-off-by: Lin Ma --- tools/vsh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/vsh.c b/tools/vsh.c index e45bb0d825..279d1b56e6 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2685,7 +2685,7 @@ vshReadlineOptionsGenerator(const char *text, } =20 while (opt) { - if (STREQ(opt->def->name, name)) { + if (STREQ(opt->def->name, name) && opt->def->type !=3D VSH_OT_= ARGV) { exists =3D true; break; } --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789433480220.2439895486591; Tue, 8 May 2018 07:23:53 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id BDFF4C04BD28; Tue, 8 May 2018 14:23:51 +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 8255116E24; Tue, 8 May 2018 14:23:51 +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 34B1E180BAE9; Tue, 8 May 2018 14:23:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENfY6003935 for ; Tue, 8 May 2018 10:23:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 235C96012A; Tue, 8 May 2018 14:23:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14D8E600D2; Tue, 8 May 2018 14:23:40 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FD7480468; Tue, 8 May 2018 14:23:23 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:10 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:38 +0800 Message-Id: <20180508142040.18593-11-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 08 May 2018 14:23:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 08 May 2018 14:23:38 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 10/12] virsh: Enable multiple --event flags to 'event' command 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 08 May 2018 14:23:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-domain.c | 107 +++++++++++++++++++++++++++--------------------= ---- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 30da953446..36278ebc1c 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13335,10 +13335,6 @@ static const vshCmdInfo info_event[] =3D { static const vshCmdOptDef opts_event[] =3D { VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), 0), - {.name =3D "event", - .type =3D VSH_OT_STRING, - .help =3D N_("which event type to wait for") - }, {.name =3D "all", .type =3D VSH_OT_BOOL, .help =3D N_("wait for all events instead of just one type") @@ -13359,6 +13355,10 @@ static const vshCmdOptDef opts_event[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("show timestamp for each printed event") }, + {.name =3D "event", + .type =3D VSH_OT_ARGV, + .help =3D N_("which event type to wait for") + }, {.name =3D NULL} }; =20 @@ -13368,58 +13368,64 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd) virDomainPtr dom =3D NULL; bool ret =3D false; int timeout =3D 0; - virshDomEventData *data =3D NULL; + virshDomEventData *dataList =3D NULL; size_t i; - const char *eventName =3D NULL; - int event =3D -1; + int *eventIdxList =3D NULL; + size_t nevents =3D 0; + int eventid =3D -1; bool all =3D vshCommandOptBool(cmd, "all"); bool loop =3D vshCommandOptBool(cmd, "loop"); bool timestamp =3D vshCommandOptBool(cmd, "timestamp"); + bool event =3D vshCommandOptBool(cmd, "event"); int count =3D 0; + const vshCmdOpt *opt =3D NULL; virshControlPtr priv =3D ctl->privData; =20 if (vshCommandOptBool(cmd, "list")) { - for (event =3D 0; event < VIR_DOMAIN_EVENT_ID_LAST; event++) - vshPrint(ctl, "%s\n", vshEventCallbacks[event].name); + for (eventid =3D 0; eventid < VIR_DOMAIN_EVENT_ID_LAST; eventid++) + vshPrint(ctl, "%s\n", vshEventCallbacks[eventid].name); return true; } =20 - if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) - return false; - if (eventName) { - for (event =3D 0; event < VIR_DOMAIN_EVENT_ID_LAST; event++) - if (STREQ(eventName, vshEventCallbacks[event].name)) - break; - if (event =3D=3D VIR_DOMAIN_EVENT_ID_LAST) { - vshError(ctl, _("unknown event type %s"), eventName); - return false; + if (event) { + while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) { + if (opt->data) { + for (eventid =3D 0; eventid < VIR_DOMAIN_EVENT_ID_LAST; ev= entid++) + if (STREQ(opt->data, vshEventCallbacks[eventid].name)) + break; + if (eventid =3D=3D VIR_DOMAIN_EVENT_ID_LAST) { + vshError(ctl, _("unknown event type %s"), opt->data); + goto cleanup; + } + size_t n =3D nevents; + virshDomEventData data; + data.ctl =3D ctl; + data.loop =3D loop; + data.count =3D &count; + data.timestamp =3D timestamp; + data.cb =3D &vshEventCallbacks[eventid]; + data.id =3D -1; + if (VIR_APPEND_ELEMENT(dataList, nevents, data) < 0) + goto cleanup; + if (VIR_APPEND_ELEMENT(eventIdxList, n, eventid) < 0) + goto cleanup; + } } - } else if (!all) { - vshError(ctl, "%s", - _("one of --list, --all, or --event is required")); - return false; - } - - if (all) { - if (VIR_ALLOC_N(data, VIR_DOMAIN_EVENT_ID_LAST) < 0) + } else if (all) { + if (VIR_ALLOC_N(dataList, VIR_DOMAIN_EVENT_ID_LAST) < 0) goto cleanup; for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) { - data[i].ctl =3D ctl; - data[i].loop =3D loop; - data[i].count =3D &count; - data[i].timestamp =3D timestamp; - data[i].cb =3D &vshEventCallbacks[i]; - data[i].id =3D -1; + dataList[i].ctl =3D ctl; + dataList[i].loop =3D loop; + dataList[i].count =3D &count; + dataList[i].timestamp =3D timestamp; + dataList[i].cb =3D &vshEventCallbacks[i]; + dataList[i].id =3D -1; } } else { - if (VIR_ALLOC_N(data, 1) < 0) - goto cleanup; - data[0].ctl =3D ctl; - data[0].loop =3D vshCommandOptBool(cmd, "loop"); - data[0].count =3D &count; - data[0].timestamp =3D timestamp; - data[0].cb =3D &vshEventCallbacks[event]; - data[0].id =3D -1; + vshError(ctl, "%s", + _("one of --list, --all, or --event is required")); + return false; } if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0) goto cleanup; @@ -13431,11 +13437,11 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd) if (vshEventStart(ctl, timeout) < 0) goto cleanup; =20 - for (i =3D 0; i < (all ? VIR_DOMAIN_EVENT_ID_LAST : 1); i++) { - if ((data[i].id =3D virConnectDomainEventRegisterAny(priv->conn, d= om, - all ? i : event, - data[i].cb->cb, - &data[i], + for (i =3D 0; i < (event ? nevents : VIR_DOMAIN_EVENT_ID_LAST); i++) { + if ((dataList[i].id =3D virConnectDomainEventRegisterAny(priv->con= n, dom, + event ? eventId= xList[i] : i, + dataList[i].cb-= >cb, + &dataList[i], NULL)) < 0) { /* When registering for all events: if the first * registration succeeds, silently ignore failures on all @@ -13465,14 +13471,15 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd) =20 cleanup: vshEventCleanup(ctl); - if (data) { - for (i =3D 0; i < (all ? VIR_DOMAIN_EVENT_ID_LAST : 1); i++) { - if (data[i].id >=3D 0 && - virConnectDomainEventDeregisterAny(priv->conn, data[i].id)= < 0) + if (dataList) { + for (i =3D 0; i < (event ? nevents : VIR_DOMAIN_EVENT_ID_LAST); i+= +) { + if (dataList[i].id >=3D 0 && + virConnectDomainEventDeregisterAny(priv->conn, dataList[i]= .id) < 0) ret =3D false; } - VIR_FREE(data); + VIR_FREE(dataList); } + VIR_FREE(eventIdxList); virshDomainFree(dom); return ret; } --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789438184156.3100864124416; Tue, 8 May 2018 07:23:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE27D81240; Tue, 8 May 2018 14:23:56 +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 826C05FCB2; Tue, 8 May 2018 14:23:56 +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 2C7DD5BBEC; Tue, 8 May 2018 14:23:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENhkv003955 for ; Tue, 8 May 2018 10:23:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7BEF89EDF3; Tue, 8 May 2018 14:23:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DB3B9ACC8; Tue, 8 May 2018 14:23:40 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55D3530023EC; Tue, 8 May 2018 14:23:23 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:12 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:39 +0800 Message-Id: <20180508142040.18593-12-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 08 May 2018 14:23:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 08 May 2018 14:23:38 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 11/12] virsh: add helper for returning event name string 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 08 May 2018 14:23:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-util.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh-util.h | 3 +++ 2 files changed, 63 insertions(+) diff --git a/tools/virsh-util.c b/tools/virsh-util.c index 44be3ad64b..686f9aef98 100644 --- a/tools/virsh-util.c +++ b/tools/virsh-util.c @@ -285,3 +285,63 @@ virshDomainGetXML(vshControl *ctl, =20 return ret; } + + +const char * +virshDomainEventGetName(int event) +{ + switch ((int)event) { + case VIR_DOMAIN_EVENT_ID_LIFECYCLE: + return "lifecycle"; + case VIR_DOMAIN_EVENT_ID_REBOOT: + return "reboot"; + case VIR_DOMAIN_EVENT_ID_RTC_CHANGE: + return "rtc-change"; + case VIR_DOMAIN_EVENT_ID_WATCHDOG: + return "watchdog"; + case VIR_DOMAIN_EVENT_ID_IO_ERROR: + return "io-error"; + case VIR_DOMAIN_EVENT_ID_GRAPHICS: + return "graphics"; + case VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON: + return "io-error-reason"; + case VIR_DOMAIN_EVENT_ID_CONTROL_ERROR: + return "control-error"; + case VIR_DOMAIN_EVENT_ID_BLOCK_JOB: + return "block-job"; + case VIR_DOMAIN_EVENT_ID_DISK_CHANGE: + return "disk-change"; + case VIR_DOMAIN_EVENT_ID_TRAY_CHANGE: + return "tray-change"; + case VIR_DOMAIN_EVENT_ID_PMWAKEUP: + return "pm-wakeup"; + case VIR_DOMAIN_EVENT_ID_PMSUSPEND: + return "pm-suspend"; + case VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE: + return "balloon-change"; + case VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK: + return "pm-suspend-disk"; + case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED: + return "device-removed"; + case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2: + return "block-job-2"; + case VIR_DOMAIN_EVENT_ID_TUNABLE: + return "tunable"; + case VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE: + return "agent-lifecycle"; + case VIR_DOMAIN_EVENT_ID_DEVICE_ADDED: + return "device-added"; + case VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION: + return "migration-iteration"; + case VIR_DOMAIN_EVENT_ID_JOB_COMPLETED: + return "job-completed"; + case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED: + return "device-removal-failed"; + case VIR_DOMAIN_EVENT_ID_METADATA_CHANGE: + return "metadata-change"; + case VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD: + return "block-threshold"; + default: + return NULL; + } +} diff --git a/tools/virsh-util.h b/tools/virsh-util.h index 9a0af3513d..02c4ace6bf 100644 --- a/tools/virsh-util.h +++ b/tools/virsh-util.h @@ -104,4 +104,7 @@ virshDomainGetXML(vshControl *ctl, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK; =20 +const char * +virshDomainEventGetName(int event); + #endif /* VIRSH_UTIL_H */ --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 06:26:26 2024 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.zohomail.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 1525789428168733.9329273693966; Tue, 8 May 2018 07:23:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C57D581239; Tue, 8 May 2018 14:23:46 +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 963B930B498F; Tue, 8 May 2018 14:23:46 +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 47CAC180BAE8; Tue, 8 May 2018 14:23:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48ENhYk003950 for ; Tue, 8 May 2018 10:23:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 30211608F4; Tue, 8 May 2018 14:23:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67DB0611A7; Tue, 8 May 2018 14:23:39 +0000 (UTC) Received: from prv3-mh.provo.novell.com (prv3-mh.provo.novell.com [137.65.250.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FA1B804EE; Tue, 8 May 2018 14:23:23 +0000 (UTC) Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 08 May 2018 08:23:14 -0600 From: Lin Ma To: libvir-list@redhat.com Date: Tue, 8 May 2018 22:20:40 +0800 Message-Id: <20180508142040.18593-13-lma@suse.com> In-Reply-To: <20180508142040.18593-1-lma@suse.com> References: <20180508142040.18593-1-lma@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 08 May 2018 14:23:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 08 May 2018 14:23:39 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'prv3-mh.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'lma@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 prv3-mh.provo.novell.com 137.65.250.26 prv3-mh.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com Subject: [libvirt] [PATCH v2 12/12] virsh: Add event name completion to 'event' command 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 08 May 2018 14:23:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-completer.c | 37 +++++++++++++++++++++++++++++++++++++ tools/virsh-completer.h | 3 +++ tools/virsh-domain.c | 1 + 3 files changed, 41 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index e3b8234b41..ddf7b17caf 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -522,3 +522,40 @@ virshSnapshotNameCompleter(vshControl *ctl, virshDomainFree(dom); return NULL; } + + +char ** +virshEventNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (VIR_ALLOC_N(ret, VIR_DOMAIN_EVENT_ID_LAST + 1) < 0) + goto error; + + for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) { + const char *name =3D virshDomainEventGetName(i); + + if (name =3D=3D NULL) + goto error; + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + } + + return ret; + + error: + for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index fa443d3ad7..27d78dc7ac 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -69,5 +69,8 @@ char ** virshSecretUUIDCompleter(vshControl *ctl, char ** virshSnapshotNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); +char ** virshEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); =20 #endif diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 36278ebc1c..0d58c0ff1a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13357,6 +13357,7 @@ static const vshCmdOptDef opts_event[] =3D { }, {.name =3D "event", .type =3D VSH_OT_ARGV, + .completer =3D virshEventNameCompleter, .help =3D N_("which event type to wait for") }, {.name =3D NULL} --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list