<div dir="ltr">Hi,<div><br></div><div>Updating the list with some test results of the base VxHS functionality (without TLS), and some changes resulting therefrom -</div><div><br></div><div>(A) Qemu did not work with the changed <span style="font-size:12.800000190734863px">file.</span><wbr style="font-size:12.800000190734863px"><span style="font-size:12.800000190734863px">server.0.host=127.0.0.1 </span>syntax. Threw an error "<span style="font-size:12.800000190734863px">Parameter 'server.host' is missing". Whereas the old syntax file.server.host=.. works fine. VxHS protocol accepts only one host, therefore during the qemu development, it was decided to drop the redundant index 0.</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">(B) In response to (1), we are reverting the syntax back to the format </span><span style="font-size:12.800000190734863px">file.</span><wbr style="font-size:12.800000190734863px"><span style="font-size:12.800000190734863px">server.host=1.2.3.4. I have tested with this modification and results look good. John has kindly offered to refine those changes and include it in the next patch series.</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">(C) </span><span style="font-size:12.800000190734863px">My testing was focussed on making sure that the libvirt changes work with qemu and we are able to read/write to a VxHS disk.</span></div><div style="font-size:12.800000190734863px">Essentially I wanted to check libvirt <=> qemu <=> vxhs functionality on a real guest VM.</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">Here's what I did -<br><br><ol><li style="margin-left:15px">On my physical system running FC23 stock qemu and libvirt.<br></li><li style="margin-left:15px">Built and installed the latest VxHS libqnio from github repo.<br></li><li style="margin-left:15px">Created a test VxHS file /tmp/test_vxhs_disk_1 that qemu can write/read to.<br></li><li style="margin-left:15px">Started the test VxHS server.<br></li><li style="margin-left:15px">Built and installed the latest qemu after cloning from master repo enabling vxhs support.<br></li><li style="margin-left:15px">Ensured that I was able to start one of my existing VM using my custom build qemu.<br></li><li style="margin-left:15px">Was able to start the guest VM directly using the qemu command line after adding the vxhs device. This is what I used to check the file.server.host syntax.</li><li style="margin-left:15px">Built and installed latest libvirt with our patches (including the change to generate file.server.host)</li><li style="margin-left:15px">Did a virsh edit on my VM and added a VxHS device to the existing XML.<br></li><li style="margin-left:15px">Started and logged in to the VM. <br></li><li style="margin-left:15px">Created a new label on the disk hosted by /tmp/test_vxhs_disk_1 vxhs server. <br></li><li style="margin-left:15px">Created ext2fs on the disk. Mounted it and copied/removed some files from the FS.</li></ol><div>(D) Tested hot plug/unplug using virsh attach-device/detach-device back-to-back and this works fine.</div><div><br></div><div>IMO, patches 1-6 with the above adjustments are good to go.</div><div><br></div><div>Regards,</div><div>Ashish</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 1, 2017 at 10:09 AM, John Ferlan <span dir="ltr"><<a href="mailto:jferlan@redhat.com" target="_blank">jferlan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ashish Mittal <<a href="mailto:Ashish.Mittal@veritas.com">Ashish.Mittal@veritas.com</a>><br>
<br>
The VxHS block device will only use the newer formatting options and<br>
avoid the legacy URI syntax.<br>
<br>
An excerpt for a sample QEMU command line is:<br>
<br>
  -drive file.driver=vxhs,file.vdisk-<wbr>id=eb90327c-8302-4725-9e1b-<wbr>4e85ed4dc251,\<br>
   file.server.0.type=tcp,file.<wbr>server.0.host=192.168.0.1,\<br>
   file.server.0.port=9999,<wbr>format=raw,if=none,id=drive-<wbr>virtio-disk0,cache=none \<br>
  -device virtio-blk-pci,bus=pci.0,addr=<wbr>0x4,drive=drive-virtio-disk0,\<br>
   id=virtio-disk0<br>
