[libvirt] [PATCH v3 06/11] virsh: Add source-protocol-ver for pool commands

John Ferlan jferlan at redhat.com
Wed Jan 16 01:09:17 UTC 2019


Allow the addition of the <protocol ver='n'/> to the provided XML.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 tools/virsh-pool.c | 13 +++++++++++--
 tools/virsh.pod    |  6 +++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 79b33a8885..581fd06380 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -140,6 +140,10 @@
     {.name = "source-mount-opts", \
      .type = VSH_OT_STRING, \
      .help = N_("comma separated list for NFS pool mount options") \
+    }, \
+    {.name = "source-protocol-ver", \
+     .type = VSH_OT_STRING, \
+     .help = N_("nfsvers value for NFS pool mount option") \
     }
 
 virStoragePoolPtr
@@ -323,7 +327,8 @@ virshBuildPoolXML(vshControl *ctl,
                *secretUsage = NULL, *adapterName = NULL, *adapterParent = NULL,
                *adapterWwnn = NULL, *adapterWwpn = NULL, *secretUUID = NULL,
                *adapterParentWwnn = NULL, *adapterParentWwpn = NULL,
-               *adapterParentFabricWwn = NULL, *mountOpts = NULL;
+               *adapterParentFabricWwn = NULL, *mountOpts = NULL,
+               *protoVer = NULL;
     size_t noptsList = 0;
     char **optsList = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -352,7 +357,8 @@ virshBuildPoolXML(vshControl *ctl,
         vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwnn", &adapterParentWwnn) < 0 ||
         vshCommandOptStringReq(ctl, cmd, "adapter-parent-wwpn", &adapterParentWwpn) < 0 ||
         vshCommandOptStringReq(ctl, cmd, "adapter-parent-fabric-wwn", &adapterParentFabricWwn) < 0 ||
-        vshCommandOptStringReq(ctl, cmd, "source-mount-opts", &mountOpts) < 0)
+        vshCommandOptStringReq(ctl, cmd, "source-mount-opts", &mountOpts) < 0 ||
+        vshCommandOptStringReq(ctl, cmd, "source-protocol-ver", &protoVer) < 0)
         goto cleanup;
 
     if (mountOpts &&
@@ -406,6 +412,9 @@ virshBuildPoolXML(vshControl *ctl,
         if (srcName)
             virBufferAsprintf(&buf, "<name>%s</name>\n", srcName);
 
+        if (protoVer)
+            virBufferAsprintf(&buf, "<protocol ver='%s'/>\n", protoVer);
+
         if (mountOpts) {
             size_t i;
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 718efcb07e..95e01a0aa5 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -3887,7 +3887,7 @@ just I<--build> is provided, then B<pool-build> is called with no flags.
 [I<--source-name name>] [I<--target path>] [I<--source-format format>]
 [I<--auth-type authtype> I<--auth-username username>
 [I<--secret-usage usage> | I<--secret-uuid uuid>]]
-[I<--source-mount-opts mountOpts>]
+[I<--source-protocol-ver ver>] [I<--source-mount-opts mountOpts>]
 [[I<--adapter-name name>] | [I<--adapter-wwnn> wwnn I<--adapter-wwpn> wwpn]
 [I<--adapter-parent parent> |
  I<--adapter-parent-wwnn parent_wwnn> I<adapter-parent-wwpn parent_wwpn> |
@@ -3930,6 +3930,10 @@ the storage pool. The I<authtype> is either chap for iscsi I<type> pools or
 ceph for rbd I<type> pools. Either the secret I<usage> or I<uuid> value may
 be provided, but not both.
 
+[I<--source-protocol-ver ver>] provides the NFS protocol version number used
+to contact the server's NFS service via nfs mount option 'nfsvers=n'. It is
+expect the I<ver> value is an unsigned integer.
+
 [I<--source-mount-opts mountOpts>] provides a string to be used when creating
 the mount command for a netfs type pool. The I<mountOpts> must be in a comma
 separated list format. Valid I<mountOpts> that may be provided are "nosuid",
-- 
2.20.1




More information about the libvir-list mailing list