render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
0a7476
From ded068e44e8c6e01774e9fe9a802fb9a370a4945 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <ded068e44e8c6e01774e9fe9a802fb9a370a4945@dist-git>
0a7476
From: John Ferlan <jferlan@redhat.com>
0a7476
Date: Wed, 3 Apr 2019 09:57:30 -0400
0a7476
Subject: [PATCH] virsh: Add source-protocol-ver for pool commands
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
https://bugzilla.redhat.com/show_bug.cgi?id=1584663
0a7476
0a7476
Allow the addition of the <protocol ver='n'/> to the provided XML.
0a7476
0a7476
Signed-off-by: John Ferlan <jferlan@redhat.com>
0a7476
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
0a7476
(cherry picked from commit a3dbaa364721ae7bc7b8ae700091bf05392818f7)
0a7476
Message-Id: <20190403135730.2551-3-jferlan@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
---
0a7476
 tools/virsh-pool.c | 12 ++++++++++--
0a7476
 tools/virsh.pod    |  5 +++++
0a7476
 2 files changed, 15 insertions(+), 2 deletions(-)
0a7476
0a7476
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
0a7476
index 6faff781b2..14f9a03396 100644
0a7476
--- a/tools/virsh-pool.c
0a7476
+++ b/tools/virsh-pool.c
0a7476
@@ -140,6 +140,10 @@
0a7476
     {.name = "adapter-parent-fabric-wwn", \
0a7476
      .type = VSH_OT_STRING, \
0a7476
      .help = N_("adapter parent scsi_hostN fabric_wwn to be used for underlying vHBA storage") \
0a7476
+    }, \
0a7476
+    {.name = "source-protocol-ver", \
0a7476
+     .type = VSH_OT_STRING, \
0a7476
+     .help = N_("nfsvers value for NFS pool mount option") \
0a7476
     }
0a7476
 
0a7476
 virStoragePoolPtr
0a7476
@@ -323,7 +327,7 @@ virshBuildPoolXML(vshControl *ctl,
0a7476
                *secretUsage = NULL, *adapterName = NULL, *adapterParent = NULL,
0a7476
                *adapterWwnn = NULL, *adapterWwpn = NULL, *secretUUID = NULL,
0a7476
                *adapterParentWwnn = NULL, *adapterParentWwpn = NULL,
0a7476
-               *adapterParentFabricWwn = NULL;
0a7476
+               *adapterParentFabricWwn = NULL, *protoVer = NULL;
0a7476
     virBuffer buf = VIR_BUFFER_INITIALIZER;
0a7476
 
0a7476
     VSH_EXCLUSIVE_OPTIONS("secret-usage", "secret-uuid");
0a7476
@@ -349,7 +353,8 @@ virshBuildPoolXML(vshControl *ctl,
0a7476
         vshCommandOptStringReq(ctl, cmd, "adapter-parent", &adapterParent) < 0 ||
0a7476
         vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwnn", &adapterParentWwnn) < 0 ||
0a7476
         vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwpn", &adapterParentWwpn) < 0 ||
0a7476
-        vshCommandOptStringReq(ctl, cmd, "adapter-parent-fabric-wwn", &adapterParentFabricWwn) < 0)
0a7476
+        vshCommandOptStringReq(ctl, cmd, "adapter-parent-fabric-wwn", &adapterParentFabricWwn) < 0 ||
0a7476
+        vshCommandOptStringReq(ctl, cmd, "source-protocol-ver", &protoVer) < 0)
0a7476
         goto cleanup;
0a7476
 
0a7476
     virBufferAsprintf(&buf, "<pool type='%s'>\n", type);
0a7476
@@ -398,6 +403,9 @@ virshBuildPoolXML(vshControl *ctl,
0a7476
         if (srcName)
0a7476
             virBufferAsprintf(&buf, "<name>%s</name>\n", srcName);
0a7476
 
0a7476
+        if (protoVer)
0a7476
+            virBufferAsprintf(&buf, "<protocol ver='%s'/>\n", protoVer);
0a7476
+
0a7476
         virBufferAdjustIndent(&buf, -2);
0a7476
         virBufferAddLit(&buf, "</source>\n");
0a7476
     }
0a7476
diff --git a/tools/virsh.pod b/tools/virsh.pod
0a7476
index 79d1efa955..ba35723a4a 100644
0a7476
--- a/tools/virsh.pod
0a7476
+++ b/tools/virsh.pod
0a7476
@@ -3843,6 +3843,7 @@ just I<--build> is provided, then B<pool-build> is called with no flags.
0a7476
 [I<--source-name name>] [I<--target path>] [I<--source-format format>]
0a7476
 [I<--auth-type authtype> I<--auth-username username>
0a7476
 [I<--secret-usage usage> | I<--secret-uuid uuid>]]
0a7476
+[I<--source-protocol-ver ver>]
0a7476
 [[I<--adapter-name name>] | [I<--adapter-wwnn> wwnn I<--adapter-wwpn> wwpn]
0a7476
 [I<--adapter-parent parent> |
0a7476
  I<--adapter-parent-wwnn parent_wwnn> I<adapter-parent-wwpn parent_wwpn> |
0a7476
@@ -3885,6 +3886,10 @@ the storage pool. The I<authtype> is either chap for iscsi I<type> pools or
0a7476
 ceph for rbd I<type> pools. Either the secret I<usage> or I<uuid> value may
0a7476
 be provided, but not both.
0a7476
 
0a7476
+[I<--source-protocol-ver ver>] provides the NFS protocol version number used
0a7476
+to contact the server's NFS service via nfs mount option 'nfsvers=n'. It is
0a7476
+expect the I<ver> value is an unsigned integer.
0a7476
+
0a7476
 [I<--adapter-name name>] defines the scsi_hostN adapter name to be used for
0a7476
 the scsi_host adapter type pool.
0a7476
 
0a7476
-- 
0a7476
2.21.0
0a7476