From nobody Thu May 2 18:24:43 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 1504637451007352.4288007877866; Tue, 5 Sep 2017 11:50:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C8987D0CA; Tue, 5 Sep 2017 18:50:49 +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 9BBEF7EF80; Tue, 5 Sep 2017 18:50:48 +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 C87FF4EE50; Tue, 5 Sep 2017 18:50:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v85Ih20P030032 for ; Tue, 5 Sep 2017 14:43:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6B037EF87; Tue, 5 Sep 2017 18:43:02 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-120.phx2.redhat.com [10.3.116.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF6D27EF80 for ; Tue, 5 Sep 2017 18:43:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2C8987D0CA Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Tue, 5 Sep 2017 14:42:58 -0400 Message-Id: <20170905184258.11674-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virsh: Add/allow secret-uuid for pool-{define|create}-as 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]); Tue, 05 Sep 2017 18:50:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1476775 For the virsh pool-{define|create}-as command, let's allow using --secret-uuid on the command line as an alternative to --secret-usage, but ensure that they are mutually exclusive. Not sure why I neglected to add it for commit id '8932580' Signed-off-by: John Ferlan Reviewed-by: Erik Skultety (with the tiny adjustment) --- tools/virsh-pool.c | 16 +++++++++++++--- tools/virsh.pod | 9 ++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index ba9281f..03eae94 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -109,6 +109,10 @@ .type =3D VSH_OT_STRING, \ .help =3D N_("auth secret usage to be used for underlying storage") \ }, \ + {.name =3D "secret-uuid", \ + .type =3D VSH_OT_STRING, \ + .help =3D N_("auth secret UUID to be used for underlying storage") \ + }, \ {.name =3D "adapter-name", \ .type =3D VSH_OT_STRING, \ .help =3D N_("adapter name to be used for underlying storage") \ @@ -302,9 +306,11 @@ virshBuildPoolXML(vshControl *ctl, *srcDev =3D NULL, *srcName =3D NULL, *srcFormat =3D NULL, *target =3D NULL, *authType =3D NULL, *authUsername =3D NUL= L, *secretUsage =3D NULL, *adapterName =3D NULL, *adapterParen= t =3D NULL, - *adapterWwnn =3D NULL, *adapterWwpn =3D NULL; + *adapterWwnn =3D NULL, *adapterWwpn =3D NULL, *secretUUID = =3D NULL; virBuffer buf =3D VIR_BUFFER_INITIALIZER; =20 + VSH_EXCLUSIVE_OPTIONS("secret-usage", "secret-uuid"); + if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0) goto cleanup; if (vshCommandOptStringReq(ctl, cmd, "type", &type) < 0) @@ -319,6 +325,7 @@ virshBuildPoolXML(vshControl *ctl, vshCommandOptStringReq(ctl, cmd, "auth-type", &authType) < 0 || vshCommandOptStringReq(ctl, cmd, "auth-username", &authUsername) <= 0 || vshCommandOptStringReq(ctl, cmd, "secret-usage", &secretUsage) < 0= || + vshCommandOptStringReq(ctl, cmd, "secret-uuid", &secretUUID) < 0 || vshCommandOptStringReq(ctl, cmd, "adapter-name", &adapterName) < 0= || vshCommandOptStringReq(ctl, cmd, "adapter-wwnn", &adapterWwnn) < 0= || vshCommandOptStringReq(ctl, cmd, "adapter-wwpn", &adapterWwpn) < 0= || @@ -349,11 +356,14 @@ virshBuildPoolXML(vshControl *ctl, virBufferAsprintf(&buf, "\n", adapterName); } - if (authType && authUsername && secretUsage) { + if (authType && authUsername && (secretUsage || secretUUID)) { virBufferAsprintf(&buf, "\n", authType, authUsername); virBufferAdjustIndent(&buf, 2); - virBufferAsprintf(&buf, "\n", secretUsag= e); + if (secretUsage) + virBufferAsprintf(&buf, "\n", secret= Usage); + else + virBufferAsprintf(&buf, "\n", secretU= UID); virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); } diff --git a/tools/virsh.pod b/tools/virsh.pod index c13f96f..bf5a124 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -3673,7 +3673,8 @@ just I<--build> is provided, then B is ca= lled with no flags. =3Ditem B I I [I<--source-host hostname>] [I<--source-path path>] [I<--source-dev path>] [I<--source-name name>] [I<--target path>] [I<--source-format format>] -[I<--auth-type authtype> I<--auth-username username> I<--secret-usage usag= e>] +[I<--auth-type authtype> I<--auth-username username> +[I<--secret-usage usage> | I<--secret-uuid uuid>]] [[I<--adapter-name name>] | [I<--adapter-wwnn> I<--adapter-wwpn>] [I<--adapter-parent parent>]] [I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]] [I<--print-xml>] @@ -3707,10 +3708,12 @@ the host file system. [I<--source-format format>] provides information about the format of the pool (pool types fs, netfs, disk, logical). =20 -[I<--auth-type authtype> I<--auth-username username> I<--secret-usage usag= e>] +[I<--auth-type authtype> I<--auth-username username> +[I<--secret-usage usage> | I<--secret-uuid uuid>]] provides the elements required to generate authentication credentials for the storage pool. The I is either chap for iscsi I pools or -ceph for rbd I pools. +ceph for rbd I pools. Either the secret I or I value may +be provided, but not both. =20 [I<--adapter-name name>] defines the scsi_hostN adapter name to be used for the scsi_host adapter type pool. --=20 2.9.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list