<br>
Update qemuxml2argvtest with a simple test.<br>
<br>
Signed-off-by: Ashish Mittal <<a href="mailto:Ashish.Mittal@veritas.com">Ashish.Mittal@veritas.com</a>><br>
Signed-off-by: John Ferlan <<a href="mailto:jferlan@redhat.com">jferlan@redhat.com</a>><br>
---<br>
 src/qemu/qemu_block.c                              | 37 +++++++++++++++++++++-<br>
 src/qemu/qemu_command.c                            | 10 +++++-<br>
 src/qemu/qemu_parse_command.c                      | 16 +++++++++-<br>
 src/qemu/qemu_process.c                            | 29 +++++++++++++++++<br>
 .../qemuxml2argv-disk-drive-<wbr>network-vxhs.args      | 27 ++++++++++++++++<br>
 tests/qemuxml2argvtest.c                           |  1 +<br>
 6 files changed, 117 insertions(+), 3 deletions(-)<br>
 create mode 100644 tests/qemuxml2argvdata/<wbr>qemuxml2argv-disk-drive-<wbr>network-vxhs.args<br>
<br>
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c<br>
index d07269f..f5269fb 100644<br>
--- a/src/qemu/qemu_block.c<br>
+++ b/src/qemu/qemu_block.c<br>
@@ -482,6 +482,37 @@ qemuBlockStorageSourceGetGlust<wbr>erProps(virStorageSourcePtr src)<br>
 }<br>
