From nobody Mon Apr 29 14:41:16 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 151689016020278.76730040094799; Thu, 25 Jan 2018 06:22:40 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4659F20CE7; Thu, 25 Jan 2018 14:22:37 +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 EE4A160635; Thu, 25 Jan 2018 14:22:36 +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 AD82F18033D9; Thu, 25 Jan 2018 14:22:36 +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 w0PEMQR5029189 for ; Thu, 25 Jan 2018 09:22:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 62A956017B; Thu, 25 Jan 2018 14:22:26 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDF8C600CC for ; Thu, 25 Jan 2018 14:22:25 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 25 Jan 2018 15:22:18 +0100 Message-Id: <11a7aba35493f9518f37f78632737888e091a0b9.1516889966.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] virshDomainNameCompleter: Prune accepted flags 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 25 Jan 2018 14:22:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Only a small subset of VIR_CONNECT_LIST_DOMAINS_* flags are actually used in virsh code. Remove the unused ones. Signed-off-by: Michal Privoznik --- tools/virsh-completer.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index e216d9076..e3b8234b4 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -45,18 +45,11 @@ virshDomainNameCompleter(vshControl *ctl, =20 virCheckFlags(VIR_CONNECT_LIST_DOMAINS_ACTIVE | VIR_CONNECT_LIST_DOMAINS_INACTIVE | + VIR_CONNECT_LIST_DOMAINS_OTHER | + VIR_CONNECT_LIST_DOMAINS_PAUSED | VIR_CONNECT_LIST_DOMAINS_PERSISTENT | - VIR_CONNECT_LIST_DOMAINS_TRANSIENT | VIR_CONNECT_LIST_DOMAINS_RUNNING | - VIR_CONNECT_LIST_DOMAINS_PAUSED | - VIR_CONNECT_LIST_DOMAINS_SHUTOFF | - VIR_CONNECT_LIST_DOMAINS_OTHER | - VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE | - VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE | - VIR_CONNECT_LIST_DOMAINS_AUTOSTART | - VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART | - VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT | - VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT, + VIR_CONNECT_LIST_DOMAINS_SHUTOFF, NULL); =20 if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:41:16 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 1516890150813731.9437141993834; Thu, 25 Jan 2018 06:22:30 -0800 (PST) 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 BD45480F99; Thu, 25 Jan 2018 14:22: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 75DC217A71; Thu, 25 Jan 2018 14:22: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 2DB5E4ED34; Thu, 25 Jan 2018 14:22:28 +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 w0PEMRmR029198 for ; Thu, 25 Jan 2018 09:22:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F69D12A41; Thu, 25 Jan 2018 14:22:27 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id C754360471 for ; Thu, 25 Jan 2018 14:22:26 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 25 Jan 2018 15:22:19 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] virsh: Offer only persistent domains for autostart 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.27]); Thu, 25 Jan 2018 14:22:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The 'autostart' command accepts only persistent domains. Make the completer return only those. Signed-off-by: Michal Privoznik --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0f329d6d7..5a0e0c1b2 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1037,7 +1037,7 @@ static const vshCmdInfo info_autostart[] =3D { }; =20 static const vshCmdOptDef opts_autostart[] =3D { - VIRSH_COMMON_OPT_DOMAIN_FULL(0), + VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_PERSISTENT), {.name =3D "disable", .type =3D VSH_OT_BOOL, .help =3D N_("disable autostarting") --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:41:16 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 1516890163077220.01854185472598; Thu, 25 Jan 2018 06:22:43 -0800 (PST) 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 20CEEDB923; Thu, 25 Jan 2018 14:22: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 CE9A760C4D; Thu, 25 Jan 2018 14:22: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 6EF8C18033DD; Thu, 25 Jan 2018 14:22:41 +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 w0PEMSko029208 for ; Thu, 25 Jan 2018 09:22:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1F6AE60471; Thu, 25 Jan 2018 14:22:28 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A3D3605D8 for ; Thu, 25 Jan 2018 14:22:27 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 25 Jan 2018 15:22:20 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] tools: Make symlinks to vsh bash-completion script 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.38]); Thu, 25 Jan 2018 14:22:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The bash-completion project documents that only those scripts from $BASH_COMPLETIONS_DIR that share name with the current command for which was hit are loaded [1]. This means, that vsh script we have there is not loaded. We have to create symlinks for virsh and virt-admin. At the same time, we have to create new RPM package because virt-admin and client packages are independent. That means we cannot place the vsh script in either of them. What we can do is to have a different package that contains the completion script and then virt-admin and client packages contain only the symlink and require the bash-completion package. 1: https://github.com/scop/bash-completion#faq Signed-off-by: Michal Privoznik --- libvirt.spec.in | 24 +++++++++++++++++++++++- tools/Makefile.am | 7 ++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index f62d7d324..1879e1f8b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1017,6 +1017,9 @@ Requires: gnutls-utils # Needed for probing the power management features of the host. Requires: pm-utils %endif +%if %{with_bash_completion} +Requires: %{name}-bash-completion =3D %{version}-%{release} +%endif =20 %description client The client binaries needed to access the virtualization @@ -1041,10 +1044,22 @@ Summary: Set of tools to control libvirt daemon Group: Development/Libraries Requires: %{name}-libs =3D %{version}-%{release} Requires: readline +%if %{with_bash_completion} +Requires: %{name}-bash-completion =3D %{version}-%{release} +%endif =20 %description admin The client side utilities to control the libvirt daemon. =20 +%if %{with_bash_completion} +%package bash-completion +Summary: Bash completion script +Group: Development/Libraries + +%description bash-completion +Bash completion script stub. +%endif + %if %{with_wireshark} %package wireshark Summary: Wireshark dissector plugin for libvirt RPC transactions @@ -2059,7 +2074,7 @@ exit 0 %{_datadir}/systemtap/tapset/libvirt_functions.stp =20 %if %{with_bash_completion} -%{_datadir}/bash-completion/completions/vsh +%{_datadir}/bash-completion/completions/virsh %endif =20 =20 @@ -2111,7 +2126,14 @@ exit 0 %files admin %{_mandir}/man1/virt-admin.1* %{_bindir}/virt-admin +%if %{with_bash_completion} +%{_datadir}/bash-completion/completions/virt-admin +%endif =20 +%if %{with_bash_completion} +%files bash-completion +%{_datadir}/bash-completion/completions/vsh +%endif =20 %if %{with_wireshark} %files wireshark diff --git a/tools/Makefile.am b/tools/Makefile.am index e9597cdb4..e173f5634 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -424,9 +424,14 @@ install-bash-completion: $(MKDIR_P) "$(DESTDIR)$(BASH_COMPLETIONS_DIR)" $(INSTALL_SCRIPT) $(srcdir)/bash-completion/vsh \ "$(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh" + ( cd $(DESTDIR)$(BASH_COMPLETIONS_DIR) && \ + $(LN_S) vsh virsh && \ + $(LN_S) vsh virt-admin ) =20 uninstall-bash-completion: - rm -f $(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh + rm -f $(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh \ + $(DESTDIR)$(BASH_COMPLETIONS_DIR)/virsh \ + $(DESTDIR)$(BASH_COMPLETIONS_DIR)/virt-admin rmdir $(DESTDIR)$(BASH_COMPLETIONS_DIR) ||: else ! WITH_BASH_COMPLETION install-bash-completion: --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list