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