<br>
<br>
+static virJSONValuePtr<br>
+<wbr>qemuBlockStorageSourceGetVxHSP<wbr>rops(virStorageSourcePtr src)<br>
+{<br>
+    const char *protocol = virStorageNetProtocolTypeToStr<wbr>ing(src->protocol);<br>
+    virJSONValuePtr server = NULL;<br>
+    virJSONValuePtr ret = NULL;<br>
+<br>
+    if (src->nhosts != 1) {<br>
+        virReportError(VIR_ERR_<wbr>INTERNAL_ERROR, "%s",<br>
+                       _("VxHS protocol accepts only one host"));<br>
+        return NULL;<br>
+    }<br>
+<br>
+    if (!(server = qemuBlockStorageSourceBuildHos<wbr>tsJSONSocketAddress(src, true)))<br>
+        return NULL;<br>
+<br>
+    /* VxHS disk specification example:<br>
+     * { driver:"vxhs",<br>
+     *   vdisk-id:"eb90327c-8302-4725-<wbr>4e85ed4dc251",<br>
+     *   server:[{type:"tcp", host:"1.2.3.4", port:9999}]}<br>
+     */<br>
+    if (virJSONValueObjectCreate(&<wbr>ret,<br>
+                                 "s:driver", protocol,<br>
+                                 "s:vdisk-id", src->path,<br>
+                                 "a:server", server, NULL) < 0)<br>
+        virJSONValueFree(server);<br>
+<br>
+    return ret;<br>
+}<br>
+<br>
+<br>
 /**<br>
  * qemuBlockStorageSourceGetBacke<wbr>ndProps:<br>
  * @src: disk source<br>
@@ -512,6 +543,11 @@ qemuBlockStorageSourceGetBacke<wbr>ndProps(virStorageSourcePtr src)<br>
                 goto cleanup;<br>
             break;<br>
<br>
+        case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+            if (!(fileprops = qemuBlockStorageSourceGetVxHSP<wbr>rops(src)))<br>
+                goto cleanup;<br>
+            break;<br>
+<br>
         case VIR_STORAGE_NET_PROTOCOL_NBD:<br>
         case VIR_STORAGE_NET_PROTOCOL_RBD:<br>
         case VIR_STORAGE_NET_PROTOCOL_<wbr>SHEEPDOG:<br>
@@ -522,7 +558,6 @@ qemuBlockStorageSourceGetBacke<wbr>ndProps(virStorageSourcePtr src)<br>
         case VIR_STORAGE_NET_PROTOCOL_FTPS:<br>
         case VIR_STORAGE_NET_PROTOCOL_TFTP:<br>
         case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
-        case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
         case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
             break;<br>
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c<br>
index b7a896e..b9e2ab3 100644<br>
--- a/src/qemu/qemu_command.c<br>
+++ b/src/qemu/qemu_command.c<br>
@@ -991,12 +991,16 @@ qemuBuildNetworkDriveStr(<wbr>virStorageSourcePtr src,<br>
             ret = virBufferContentAndReset(&buf)<wbr>;<br>
             break;<br>
<br>
+        case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+            virReportError(VIR_ERR_<wbr>INTERNAL_ERROR, "%s",<br>
+                           _("VxHS protocol does not support URI syntax"));<br>
+            goto cleanup;<br>
+<br>
         case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
             virReportError(VIR_ERR_<wbr>INTERNAL_ERROR, "%s",<br>
                            _("'ssh' protocol is not yet supported"));<br>
             goto cleanup;<br>
<br>
-        case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
         case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
         case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
             virReportError(VIR_ERR_<wbr>INTERNAL_ERROR,<br>
@@ -1326,6 +1330,10 @@ qemuDiskSourceNeedsProps(<wbr>virStorageSourcePtr src)<br>
         src->nhosts > 1)<br>
         return true;<br>
<br>
+    if (actualType == VIR_STORAGE_TYPE_NETWORK &&<br>
+        src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS)<br>
+        return true;<br>
+<br>
     return false;<br>
 }<br>
<br>
diff --git a/src/qemu/qemu_parse_command.<wbr>c b/src/qemu/qemu_parse_command.<wbr>c<br>
index 9190a37..6286c2e 100644<br>
--- a/src/qemu/qemu_parse_command.<wbr>c<br>
+++ b/src/qemu/qemu_parse_command.<wbr>c<br>
@@ -736,6 +736,11 @@ qemuParseCommandLineDisk(<wbr>virDomainXMLOptionPtr xmlopt,<br>
                         if (VIR_STRDUP(def->src->path, vdi) < 0)<br>
                             goto error;<br>
                     }<br>
+                } else if (STRPREFIX(def->src->path, "vxhs:")) {<br>
+                    virReportError(VIR_ERR_<wbr>INTERNAL_ERROR,<br>
+                                   _("VxHS protocol does not support URI syntax '%s'"),<br>
+                                   def->src->path);<br>
+                    goto error;<br>
                 } else {<br>
                     def->src->type = VIR_STORAGE_TYPE_FILE;<br>
                 }<br>
@@ -1944,6 +1949,10 @@ qemuParseCommandLine(<wbr>virCapsPtr caps,<br>
                 disk->src->type = VIR_STORAGE_TYPE_NETWORK;<br>
                 disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_<wbr>SHEEPDOG;<br>
                 val += strlen("sheepdog:");<br>
+            } else if (STRPREFIX(val, "vxhs:")) {<br>
+                disk->src->type = VIR_STORAGE_TYPE_NETWORK;<br>
+                disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_VXHS;<br>
+                val += strlen("vxhs:");<br>
             } else {<br>
                 disk->src->type = VIR_STORAGE_TYPE_FILE;<br>
             }<br>
@@ -2020,13 +2029,18 @@ qemuParseCommandLine(<wbr>virCapsPtr caps,<br>
                         goto error;<br>
<br>
                     break;<br>
+                case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
+                    virReportError(VIR_ERR_<wbr>INTERNAL_ERROR,<br>
+                                   _("VxHS protocol does not support URI "<br>
+                                   "syntax '%s'"), disk->src->path);<br>
+                    goto error;<br>
+                    break;<br>
                 case VIR_STORAGE_NET_PROTOCOL_HTTP:<br>
                 case VIR_STORAGE_NET_PROTOCOL_<wbr>HTTPS:<br>
                 case VIR_STORAGE_NET_PROTOCOL_FTP:<br>
                 case VIR_STORAGE_NET_PROTOCOL_FTPS:<br>
                 case VIR_STORAGE_NET_PROTOCOL_TFTP:<br>
                 case VIR_STORAGE_NET_PROTOCOL_SSH:<br>
-                case VIR_STORAGE_NET_PROTOCOL_VXHS:<br>
                 case VIR_STORAGE_NET_PROTOCOL_LAST:<br>
                 case VIR_STORAGE_NET_PROTOCOL_NONE:<br>
                     /* ignored for now */<br>
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c<br>
index 364c359..0ed5d04 100644<br>
--- a/src/qemu/qemu_process.c<br>
+++ b/src/qemu/qemu_process.c<br>
@@ -4582,6 +4582,32 @@ qemuProcessStartValidateShmem(<wbr>virDomainObjPtr vm)<br>
<br>
<br>
 static int<br>
