From nobody Wed May 14 01:44:36 2025 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 1527057377545451.1773450962379; Tue, 22 May 2018 23:36:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D32DC3E316; Wed, 23 May 2018 06:36:14 +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 9809D308BDA1; Wed, 23 May 2018 06:36:14 +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 0F38D18033F1; Wed, 23 May 2018 06:36:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4N6a0l5017199 for ; Wed, 23 May 2018 02:36:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5537460BEB; Wed, 23 May 2018 06:36:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48D58610C8; Wed, 23 May 2018 06:35:56 +0000 (UTC) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) (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 BB612C004A89; Wed, 23 May 2018 06:35:45 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id p9-v6so8945818pgc.9; Tue, 22 May 2018 23:35:45 -0700 (PDT) Received: from localhost.localdomain ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id g64-v6sm34500852pfd.50.2018.05.22.23.35.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 23:35:44 -0700 (PDT) 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; bh=+RJcYhhQiex4cT2bZJAA43677+OgU88DQyntDQQ8bzA=; b=Bd5xcS0O/Gyh7PoVVKN+Sk8btRZ4VNazC6vzzYOAEhbU2YkydVotrvIDyk28MQQpYP QmMsAFIlIqBMnBRYAZ9uOxCaT3Qvna9DegdK8SXd8MizGo8hcXj4k+T/0X33QD3zZwHK uTui8Acv0ieW9l7TLhNLUoobTGGRXH8qSTgYjBt5/kv3/5Mo+gINcPsIoyz20wzqAAnX 4Z6Yc8iQ6aHSp8jgiZKnevN95Ggirkk7DQu4CxvohLq136NC+MZCZR/zzbX80SB616Ie 4celdbrBrgzvuZ5U8ptPoEDncIrLQHk6dc3yMQ5bjDTAJoOj/eKwUxWSHEpcpwidlSwx x8iA== 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; bh=+RJcYhhQiex4cT2bZJAA43677+OgU88DQyntDQQ8bzA=; b=tFLZzXsiQKYpsuXFgzz538/l3PVaAjm/Hs0SufdpHATT4LLj4TRclZnFVMqIMIDA5g LAmqNgaysMQJptFHRf52Qns80agUuU9I9gpFhvzpyXbRRnKI5YFcHQC3nqGo73v1+wtV xW2f4UsOtp6PuBVNzaFYd68xob76PKT+i3CvmU2JB54wZwJcqpukxy84evDNe5QlDI9V cOk+wNomxkyCbgBM1UNVKY3z/SRJGEWFRN1vpcW+LtfeT73Cs3QOavdEGKscPhSIEF0m xAcKkOdqJqvXgEKRYAiHIXgEBzs5tyXsASPsLS7Ezsk2bRziuXOa/CyQkqXJt4t/YTym WxAg== X-Gm-Message-State: ALKqPwdhwxAnmNRoeM9Qg1P+4QkEIzsEmJne9k1Ec4Yu82D2a3uVM1Ba 7CMC3Yr7HgSahd1WL8VEdiSnWw== X-Google-Smtp-Source: AB8JxZr+Sc4XeaQaqtRlmBceg5voJJWBSvhgZEcOrrDmO6xJRINfbSKUVCcX3nlUNx02cesJG+RT6A== X-Received: by 2002:a62:3745:: with SMTP id e66-v6mr1604652pfa.43.1527057344991; Tue, 22 May 2018 23:35:44 -0700 (PDT) From: Lin Ma To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:32:44 +0800 Message-Id: <20180523063246.3742-7-lma@suse.com> In-Reply-To: <20180523063246.3742-1-lma@suse.com> References: <20180523063246.3742-1-lma@suse.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 23 May 2018 06:35:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 23 May 2018 06:35:45 +0000 (UTC) for IP:'74.125.83.66' DOMAIN:'mail-pg0-f66.google.com' HELO:'mail-pg0-f66.google.com' FROM:'morecache@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.58 (DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 74.125.83.66 mail-pg0-f66.google.com 74.125.83.66 mail-pg0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma Subject: [libvirt] [ [PATCH v3 6/8] virsh: Add event name completion to 'pool-event' command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 23 May 2018 06:36:16 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-completer.c | 30 ++++++++++++++++++++++++++++++ tools/virsh-completer.h | 4 ++++ tools/virsh-pool.c | 1 + 3 files changed, 35 insertions(+) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index c0c3c5571a..1fab758e12 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -707,3 +707,33 @@ virshEventNameCompleter(vshControl *ctl, virStringListFree(ret); return NULL; } + + +char ** +virshPoolEventNameCompleter(vshControl *ctl, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virshControlPtr priv =3D ctl->privData; + size_t i =3D 0; + char **ret =3D NULL; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST) < 0) + goto error; + + for (i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) { + if (VIR_STRDUP(ret[i], vshPoolEventCallbacks[i].name) < 0) + goto error; + } + + return ret; + + error: + virStringListFree(ret); + return NULL; +} diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h index 9f8dc3dfa8..76fa31cb47 100644 --- a/tools/virsh-completer.h +++ b/tools/virsh-completer.h @@ -85,4 +85,8 @@ char ** virshSecretEventNameCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); =20 +char ** virshPoolEventNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + #endif diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index f0544d2e2d..5f59e35894 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -2098,6 +2098,7 @@ static const vshCmdOptDef opts_pool_event[] =3D { }, {.name =3D "event", .type =3D VSH_OT_STRING, + .completer =3D virshPoolEventNameCompleter, .help =3D N_("which event type to wait for") }, {.name =3D "loop", --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list