From nobody Mon Feb 9 06:48:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; 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 15517560390180.42087502247068187; Mon, 4 Mar 2019 19:20:39 -0800 (PST) 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 51805859FB; Tue, 5 Mar 2019 03:20: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 1DE5D1A7DB; Tue, 5 Mar 2019 03:20:37 +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 CD26A181A010; Tue, 5 Mar 2019 03:20:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x253KOIp000679 for ; Mon, 4 Mar 2019 22:20:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id EBA5818BB0; Tue, 5 Mar 2019 03:20:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E52A75D978; Tue, 5 Mar 2019 03:20:24 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5CA3307E040; Tue, 5 Mar 2019 03:20:23 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id i12so7775088wrw.0; Mon, 04 Mar 2019 19:20:23 -0800 (PST) Received: from localhost.localdomain ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id l18sm7402167wrv.20.2019.03.04.19.20.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Mar 2019 19:20:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AL6OdpOhbzKn/87jc022hXr2EgRyV8uRLoLEER7AxGE=; b=pfNqQtxsMzQMg4PHQZPMHkXUxbKCX1qQ9GozIaGY8Fl1MASdW39zQpeFuguf9mETsr osTPJ+akK2UIkkHDJ7OHgKLK+q8DmZCeJX4jbKs80/Vm3XxsOhcl5jLC3sARxLViedoi VUy7FtKAWwNYp2kJ+TjRTiXsGU4wciRPk9TYFm6feA1xlWZrwqJVQXHXx29vDmWsGiBn pfmdr9EyPEOuBrRknoPqypB6Wlp8izZMLMXFl8NysWzaB312rHGkljGuI0kLZsPnNyxV ZlVk831notym+7Ik+g5JDITErHckyqRHD+InNUwUJJtUtu2VD6GNoZnu6yp/PvLc9z0r decg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AL6OdpOhbzKn/87jc022hXr2EgRyV8uRLoLEER7AxGE=; b=dEu1dXuL0HPbqhUU6bgSvwp2C4VQoEbg1SYenrwwcHR0oZusw7uunzKeWfIwqpABeo HgQF6vhZcAgiBMaziXLdTrs9VzmXKxLNaCr+SODCcE36r/aVtN3OV+mxhAky0HexhzsO u2LlF0JzeieR8swQrdx3TZFGUS22t5dZWtHMa1BWHkSTqSiPmwrl/aUUh9TptWuMuVCA jKpoGt0YtYtijZh4qMcIBjzGQ7yig5y+rRL+Jf7UncK9B44G6bzAehzg6huNfczWX6mn y9/iFGeeXLkklS1PsZelrIInifda0QRhhw71ROIlxfZ1nZ4nUmiwQjDnDg6xJxKL+W5h heuQ== X-Gm-Message-State: APjAAAXKzKmB2g3dAqvYDcBU+ra3bUYA8yj1G1ZbkyeOcwMUpxFdSh8d F/2JRjmU3WytEiHvvOwT36q7yct+ X-Google-Smtp-Source: APXvYqzzHNMtt9y+d3XKEMXk2wVMZ2tunJc0GSqfpuKnpHa6vnyloKvuV2TWN5oMKytM7FOPdv+ggQ== X-Received: by 2002:adf:a4c9:: with SMTP id h9mr14341179wrb.254.1551756022449; Mon, 04 Mar 2019 19:20:22 -0800 (PST) From: Lin Ma To: libvir-list@redhat.com Date: Tue, 5 Mar 2019 11:17:39 +0800 Message-Id: <20190305031739.10600-5-lma@suse.com> In-Reply-To: <20190305031739.10600-1-lma@suse.com> References: <20190305031739.10600-1-lma@suse.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 05 Mar 2019 03:20:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 05 Mar 2019 03:20:24 +0000 (UTC) for IP:'209.85.221.50' DOMAIN:'mail-wr1-f50.google.com' HELO:'mail-wr1-f50.google.com' FROM:'morecache@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.24 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.221.50 mail-wr1-f50.google.com 209.85.221.50 mail-wr1-f50.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [PATCH 4/4] virsh: Add event name completion to 'network-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: , 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.26]); Tue, 05 Mar 2019 03:20:37 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-completer.c | 27 +++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-network.c | 1 + 3 files changed, 32 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 7c68e2e832..c4adbb70d0 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -27,6 +27,7 @@ #include "virsh-nodedev.h" #include "virsh-util.h" #include "virsh-secret.h" +#include "virsh-network.h" #include "internal.h" #include "virutil.h" #include "viralloc.h" @@ -415,6 +416,32 @@ virshNetworkNameCompleter(vshControl *ctl, } =20 =20 +char ** +virshNetworkEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (VIR_ALLOC_N(ret, VIR_NETWORK_EVENT_ID_LAST + 1) < 0) + goto error; + + for (i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) { + if (VIR_STRDUP(ret[i], virshNetworkEventCallbacks[i].name) < 0) + goto error; + } + + return ret; + + error: + virStringListFree(ret); + return NULL; +} + + char ** virshNodeDeviceNameCompleter(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED, diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 4563fd76ac..2e2e1edafb 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -55,6 +55,10 @@ char ** virshNetworkNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshNetworkEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + char ** virshNodeDeviceNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); diff --git a/tools/virsh-network.c b/tools/virsh-network.c index d5b3649050..9adc63a8fa 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1216,6 +1216,7 @@ static const vshCmdOptDef opts_network_event[] =3D { VIRSH_COMMON_OPT_NETWORK_OT_STRING(N_("filter by network name or uuid"= ), 0), {.name =3D "event", .type =3D VSH_OT_STRING, + .completer =3D virshNetworkEventNameCompleter, .help =3D N_("which event type to wait for") }, {.name =3D "loop", --=20 2.19.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list