From nobody Sun May 5 12:56:42 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 1515767891091280.26216991552667; Fri, 12 Jan 2018 06:38:11 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A7A3C056781; Fri, 12 Jan 2018 14:38:03 +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 263985D962; Fri, 12 Jan 2018 14:38:01 +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 EB90D410B3; Fri, 12 Jan 2018 14:37:54 +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 w0CEbr5P025285 for ; Fri, 12 Jan 2018 09:37:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6E96965609; Fri, 12 Jan 2018 14:37:53 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id C168565626 for ; Fri, 12 Jan 2018 14:37:52 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:35 +0100 Message-Id: <651d0b3af7aa97c0ccd4844dea199c16fc6aaf1d.1515767806.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/8] virsh: Introduce virshStoragePoolNameCompleter 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 12 Jan 2018 14:38:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- tools/virsh-completer.c | 51 +++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh-completer.h | 4 ++++ tools/virsh-pool.c | 28 +++++++++++++-------------- tools/virsh-volume.c | 42 +++++++++++++++++++++------------------- tools/virsh.h | 6 ++++-- 5 files changed, 95 insertions(+), 36 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 48dd9fbc2..8ca2fffd9 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -147,3 +147,54 @@ virshDomainInterfaceCompleter(vshControl *ctl, virStringListFree(ret); return NULL; } + + +char ** +virshStoragePoolNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virStoragePoolPtr *pools =3D NULL; + int npools =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE | + VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE | + VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT | + VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT | + VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART | + VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART, + NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((npools =3D virConnectListAllStoragePools(priv->conn, &pools, flag= s)) < 0) + return NULL; + + if (VIR_ALLOC_N(ret, npools + 1) < 0) + goto error; + + for (i =3D 0; i < npools; i++) { + const char *name =3D virStoragePoolGetName(pools[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virStoragePoolFree(pools[i]); + } + VIR_FREE(pools); + + return ret; + + error: + for (; i < npools; i++) + virStoragePoolFree(pools[i]); + VIR_FREE(pools); + for (i =3D 0; i < npools; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 1a2dd685f..249e793b9 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -38,4 +38,8 @@ char ** virshDomainInterfaceCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshStoragePoolNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 094874b64..cea4cfc12 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -34,8 +34,8 @@ #include "virstring.h" #include "virtime.h" =20 -#define VIRSH_COMMON_OPT_POOL_FULL \ - VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) +#define VIRSH_COMMON_OPT_POOL_FULL(cflags) \ + VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"), cflags) =20 #define VIRSH_COMMON_OPT_POOL_BUILD \ {.name =3D "build", \ @@ -182,7 +182,7 @@ static const vshCmdInfo info_pool_autostart[] =3D { }; =20 static const vshCmdOptDef opts_pool_autostart[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D "disable", .type =3D VSH_OT_BOOL, @@ -575,7 +575,7 @@ static const vshCmdInfo info_pool_build[] =3D { }; =20 static const vshCmdOptDef opts_pool_build[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), VIRSH_COMMON_OPT_POOL_NO_OVERWRITE, VIRSH_COMMON_OPT_POOL_OVERWRITE, =20 @@ -625,7 +625,7 @@ static const vshCmdInfo info_pool_destroy[] =3D { }; =20 static const vshCmdOptDef opts_pool_destroy[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE), =20 {.name =3D NULL} }; @@ -665,7 +665,7 @@ static const vshCmdInfo info_pool_delete[] =3D { }; =20 static const vshCmdOptDef opts_pool_delete[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -705,7 +705,7 @@ static const vshCmdInfo info_pool_refresh[] =3D { }; =20 static const vshCmdOptDef opts_pool_refresh[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -745,7 +745,7 @@ static const vshCmdInfo info_pool_dumpxml[] =3D { }; =20 static const vshCmdOptDef opts_pool_dumpxml[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D "inactive", .type =3D VSH_OT_BOOL, @@ -1636,7 +1636,7 @@ static const vshCmdInfo info_pool_info[] =3D { }; =20 static const vshCmdOptDef opts_pool_info[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D "bytes", .type =3D VSH_OT_BOOL, @@ -1726,7 +1726,7 @@ static const vshCmdInfo info_pool_name[] =3D { }; =20 static const vshCmdOptDef opts_pool_name[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -1758,7 +1758,7 @@ static const vshCmdInfo info_pool_start[] =3D { }; =20 static const vshCmdOptDef opts_pool_start[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE), VIRSH_COMMON_OPT_POOL_BUILD, VIRSH_COMMON_OPT_POOL_NO_OVERWRITE, VIRSH_COMMON_OPT_POOL_OVERWRITE, @@ -1819,7 +1819,7 @@ static const vshCmdInfo info_pool_undefine[] =3D { }; =20 static const vshCmdOptDef opts_pool_undefine[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT), =20 {.name =3D NULL} }; @@ -1859,7 +1859,7 @@ static const vshCmdInfo info_pool_uuid[] =3D { }; =20 static const vshCmdOptDef opts_pool_uuid[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -1896,7 +1896,7 @@ static const vshCmdInfo info_pool_edit[] =3D { }; =20 static const vshCmdOptDef opts_pool_edit[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 8265a3979..b96e205f7 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -43,16 +43,18 @@ #include "virxml.h" #include "virstring.h" =20 -#define VIRSH_COMMON_OPT_POOL_FULL \ - VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) +#define VIRSH_COMMON_OPT_POOL_FULL(cflags) \ + VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"), cflags) =20 -#define VIRSH_COMMON_OPT_POOL_NAME \ - VIRSH_COMMON_OPT_POOL(N_("pool name")) +#define VIRSH_COMMON_OPT_POOL_NAME(cflags) \ + VIRSH_COMMON_OPT_POOL(N_("pool name"), cflags) =20 -#define VIRSH_COMMON_OPT_POOL_OPTIONAL \ +#define VIRSH_COMMON_OPT_POOL_OPTIONAL(cflags) \ {.name =3D "pool", \ .type =3D VSH_OT_STRING, \ - .help =3D N_("pool name or uuid") \ + .help =3D N_("pool name or uuid"), \ + .completer =3D virshStoragePoolNameCompleter, \ + .completer_flags =3D cflags, \ } =20 #define VIRSH_COMMON_OPT_VOLUME_VOL \ @@ -165,7 +167,7 @@ static const vshCmdInfo info_vol_create_as[] =3D { }; =20 static const vshCmdOptDef opts_vol_create_as[] =3D { - VIRSH_COMMON_OPT_POOL_NAME, + VIRSH_COMMON_OPT_POOL_NAME(0), {.name =3D "name", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, @@ -378,7 +380,7 @@ static const vshCmdInfo info_vol_create[] =3D { }; =20 static const vshCmdOptDef opts_vol_create[] =3D { - VIRSH_COMMON_OPT_POOL_NAME, + VIRSH_COMMON_OPT_POOL_NAME(0), VIRSH_COMMON_OPT_FILE(N_("file containing an XML vol description")), {.name =3D "prealloc-metadata", .type =3D VSH_OT_BOOL, @@ -440,7 +442,7 @@ static const vshCmdInfo info_vol_create_from[] =3D { }; =20 static const vshCmdOptDef opts_vol_create_from[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), VIRSH_COMMON_OPT_FILE(N_("file containing an XML vol description")), VIRSH_COMMON_OPT_VOLUME_VOL, {.name =3D "inputpool", @@ -559,7 +561,7 @@ static const vshCmdOptDef opts_vol_clone[] =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("clone name") }, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "prealloc-metadata", .type =3D VSH_OT_BOOL, .help =3D N_("preallocate metadata (for qcow2 instead of full allocat= ion)") @@ -651,7 +653,7 @@ static const vshCmdInfo info_vol_upload[] =3D { static const vshCmdOptDef opts_vol_upload[] =3D { VIRSH_COMMON_OPT_VOLUME_VOL, VIRSH_COMMON_OPT_FILE(N_("file")), - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "offset", .type =3D VSH_OT_INT, .help =3D N_("volume offset to upload to") @@ -766,7 +768,7 @@ static const vshCmdInfo info_vol_download[] =3D { static const vshCmdOptDef opts_vol_download[] =3D { VIRSH_COMMON_OPT_VOLUME_VOL, VIRSH_COMMON_OPT_FILE(N_("file")), - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "offset", .type =3D VSH_OT_INT, .help =3D N_("volume offset to download from") @@ -875,7 +877,7 @@ static const vshCmdInfo info_vol_delete[] =3D { =20 static const vshCmdOptDef opts_vol_delete[] =3D { VIRSH_COMMON_OPT_VOLUME_VOL, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "delete-snapshots", .type =3D VSH_OT_BOOL, .help =3D N_("delete snapshots associated with volume (must be " @@ -925,7 +927,7 @@ static const vshCmdInfo info_vol_wipe[] =3D { =20 static const vshCmdOptDef opts_vol_wipe[] =3D { VIRSH_COMMON_OPT_VOLUME_VOL, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "algorithm", .type =3D VSH_OT_STRING, .help =3D N_("perform selected wiping algorithm") @@ -1012,7 +1014,7 @@ static const vshCmdInfo info_vol_info[] =3D { =20 static const vshCmdOptDef opts_vol_info[] =3D { VIRSH_COMMON_OPT_VOLUME_VOL, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "bytes", .type =3D VSH_OT_BOOL, .help =3D N_("sizes are represented in bytes rather than pretty units= ") @@ -1107,7 +1109,7 @@ static const vshCmdOptDef opts_vol_resize[] =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("new capacity for the vol, as scaled integer (default by= tes)") }, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D "allocate", .type =3D VSH_OT_BOOL, .help =3D N_("allocate the new capacity, rather than leaving it spars= e") @@ -1199,7 +1201,7 @@ static const vshCmdInfo info_vol_dumpxml[] =3D { =20 static const vshCmdOptDef opts_vol_dumpxml[] =3D { VIRSH_COMMON_OPT_VOLUME_VOL, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D NULL} }; =20 @@ -1363,7 +1365,7 @@ static const vshCmdInfo info_vol_list[] =3D { }; =20 static const vshCmdOptDef opts_vol_list[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), {.name =3D "details", .type =3D VSH_OT_BOOL, .help =3D N_("display extended details for volumes") @@ -1705,7 +1707,7 @@ static const vshCmdOptDef opts_vol_key[] =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("volume name or path") }, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D NULL} }; =20 @@ -1741,7 +1743,7 @@ static const vshCmdOptDef opts_vol_path[] =3D { .flags =3D VSH_OFLAG_REQ, .help =3D N_("volume name or key") }, - VIRSH_COMMON_OPT_POOL_OPTIONAL, + VIRSH_COMMON_OPT_POOL_OPTIONAL(0), {.name =3D NULL} }; =20 diff --git a/tools/virsh.h b/tools/virsh.h index 528e04558..f2213ebb5 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -64,11 +64,13 @@ /* * Common command options */ -# define VIRSH_COMMON_OPT_POOL(_helpstr) \ +# define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \ {.name =3D "pool", \ .type =3D VSH_OT_DATA, \ .flags =3D VSH_OFLAG_REQ, \ - .help =3D _helpstr \ + .help =3D _helpstr, \ + .completer =3D virshStoragePoolNameCompleter, \ + .completer_flags =3D cflags, \ } =20 # define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1516783874345782.166369192372; Wed, 24 Jan 2018 00:51:14 -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 D456180B2A; Wed, 24 Jan 2018 08:51:12 +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 AB6573818A; Wed, 24 Jan 2018 08:51:12 +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 51FBE4ED37; Wed, 24 Jan 2018 08:51:12 +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 w0O8pB9o003342 for ; Wed, 24 Jan 2018 03:51:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1A58B5EDEB; Wed, 24 Jan 2018 08:51:11 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57B885D6A8; Wed, 24 Jan 2018 08:51:06 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 24 Jan 2018 09:50:55 +0100 Message-Id: <906b57e62b71efa5dd15d9cc000b0eaf2e92f7b1.1516783466.git.mprivozn@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/9] virsh: Introduce virshStoragePoolNameCompleter 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]); Wed, 24 Jan 2018 08:51:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- Diff to v1: - Pruned the list of flags accepted in the callback - Pools for vol_* are ACTIVE only - Other small nits raised in the review tools/virsh-completer.c | 48 +++++++++++++++++++++++++++++++++++++++++++++= +++ tools/virsh-completer.h | 4 ++++ tools/virsh-pool.c | 28 ++++++++++++++-------------- tools/virsh-volume.c | 10 +++++++--- tools/virsh.h | 6 ++++-- 5 files changed, 77 insertions(+), 19 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 48dd9fbc2..947c326fc 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -147,3 +147,51 @@ virshDomainInterfaceCompleter(vshControl *ctl, virStringListFree(ret); return NULL; } + + +char ** +virshStoragePoolNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virStoragePoolPtr *pools =3D NULL; + int npools =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE | + VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE | + VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT, + NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((npools =3D virConnectListAllStoragePools(priv->conn, &pools, flag= s)) < 0) + return NULL; + + if (VIR_ALLOC_N(ret, npools + 1) < 0) + goto error; + + for (i =3D 0; i < npools; i++) { + const char *name =3D virStoragePoolGetName(pools[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virStoragePoolFree(pools[i]); + } + VIR_FREE(pools); + + return ret; + + error: + for (; i < npools; i++) + virStoragePoolFree(pools[i]); + VIR_FREE(pools); + for (i =3D 0; i < npools; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 1a2dd685f..249e793b9 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -38,4 +38,8 @@ char ** virshDomainInterfaceCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshStoragePoolNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 094874b64..56b6cfc73 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -34,8 +34,8 @@ #include "virstring.h" #include "virtime.h" =20 -#define VIRSH_COMMON_OPT_POOL_FULL \ - VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) +#define VIRSH_COMMON_OPT_POOL_FULL(cflags) \ + VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"), cflags) =20 #define VIRSH_COMMON_OPT_POOL_BUILD \ {.name =3D "build", \ @@ -182,7 +182,7 @@ static const vshCmdInfo info_pool_autostart[] =3D { }; =20 static const vshCmdOptDef opts_pool_autostart[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT), =20 {.name =3D "disable", .type =3D VSH_OT_BOOL, @@ -575,7 +575,7 @@ static const vshCmdInfo info_pool_build[] =3D { }; =20 static const vshCmdOptDef opts_pool_build[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), VIRSH_COMMON_OPT_POOL_NO_OVERWRITE, VIRSH_COMMON_OPT_POOL_OVERWRITE, =20 @@ -625,7 +625,7 @@ static const vshCmdInfo info_pool_destroy[] =3D { }; =20 static const vshCmdOptDef opts_pool_destroy[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE), =20 {.name =3D NULL} }; @@ -665,7 +665,7 @@ static const vshCmdInfo info_pool_delete[] =3D { }; =20 static const vshCmdOptDef opts_pool_delete[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE), =20 {.name =3D NULL} }; @@ -705,7 +705,7 @@ static const vshCmdInfo info_pool_refresh[] =3D { }; =20 static const vshCmdOptDef opts_pool_refresh[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -745,7 +745,7 @@ static const vshCmdInfo info_pool_dumpxml[] =3D { }; =20 static const vshCmdOptDef opts_pool_dumpxml[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D "inactive", .type =3D VSH_OT_BOOL, @@ -1636,7 +1636,7 @@ static const vshCmdInfo info_pool_info[] =3D { }; =20 static const vshCmdOptDef opts_pool_info[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D "bytes", .type =3D VSH_OT_BOOL, @@ -1726,7 +1726,7 @@ static const vshCmdInfo info_pool_name[] =3D { }; =20 static const vshCmdOptDef opts_pool_name[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -1758,7 +1758,7 @@ static const vshCmdInfo info_pool_start[] =3D { }; =20 static const vshCmdOptDef opts_pool_start[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE), VIRSH_COMMON_OPT_POOL_BUILD, VIRSH_COMMON_OPT_POOL_NO_OVERWRITE, VIRSH_COMMON_OPT_POOL_OVERWRITE, @@ -1819,7 +1819,7 @@ static const vshCmdInfo info_pool_undefine[] =3D { }; =20 static const vshCmdOptDef opts_pool_undefine[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT), =20 {.name =3D NULL} }; @@ -1859,7 +1859,7 @@ static const vshCmdInfo info_pool_uuid[] =3D { }; =20 static const vshCmdOptDef opts_pool_uuid[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; @@ -1896,7 +1896,7 @@ static const vshCmdInfo info_pool_edit[] =3D { }; =20 static const vshCmdOptDef opts_pool_edit[] =3D { - VIRSH_COMMON_OPT_POOL_FULL, + VIRSH_COMMON_OPT_POOL_FULL(0), =20 {.name =3D NULL} }; diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 8265a3979..bfbb7c7d7 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -44,15 +44,19 @@ #include "virstring.h" =20 #define VIRSH_COMMON_OPT_POOL_FULL \ - VIRSH_COMMON_OPT_POOL(N_("pool name or uuid")) + VIRSH_COMMON_OPT_POOL(N_("pool name or uuid"), \ + VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE) =20 #define VIRSH_COMMON_OPT_POOL_NAME \ - VIRSH_COMMON_OPT_POOL(N_("pool name")) + VIRSH_COMMON_OPT_POOL(N_("pool name"), \ + VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE) =20 #define VIRSH_COMMON_OPT_POOL_OPTIONAL \ {.name =3D "pool", \ .type =3D VSH_OT_STRING, \ - .help =3D N_("pool name or uuid") \ + .help =3D N_("pool name or uuid"), \ + .completer =3D virshStoragePoolNameCompleter, \ + .completer_flags =3D VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE, \ } =20 #define VIRSH_COMMON_OPT_VOLUME_VOL \ diff --git a/tools/virsh.h b/tools/virsh.h index 528e04558..f2213ebb5 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -64,11 +64,13 @@ /* * Common command options */ -# define VIRSH_COMMON_OPT_POOL(_helpstr) \ +# define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \ {.name =3D "pool", \ .type =3D VSH_OT_DATA, \ .flags =3D VSH_OFLAG_REQ, \ - .help =3D _helpstr \ + .help =3D _helpstr, \ + .completer =3D virshStoragePoolNameCompleter, \ + .completer_flags =3D cflags, \ } =20 # define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515767959595508.35659816862915; Fri, 12 Jan 2018 06:39:19 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63745C049D56; Fri, 12 Jan 2018 14:39:02 +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 A3A6B65609; Fri, 12 Jan 2018 14:39:00 +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 465B118033DC; Fri, 12 Jan 2018 14:38:57 +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 w0CEbsS9025291 for ; Fri, 12 Jan 2018 09:37:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4753D5D6A6; Fri, 12 Jan 2018 14:37:54 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFF906B43D for ; Fri, 12 Jan 2018 14:37:53 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:36 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/8] virsh: Introduce virshStorageVolNameCompleter 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 12 Jan 2018 14:39:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This one is a bit simpler since virStoragePoolListAllVolumes() has no flags yet. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 52 +++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh-completer.h | 4 ++++ tools/virsh-volume.c | 3 ++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 8ca2fffd9..d6ac0ccb8 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -24,6 +24,7 @@ =20 #include "virsh-completer.h" #include "virsh.h" +#include "virsh-pool.h" #include "virsh-util.h" #include "internal.h" #include "viralloc.h" @@ -198,3 +199,54 @@ virshStoragePoolNameCompleter(vshControl *ctl, VIR_FREE(ret); return NULL; } + + +char ** +virshStorageVolNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virStoragePoolPtr pool =3D NULL; + virStorageVolPtr *vols =3D NULL; + int nvols =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (!(pool =3D virshCommandOptPool(ctl, cmd, "pool", NULL))) + return false; + + if ((nvols =3D virStoragePoolListAllVolumes(pool, &vols, flags)) < 0) + goto error; + + if (VIR_ALLOC_N(ret, nvols + 1) < 0) + goto error; + + for (i =3D 0; i < nvols; i++) { + const char *name =3D virStorageVolGetName(vols[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virStorageVolFree(vols[i]); + } + VIR_FREE(vols); + virStoragePoolFree(pool); + + return ret; + + error: + for (; i < nvols; i++) + virStorageVolFree(vols[i]); + VIR_FREE(vols); + for (i =3D 0; i < nvols; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + virStoragePoolFree(pool); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 249e793b9..1e4ce5932 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -42,4 +42,8 @@ char ** virshStoragePoolNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshStorageVolNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index b96e205f7..c1f36d9b9 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -61,7 +61,8 @@ {.name =3D "vol", \ .type =3D VSH_OT_DATA, \ .flags =3D VSH_OFLAG_REQ, \ - .help =3D N_("vol name, key or path") \ + .help =3D N_("vol name, key or path"), \ + .completer =3D virshStorageVolNameCompleter, \ } =20 virStorageVolPtr --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515768003239100.04693597592723; Fri, 12 Jan 2018 06:40:03 -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 EE9FE15DE; Fri, 12 Jan 2018 14:39: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 4D42718A4D; Fri, 12 Jan 2018 14:39:39 +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 5153C18033DE; Fri, 12 Jan 2018 14:39:34 +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 w0CEbxRj025472 for ; Fri, 12 Jan 2018 09:37:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8FA5C6561F; Fri, 12 Jan 2018 14:37:59 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14F916560E for ; Fri, 12 Jan 2018 14:37:54 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:37 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/8] virsh: Introduce virshInterfaceNameCompleter 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.29]); Fri, 12 Jan 2018 14:39:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 47 +++++++++++++++++++++++++++++++++++++++++++++= ++ tools/virsh-completer.h | 4 ++++ tools/virsh-interface.c | 16 +++++++++------- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index d6ac0ccb8..f5b1e4261 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -250,3 +250,50 @@ virshStorageVolNameCompleter(vshControl *ctl, virStoragePoolFree(pool); return NULL; } + + +char ** +virshInterfaceNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virInterfacePtr *ifaces =3D NULL; + int nifaces =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(VIR_CONNECT_LIST_INTERFACES_ACTIVE | + VIR_CONNECT_LIST_INTERFACES_INACTIVE, + NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((nifaces =3D virConnectListAllInterfaces(priv->conn, &ifaces, flag= s)) < 0) + return NULL; + + if (VIR_ALLOC_N(ret, nifaces + 1) < 0) + goto error; + + for (i =3D 0; i < nifaces; i++) { + const char *name =3D virInterfaceGetName(ifaces[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virInterfaceFree(ifaces[i]); + } + VIR_FREE(ifaces); + + return ret; + + error: + for (; i < nifaces; i++) + virInterfaceFree(ifaces[i]); + VIR_FREE(ifaces); + for (i =3D 0; i < nifaces; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 1e4ce5932..2323aaba3 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -46,4 +46,8 @@ char ** virshStorageVolNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshInterfaceNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index c1a2b21de..50518c667 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -23,11 +23,13 @@ * */ =20 -#define VIRSH_COMMON_OPT_INTERFACE \ +#define VIRSH_COMMON_OPT_INTERFACE(cflags) \ {.name =3D "interface", \ .type =3D VSH_OT_DATA, \ .flags =3D VSH_OFLAG_REQ, \ - .help =3D N_("interface name or MAC address") \ + .help =3D N_("interface name or MAC address"), \ + .completer =3D virshInterfaceNameCompleter, \ + .completer_flags =3D cflags, \ } =20 #include @@ -107,7 +109,7 @@ static const vshCmdInfo info_interface_edit[] =3D { }; =20 static const vshCmdOptDef opts_interface_edit[] =3D { - VIRSH_COMMON_OPT_INTERFACE, + VIRSH_COMMON_OPT_INTERFACE(0), {.name =3D NULL} }; =20 @@ -467,7 +469,7 @@ static const vshCmdInfo info_interface_dumpxml[] =3D { }; =20 static const vshCmdOptDef opts_interface_dumpxml[] =3D { - VIRSH_COMMON_OPT_INTERFACE, + VIRSH_COMMON_OPT_INTERFACE(0), {.name =3D "inactive", .type =3D VSH_OT_BOOL, .help =3D N_("show inactive defined XML") @@ -564,7 +566,7 @@ static const vshCmdInfo info_interface_undefine[] =3D { }; =20 static const vshCmdOptDef opts_interface_undefine[] =3D { - VIRSH_COMMON_OPT_INTERFACE, + VIRSH_COMMON_OPT_INTERFACE(0), {.name =3D NULL} }; =20 @@ -603,7 +605,7 @@ static const vshCmdInfo info_interface_start[] =3D { }; =20 static const vshCmdOptDef opts_interface_start[] =3D { - VIRSH_COMMON_OPT_INTERFACE, + VIRSH_COMMON_OPT_INTERFACE(VIR_CONNECT_LIST_INTERFACES_INACTIVE), {.name =3D NULL} }; =20 @@ -642,7 +644,7 @@ static const vshCmdInfo info_interface_destroy[] =3D { }; =20 static const vshCmdOptDef opts_interface_destroy[] =3D { - VIRSH_COMMON_OPT_INTERFACE, + VIRSH_COMMON_OPT_INTERFACE(VIR_CONNECT_LIST_INTERFACES_ACTIVE), {.name =3D NULL} }; =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515768047121469.4513505965642; Fri, 12 Jan 2018 06:40:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01EA08047E; Fri, 12 Jan 2018 14:40:30 +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 C1E43179E9; Fri, 12 Jan 2018 14:40: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 0DA57410B3; Fri, 12 Jan 2018 14:40:22 +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 w0CEc3QM025644 for ; Fri, 12 Jan 2018 09:38:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 029A56560E; Fri, 12 Jan 2018 14:38:03 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BECA6562B for ; Fri, 12 Jan 2018 14:37:59 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:38 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] virsh: Introduce virshNetworkNameCompleter 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 12 Jan 2018 14:40:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 51 +++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh-completer.h | 4 ++++ tools/virsh-network.c | 24 ++++++++++++----------- 3 files changed, 68 insertions(+), 11 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index f5b1e4261..2c0d4f640 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -297,3 +297,54 @@ virshInterfaceNameCompleter(vshControl *ctl, VIR_FREE(ret); return NULL; } + + +char ** +virshNetworkNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virNetworkPtr *nets =3D NULL; + int nnets =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(VIR_CONNECT_LIST_NETWORKS_INACTIVE | + VIR_CONNECT_LIST_NETWORKS_ACTIVE | + VIR_CONNECT_LIST_NETWORKS_PERSISTENT | + VIR_CONNECT_LIST_NETWORKS_TRANSIENT | + VIR_CONNECT_LIST_NETWORKS_AUTOSTART | + VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART, + NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((nnets =3D virConnectListAllNetworks(priv->conn, &nets, flags)) < = 0) + return NULL; + + if (VIR_ALLOC_N(ret, nnets + 1) < 0) + goto error; + + for (i =3D 0; i < nnets; i++) { + const char *name =3D virNetworkGetName(nets[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virNetworkFree(nets[i]); + } + VIR_FREE(nets); + + return ret; + + error: + for (; i < nnets; i++) + virNetworkFree(nets[i]); + VIR_FREE(nets); + for (i =3D 0; i < nnets; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 2323aaba3..20ba4cb55 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -50,4 +50,8 @@ char ** virshInterfaceNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshNetworkNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-network.c b/tools/virsh-network.c index cd55e384f..3b472ea67 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -34,11 +34,13 @@ #include "virtime.h" #include "conf/network_conf.h" =20 -#define VIRSH_COMMON_OPT_NETWORK \ +#define VIRSH_COMMON_OPT_NETWORK(cflags) \ {.name =3D "network", \ .type =3D VSH_OT_DATA, \ .flags =3D VSH_OFLAG_REQ, \ - .help =3D N_("network name or uuid") \ + .help =3D N_("network name or uuid"), \ + .completer =3D virshNetworkNameCompleter, \ + .completer_flags =3D cflags, \ } =20 virNetworkPtr @@ -93,7 +95,7 @@ static const vshCmdInfo info_network_autostart[] =3D { }; =20 static const vshCmdOptDef opts_network_autostart[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D "disable", .type =3D VSH_OT_BOOL, .help =3D N_("disable autostarting") @@ -240,7 +242,7 @@ static const vshCmdInfo info_network_destroy[] =3D { }; =20 static const vshCmdOptDef opts_network_destroy[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(VIR_CONNECT_LIST_NETWORKS_ACTIVE), {.name =3D NULL} }; =20 @@ -279,7 +281,7 @@ static const vshCmdInfo info_network_dumpxml[] =3D { }; =20 static const vshCmdOptDef opts_network_dumpxml[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D "inactive", .type =3D VSH_OT_BOOL, .help =3D N_("show inactive defined XML") @@ -330,7 +332,7 @@ static const vshCmdInfo info_network_info[] =3D { }; =20 static const vshCmdOptDef opts_network_info[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D NULL} }; =20 @@ -779,7 +781,7 @@ static const vshCmdInfo info_network_start[] =3D { }; =20 static const vshCmdOptDef opts_network_start[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(VIR_CONNECT_LIST_NETWORKS_INACTIVE), {.name =3D NULL} }; =20 @@ -817,7 +819,7 @@ static const vshCmdInfo info_network_undefine[] =3D { }; =20 static const vshCmdOptDef opts_network_undefine[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D NULL} }; =20 @@ -856,7 +858,7 @@ static const vshCmdInfo info_network_update[] =3D { }; =20 static const vshCmdOptDef opts_network_update[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D "command", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, @@ -1057,7 +1059,7 @@ static const vshCmdInfo info_network_edit[] =3D { }; =20 static const vshCmdOptDef opts_network_edit[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D NULL} }; =20 @@ -1304,7 +1306,7 @@ static const vshCmdInfo info_network_dhcp_leases[] = =3D { }; =20 static const vshCmdOptDef opts_network_dhcp_leases[] =3D { - VIRSH_COMMON_OPT_NETWORK, + VIRSH_COMMON_OPT_NETWORK(0), {.name =3D "mac", .type =3D VSH_OT_STRING, .flags =3D VSH_OFLAG_NONE, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515767953582563.5408290281532; Fri, 12 Jan 2018 06:39:13 -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 A85E65AFC4; Fri, 12 Jan 2018 14:39:01 +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 C0D1117DEC; Fri, 12 Jan 2018 14:38:58 +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 1F4E018033DA; Fri, 12 Jan 2018 14:38:56 +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 w0CEc4bK025653 for ; Fri, 12 Jan 2018 09:38:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 175EA17B73; Fri, 12 Jan 2018 14:38:04 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E5ED5D6A6 for ; Fri, 12 Jan 2018 14:38:03 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:39 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] virsh: Introduce virshNodeDeviceNameCompleter 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.39]); Fri, 12 Jan 2018 14:39:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Yet again, we don't need listing by device capabilities, so flags are unused. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-nodedev.c | 16 +++++++++++----- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 2c0d4f640..c50143142 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -348,3 +348,48 @@ virshNetworkNameCompleter(vshControl *ctl, VIR_FREE(ret); return NULL; } + + +char ** +virshNodeDeviceNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virNodeDevicePtr *devs =3D NULL; + int ndevs =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((ndevs =3D virConnectListAllNodeDevices(priv->conn, &devs, flags))= < 0) + return NULL; + + if (VIR_ALLOC_N(ret, ndevs + 1) < 0) + goto error; + + for (i =3D 0; i < ndevs; i++) { + const char *name =3D virNodeDeviceGetName(devs[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virNodeDeviceFree(devs[i]); + } + VIR_FREE(devs); + + return ret; + + error: + for (; i < ndevs; i++) + virNodeDeviceFree(devs[i]); + VIR_FREE(devs); + for (i =3D 0; i < ndevs; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 20ba4cb55..19fa2113d 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -54,4 +54,8 @@ char ** virshNetworkNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshNodeDeviceNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index c7ef6bfde..d25fe0e09 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -109,7 +109,8 @@ static const vshCmdOptDef opts_node_device_destroy[] = =3D { {.name =3D "device", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format") + .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), + .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D NULL} }; @@ -534,6 +535,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = =3D { .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), + .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D NULL} }; @@ -604,7 +606,8 @@ static const vshCmdOptDef opts_node_device_detach[] =3D= { {.name =3D "device", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("device key") + .help =3D N_("device key"), + .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D "driver", .type =3D VSH_OT_STRING, @@ -670,7 +673,8 @@ static const vshCmdOptDef opts_node_device_reattach[] = =3D { {.name =3D "device", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("device key") + .help =3D N_("device key"), + .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D NULL} }; @@ -720,7 +724,8 @@ static const vshCmdOptDef opts_node_device_reset[] =3D { {.name =3D "device", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("device key") + .help =3D N_("device key"), + .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D NULL} }; @@ -866,7 +871,8 @@ static const vshCmdInfo info_node_device_event[] =3D { static const vshCmdOptDef opts_node_device_event[] =3D { {.name =3D "device", .type =3D VSH_OT_STRING, - .help =3D N_("filter by node device name") + .help =3D N_("filter by node device name"), + .completer =3D virshNodeDeviceNameCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 151576791333221.277001552677575; Fri, 12 Jan 2018 06:38:33 -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 18F9D15447; Fri, 12 Jan 2018 14:38:21 +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 E2DC117989; Fri, 12 Jan 2018 14:38:18 +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 D770818033DB; Fri, 12 Jan 2018 14:38:08 +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 w0CEc6NY025667 for ; Fri, 12 Jan 2018 09:38:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id D3AC85D6A6; Fri, 12 Jan 2018 14:38:06 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5716165624 for ; Fri, 12 Jan 2018 14:38:04 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:40 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/8] virsh: Introduce virshNWFilterNameCompleter 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.29]); Fri, 12 Jan 2018 14:38:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The virConnectListAllNWFilters() has no extra flags yet, which simplifies things a bit. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-nwfilter.c | 9 ++++++--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index c50143142..9e6f086c0 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -393,3 +393,48 @@ virshNodeDeviceNameCompleter(vshControl *ctl, VIR_FREE(ret); return NULL; } + + +char ** +virshNWFilterNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virNWFilterPtr *nwfilters =3D NULL; + int nnwfilters =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((nnwfilters =3D virConnectListAllNWFilters(priv->conn, &nwfilters,= flags)) < 0) + return NULL; + + if (VIR_ALLOC_N(ret, nnwfilters + 1) < 0) + goto error; + + for (i =3D 0; i < nnwfilters; i++) { + const char *name =3D virNWFilterGetName(nwfilters[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virNWFilterFree(nwfilters[i]); + } + VIR_FREE(nwfilters); + + return ret; + + error: + for (; i < nnwfilters; i++) + virNWFilterFree(nwfilters[i]); + VIR_FREE(nwfilters); + for (i =3D 0; i < nnwfilters; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 19fa2113d..3c3b17f1e 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -58,4 +58,8 @@ char ** virshNodeDeviceNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshNWFilterNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 40bc193ad..06a002dff 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -136,7 +136,8 @@ static const vshCmdOptDef opts_nwfilter_undefine[] =3D { {.name =3D "nwfilter", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("network filter name or uuid") + .help =3D N_("network filter name or uuid"), + .completer =3D virshNWFilterNameCompleter, }, {.name =3D NULL} }; @@ -179,7 +180,8 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { {.name =3D "nwfilter", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("network filter name or uuid") + .help =3D N_("network filter name or uuid"), + .completer =3D virshNWFilterNameCompleter, }, {.name =3D NULL} }; @@ -396,7 +398,8 @@ static const vshCmdOptDef opts_nwfilter_edit[] =3D { {.name =3D "nwfilter", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("network filter name or uuid") + .help =3D N_("network filter name or uuid"), + .completer =3D virshNWFilterNameCompleter, }, {.name =3D NULL} }; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515767946848585.6938675486842; Fri, 12 Jan 2018 06:39:06 -0800 (PST) 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 DF63861D0F; Fri, 12 Jan 2018 14:38:59 +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 6456B17185; Fri, 12 Jan 2018 14:38:59 +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 42D9B410B5; Fri, 12 Jan 2018 14:38:54 +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 w0CEcA7A025691 for ; Fri, 12 Jan 2018 09:38:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id B8F82176C9; Fri, 12 Jan 2018 14:38:10 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F98165609 for ; Fri, 12 Jan 2018 14:38:07 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:41 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/8] virsh: Introduce virshSecretUUIDCompleter 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.39]); Fri, 12 Jan 2018 14:39:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is a slight change from previous patches since virSecret does not have a name only UUID strings. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-secret.c | 15 ++++++++++----- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 9e6f086c0..7332fa97a 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -438,3 +438,49 @@ virshNWFilterNameCompleter(vshControl *ctl, VIR_FREE(ret); return NULL; } + + +char ** +virshSecretUUIDCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virSecretPtr *secrets =3D NULL; + int nsecrets =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if ((nsecrets =3D virConnectListAllSecrets(priv->conn, &secrets, flags= )) < 0) + return NULL; + + if (VIR_ALLOC_N(ret, nsecrets + 1) < 0) + goto error; + + for (i =3D 0; i < nsecrets; i++) { + char uuid[VIR_UUID_STRING_BUFLEN]; + + if (virSecretGetUUIDString(secrets[i], uuid) < 0 || + VIR_STRDUP(ret[i], uuid) < 0) + goto error; + + virSecretFree(secrets[i]); + } + VIR_FREE(secrets); + + return ret; + + error: + for (; i < nsecrets; i++) + virSecretFree(secrets[i]); + VIR_FREE(secrets); + for (i =3D 0; i < nsecrets; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 3c3b17f1e..0e518873c 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -62,4 +62,8 @@ char ** virshNWFilterNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshSecretUUIDCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 52f067652..9e4ec61a8 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -132,7 +132,8 @@ static const vshCmdOptDef opts_secret_dumpxml[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("secret UUID") + .help =3D N_("secret UUID"), + .completer =3D virshSecretUUIDCompleter, }, {.name =3D NULL} }; @@ -177,7 +178,8 @@ static const vshCmdOptDef opts_secret_set_value[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("secret UUID") + .help =3D N_("secret UUID"), + .completer =3D virshSecretUUIDCompleter, }, {.name =3D "base64", .type =3D VSH_OT_DATA, @@ -245,7 +247,8 @@ static const vshCmdOptDef opts_secret_get_value[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("secret UUID") + .help =3D N_("secret UUID"), + .completer =3D virshSecretUUIDCompleter, }, {.name =3D NULL} }; @@ -297,7 +300,8 @@ static const vshCmdOptDef opts_secret_undefine[] =3D { {.name =3D "secret", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("secret UUID") + .help =3D N_("secret UUID"), + .completer =3D virshSecretUUIDCompleter, }, {.name =3D NULL} }; @@ -667,7 +671,8 @@ static const vshCmdInfo info_secret_event[] =3D { static const vshCmdOptDef opts_secret_event[] =3D { {.name =3D "secret", .type =3D VSH_OT_STRING, - .help =3D N_("filter by secret name or uuid") + .help =3D N_("filter by secret name or uuid"), + .completer =3D virshSecretUUIDCompleter, }, {.name =3D "event", .type =3D VSH_OT_STRING, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515768072424702.8028963669996; Fri, 12 Jan 2018 06:41:12 -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 86A1F8E223; Fri, 12 Jan 2018 14:41:05 +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 92E2B17974; Fri, 12 Jan 2018 14:41:01 +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 A72D7410B7; Fri, 12 Jan 2018 14:40:56 +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 w0CEcB9w025698 for ; Fri, 12 Jan 2018 09:38:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id C77A7176B0; Fri, 12 Jan 2018 14:38:11 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D86065604 for ; Fri, 12 Jan 2018 14:38:10 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 15:37:42 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/8] virsh: Introduce virshSnapshotNameCompleter 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]); Fri, 12 Jan 2018 14:41:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tools/virsh-completer.c | 51 +++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh-completer.h | 4 ++++ tools/virsh-snapshot.c | 21 +++++++++++++------- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 7332fa97a..9db7c59d2 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -484,3 +484,54 @@ virshSecretUUIDCompleter(vshControl *ctl, VIR_FREE(ret); return NULL; } + + +char ** +virshSnapshotNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + virDomainPtr dom =3D NULL; + virDomainSnapshotPtr *snapshots =3D NULL; + int nsnapshots =3D 0; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return NULL; + + if ((nsnapshots =3D virDomainListAllSnapshots(dom, &snapshots, flags))= < 0) + goto error; + + if (VIR_ALLOC_N(ret, nsnapshots + 1) < 0) + goto error; + + for (i =3D 0; i < nsnapshots; i++) { + const char *name =3D virDomainSnapshotGetName(snapshots[i]); + + if (VIR_STRDUP(ret[i], name) < 0) + goto error; + + virshDomainSnapshotFree(snapshots[i]); + } + VIR_FREE(snapshots); + virshDomainFree(dom); + + return ret; + + error: + for (; i < nsnapshots; i++) + virshDomainSnapshotFree(snapshots[i]); + VIR_FREE(snapshots); + for (i =3D 0; i < nsnapshots; i++) + VIR_FREE(ret[i]); + VIR_FREE(ret); + virshDomainFree(dom); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 0e518873c..fa443d3ad 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -66,4 +66,8 @@ char ** virshSecretUUIDCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshSnapshotNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index c44a36f98..e4908eea7 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -511,7 +511,8 @@ static const vshCmdOptDef opts_snapshot_edit[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, - .help =3D N_("snapshot name") + .help =3D N_("snapshot name"), + .completer =3D virshSnapshotNameCompleter, }, VIRSH_COMMON_OPT_CURRENT(N_("also set edited snapshot as current")), {.name =3D "rename", @@ -631,7 +632,8 @@ static const vshCmdOptDef opts_snapshot_current[] =3D { }, {.name =3D "snapshotname", .type =3D VSH_OT_STRING, - .help =3D N_("name of existing snapshot to make current") + .help =3D N_("name of existing snapshot to make current"), + .completer =3D virshSnapshotNameCompleter, }, {.name =3D NULL} }; @@ -854,7 +856,8 @@ static const vshCmdOptDef opts_snapshot_info[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, - .help =3D N_("snapshot name") + .help =3D N_("snapshot name"), + .completer =3D virshSnapshotNameCompleter, }, VIRSH_COMMON_OPT_CURRENT(N_("info on current snapshot")), {.name =3D NULL} @@ -1661,7 +1664,8 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] =3D= { {.name =3D "snapshotname", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, - .help =3D N_("snapshot name") + .help =3D N_("snapshot name"), + .completer =3D virshSnapshotNameCompleter, }, {.name =3D "security-info", .type =3D VSH_OT_BOOL, @@ -1723,7 +1727,8 @@ static const vshCmdOptDef opts_snapshot_parent[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, - .help =3D N_("find parent of snapshot name") + .help =3D N_("find parent of snapshot name"), + .completer =3D virshSnapshotNameCompleter, }, VIRSH_COMMON_OPT_CURRENT(N_("find parent of current snapshot")), {.name =3D NULL} @@ -1782,7 +1787,8 @@ static const vshCmdOptDef opts_snapshot_revert[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, - .help =3D N_("snapshot name") + .help =3D N_("snapshot name"), + .completer =3D virshSnapshotNameCompleter, }, VIRSH_COMMON_OPT_CURRENT(N_("revert to current snapshot")), {.name =3D "running", @@ -1866,7 +1872,8 @@ static const vshCmdOptDef opts_snapshot_delete[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "snapshotname", .type =3D VSH_OT_STRING, - .help =3D N_("snapshot name") + .help =3D N_("snapshot name"), + .completer =3D virshSnapshotNameCompleter, }, VIRSH_COMMON_OPT_CURRENT(N_("delete current snapshot")), {.name =3D "children", --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 12:56:42 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 1515771269763778.7637175917862; Fri, 12 Jan 2018 07:34:29 -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 2ED2C4C470; Fri, 12 Jan 2018 15:34:11 +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 C2AEC17F4D; Fri, 12 Jan 2018 15:34:08 +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 44F284ED36; Fri, 12 Jan 2018 15:34:04 +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 w0CFUkqA004730 for ; Fri, 12 Jan 2018 10:30:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 545601710F; Fri, 12 Jan 2018 15:30:46 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD1BC171C6 for ; Fri, 12 Jan 2018 15:30:42 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 16:30:37 +0100 Message-Id: <224130bd93671fda1e3757b9c0af602207c96b77.1515770916.git.mprivozn@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 9/8] docs: Mention bash completion feature 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]); Fri, 12 Jan 2018 15:34:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik --- docs/news.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 064b9ae83..e5ed89504 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -47,6 +47,17 @@ qemu: Add support for hot unplugging redirdev device + + + virsh: Enhance bash completion + + + New bash completion script is introduced to enable completion ev= en + for non-interactive virsh. At the same time, virsh offers comple= tion + of some basic libvirt objects like domains, networks, storage po= ols, + etc. to virsh commands accepting them. + +
--=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list