+<wbr>qemuProcessStartValidateDisks(<wbr>virDomainObjPtr vm,<br>
+                              virQEMUCapsPtr qemuCaps)<br>
+{<br>
+    size_t i;<br>
+<br>
+    for (i = 0; i < vm->def->ndisks; i++) {<br>
+        virStorageSourcePtr src = vm->def->disks[i]->src;<br>
+<br>
+        /* This is a best effort check as we can only check if the command<br>
+         * option exists, but we cannot determine whether the running QEMU<br>
+         * was build with '--enable-vxhs'. */<br>
+        if (src->type == VIR_STORAGE_TYPE_NETWORK &&<br>
+            src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&<br>
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VXHS)) {<br>
+            virReportError(VIR_ERR_CONFIG_<wbr>UNSUPPORTED, "%s",<br>
+                           _("VxHS protocol is not supported with this "<br>
+                             "QEMU binary"));<br>
+            return -1;<br>
+        }<br>
+    }<br>
+<br>
+    return 0;<br>
+}<br>
+<br>
+<br>
+static int<br>
 qemuProcessStartValidateXML(<wbr>virQEMUDriverPtr driver,<br>
                             virDomainObjPtr vm,<br>
                             virQEMUCapsPtr qemuCaps,<br>
@@ -4663,6 +4689,9 @@ qemuProcessStartValidate(<wbr>virQEMUDriverPtr driver,<br>
     if (<wbr>qemuProcessStartValidateShmem(<wbr>vm) < 0)<br>
         return -1;<br>
<br>
+    if (<wbr>qemuProcessStartValidateDisks(<wbr>vm, qemuCaps) < 0)<br>
+        return -1;<br>
+<br>
     VIR_DEBUG("Checking for any possible (non-fatal) issues");<br>
<br>
     qemuProcessStartWarnShmem(vm);<br>
diff --git a/tests/qemuxml2argvdata/<wbr>qemuxml2argv-disk-drive-<wbr>network-vxhs.args b/tests/qemuxml2argvdata/<wbr>qemuxml2argv-disk-drive-<wbr>network-vxhs.args<br>
new file mode 100644<br>
index 0000000..86da1af<br>
--- /dev/null<br>
+++ b/tests/qemuxml2argvdata/<wbr>qemuxml2argv-disk-drive-<wbr>network-vxhs.args<br>
@@ -0,0 +1,27 @@<br>
+LC_ALL=C \<br>
+PATH=/bin \<br>
+HOME=/home/test \<br>
+USER=test \<br>
+LOGNAME=test \<br>
+QEMU_AUDIO_DRV=none \<br>
+/usr/bin/qemu-system-x86_64 \<br>
+-name QEMUGuest1 \<br>
+-S \<br>
+-M pc \<br>
+-cpu qemu32 \<br>
+-m 214 \<br>
+-smp 1,sockets=1,cores=1,threads=1 \<br>
+-uuid c7a5fdbd-edaf-9455-926a-<wbr>d65c16db1809 \<br>
+-nographic \<br>
+-nodefaults \<br>
+-chardev socket,id=charmonitor,path=/<wbr>tmp/lib/domain--1-QEMUGuest1/<wbr>monitor.sock,\<br>
+server,nowait \<br>
+-mon chardev=charmonitor,id=<wbr>monitor,mode=readline \<br>
+-no-acpi \<br>
+-boot c \<br>
+-usb \<br>
+-drive file.driver=vxhs,file.vdisk-<wbr>id=eb90327c-8302-4725-9e1b-<wbr>4e85ed4dc251,\<br>
+file.server.0.type=tcp,file.<wbr>server.0.host=192.168.0.1,<wbr>file.server.0.port=9999,\<br>
+format=raw,if=none,id=drive-<wbr>virtio-disk0,cache=none \<br>
+-device virtio-blk-pci,bus=pci.0,addr=<wbr>0x4,drive=drive-virtio-disk0,\<br>
+id=virtio-disk0<br>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c<br>
index 18f06e5..b92ded8 100644<br>
--- a/tests/qemuxml2argvtest.c<br>
+++ b/tests/qemuxml2argvtest.c<br>
@@ -931,6 +931,7 @@ mymain(void)<br>
 # endif<br>
     DO_TEST("disk-drive-network-<wbr>rbd-ipv6", NONE);<br>
     DO_TEST_FAILURE("disk-drive-<wbr>network-rbd-no-colon", NONE);<br>
+    DO_TEST("disk-drive-network-<wbr>vxhs", QEMU_CAPS_VXHS);<br>
     DO_TEST("disk-drive-no-boot",<br>
             QEMU_CAPS_BOOTINDEX);<br>
     DO_TEST_PARSE_ERROR("disk-<wbr>device-lun-type-invalid",<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.5<br>
<br>
</font></span></blockquote></div><br></div>