From: Ashish Mittal <Ashish.Mittal@veritas.com>
The VxHS block device will only use the newer formatting options and
avoid the legacy URI syntax.
An excerpt for a sample QEMU command line is:
-drive file.driver=vxhs,file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
file.server.type=tcp,file.server.host=192.168.0.1,\
file.server.port=9999,format=raw,if=none,id=drive-virtio-disk0,cache=none \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
id=virtio-disk0
Update qemuxml2argvtest with a simple test.
Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
---
src/qemu/qemu_block.c | 37 +++++++++++++++++++++-
src/qemu/qemu_command.c | 10 +++++-
src/qemu/qemu_parse_command.c | 16 +++++++++-
src/qemu/qemu_process.c | 29 +++++++++++++++++
.../qemuxml2argv-disk-drive-network-vxhs.args | 27 ++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
6 files changed, 117 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index c97b787c5..ca6e213b4 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -516,6 +516,37 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
}
+static virJSONValuePtr
+qemuBlockStorageSourceGetVxHSProps(virStorageSourcePtr src)
+{
+ const char *protocol = virStorageNetProtocolTypeToString(src->protocol);
+ virJSONValuePtr server = NULL;
+ virJSONValuePtr ret = NULL;
+
+ if (src->nhosts != 1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VxHS protocol accepts only one host"));
+ return NULL;
+ }
+
+ if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(src->hosts, true)))
+ return NULL;
+
+ /* VxHS disk specification example:
+ * { driver:"vxhs",
+ * vdisk-id:"eb90327c-8302-4725-4e85ed4dc251",
+ * server:[{type:"tcp", host:"1.2.3.4", port:9999}]}
+ */
+ if (virJSONValueObjectCreate(&ret,
+ "s:driver", protocol,
+ "s:vdisk-id", src->path,
+ "a:server", server, NULL) < 0)
+ virJSONValueFree(server);
+
+ return ret;
+}
+
+
/**
* qemuBlockStorageSourceGetBackendProps:
* @src: disk source
@@ -546,6 +577,11 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
goto cleanup;
break;
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
+ if (!(fileprops = qemuBlockStorageSourceGetVxHSProps(src)))
+ goto cleanup;
+ break;
+
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@@ -556,7 +592,6 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_SSH:
- case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_NONE:
case VIR_STORAGE_NET_PROTOCOL_LAST:
break;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 720530daa..0a3278510 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -994,12 +994,16 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
ret = virBufferContentAndReset(&buf);
break;
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VxHS protocol does not support URI syntax"));
+ goto cleanup;
+
case VIR_STORAGE_NET_PROTOCOL_SSH:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("'ssh' protocol is not yet supported"));
goto cleanup;
- case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1329,6 +1333,10 @@ qemuDiskSourceNeedsProps(virStorageSourcePtr src)
src->nhosts > 1)
return true;
+ if (actualType == VIR_STORAGE_TYPE_NETWORK &&
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS)
+ return true;
+
return false;
}
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 9190a37ba..6286c2e7a 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -736,6 +736,11 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
if (VIR_STRDUP(def->src->path, vdi) < 0)
goto error;
}
+ } else if (STRPREFIX(def->src->path, "vxhs:")) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("VxHS protocol does not support URI syntax '%s'"),
+ def->src->path);
+ goto error;
} else {
def->src->type = VIR_STORAGE_TYPE_FILE;
}
@@ -1944,6 +1949,10 @@ qemuParseCommandLine(virCapsPtr caps,
disk->src->type = VIR_STORAGE_TYPE_NETWORK;
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_SHEEPDOG;
val += strlen("sheepdog:");
+ } else if (STRPREFIX(val, "vxhs:")) {
+ disk->src->type = VIR_STORAGE_TYPE_NETWORK;
+ disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_VXHS;
+ val += strlen("vxhs:");
} else {
disk->src->type = VIR_STORAGE_TYPE_FILE;
}
@@ -2020,13 +2029,18 @@ qemuParseCommandLine(virCapsPtr caps,
goto error;
break;
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("VxHS protocol does not support URI "
+ "syntax '%s'"), disk->src->path);
+ goto error;
+ break;
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
case VIR_STORAGE_NET_PROTOCOL_FTP:
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_SSH:
- case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
/* ignored for now */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7e9b406b6..099a770e9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4578,6 +4578,32 @@ qemuProcessStartValidateShmem(virDomainObjPtr vm)
static int
+qemuProcessStartValidateDisks(virDomainObjPtr vm,
+ virQEMUCapsPtr qemuCaps)
+{
+ size_t i;
+
+ for (i = 0; i < vm->def->ndisks; i++) {
+ virStorageSourcePtr src = vm->def->disks[i]->src;
+
+ /* This is a best effort check as we can only check if the command
+ * option exists, but we cannot determine whether the running QEMU
+ * was build with '--enable-vxhs'. */
+ if (src->type == VIR_STORAGE_TYPE_NETWORK &&
+ src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VXHS)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("VxHS protocol is not supported with this "
+ "QEMU binary"));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+static int
qemuProcessStartValidateXML(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virQEMUCapsPtr qemuCaps,
@@ -4659,6 +4685,9 @@ qemuProcessStartValidate(virQEMUDriverPtr driver,
if (qemuProcessStartValidateShmem(vm) < 0)
return -1;
+ if (qemuProcessStartValidateDisks(vm, qemuCaps) < 0)
+ return -1;
+
VIR_DEBUG("Checking for any possible (non-fatal) issues");
qemuProcessStartWarnShmem(vm);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
new file mode 100644
index 000000000..b62ace3de
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-cpu qemu32 \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file.driver=vxhs,file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
+file.server.type=tcp,file.server.host=192.168.0.1,file.server.port=9999,\
+format=raw,if=none,id=drive-virtio-disk0,cache=none \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
+id=virtio-disk0
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2c040e4c0..01a518eff 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -931,6 +931,7 @@ mymain(void)
# endif
DO_TEST("disk-drive-network-rbd-ipv6", NONE);
DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE);
+ DO_TEST("disk-drive-network-vxhs", QEMU_CAPS_VXHS);
DO_TEST("disk-drive-no-boot",
QEMU_CAPS_BOOTINDEX);
DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid",
--
2.13.5
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Sep 14, 2017 at 08:51:51 -0400, John Ferlan wrote:
> From: Ashish Mittal <Ashish.Mittal@veritas.com>
>
> The VxHS block device will only use the newer formatting options and
> avoid the legacy URI syntax.
>
> An excerpt for a sample QEMU command line is:
>
> -drive file.driver=vxhs,file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
> file.server.type=tcp,file.server.host=192.168.0.1,\
> file.server.port=9999,format=raw,if=none,id=drive-virtio-disk0,cache=none \
> -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
> id=virtio-disk0
>
> Update qemuxml2argvtest with a simple test.
>
> Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com>
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
> src/qemu/qemu_block.c | 37 +++++++++++++++++++++-
> src/qemu/qemu_command.c | 10 +++++-
> src/qemu/qemu_parse_command.c | 16 +++++++++-
> src/qemu/qemu_process.c | 29 +++++++++++++++++
> .../qemuxml2argv-disk-drive-network-vxhs.args | 27 ++++++++++++++++
> tests/qemuxml2argvtest.c | 1 +
> 6 files changed, 117 insertions(+), 3 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
>
> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> index c97b787c5..ca6e213b4 100644
> --- a/src/qemu/qemu_block.c
> +++ b/src/qemu/qemu_block.c
> @@ -516,6 +516,37 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
> }
>
>
> +static virJSONValuePtr
> +qemuBlockStorageSourceGetVxHSProps(virStorageSourcePtr src)
> +{
> + const char *protocol = virStorageNetProtocolTypeToString(src->protocol);
> + virJSONValuePtr server = NULL;
> + virJSONValuePtr ret = NULL;
> +
> + if (src->nhosts != 1) {
> + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> + _("VxHS protocol accepts only one host"));
> + return NULL;
> + }
> +
> + if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(src->hosts, true)))
> + return NULL;
This creates a json object ...
> +
> + /* VxHS disk specification example:
> + * { driver:"vxhs",
> + * vdisk-id:"eb90327c-8302-4725-4e85ed4dc251",
> + * server:[{type:"tcp", host:"1.2.3.4", port:9999}]}
... which is appended below as the 'server' field, while this example
shows an array of objects. So, which one is correct? Is this a hack to
force the JSON->commandline generator to compy? If it's so then we need
to change that and not this, since then QMP commands like 'blockdev-add'
will not accept it and thus this will be useless for expansion.
> + */
> + if (virJSONValueObjectCreate(&ret,
> + "s:driver", protocol,
> + "s:vdisk-id", src->path,
> + "a:server", server, NULL) < 0)
> + virJSONValueFree(server);
> +
> + return ret;
> +}
> +
> +
> /**
> * qemuBlockStorageSourceGetBackendProps:
> * @src: disk source
Rest looks okay
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On 09/19/2017 09:37 AM, Peter Krempa wrote:
> On Thu, Sep 14, 2017 at 08:51:51 -0400, John Ferlan wrote:
>> From: Ashish Mittal <Ashish.Mittal@veritas.com>
>>
>> The VxHS block device will only use the newer formatting options and
>> avoid the legacy URI syntax.
>>
>> An excerpt for a sample QEMU command line is:
>>
>> -drive file.driver=vxhs,file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
>> file.server.type=tcp,file.server.host=192.168.0.1,\
>> file.server.port=9999,format=raw,if=none,id=drive-virtio-disk0,cache=none \
>> -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
>> id=virtio-disk0
>>
>> Update qemuxml2argvtest with a simple test.
>>
>> Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com>
>> Signed-off-by: John Ferlan <jferlan@redhat.com>
>> ---
>> src/qemu/qemu_block.c | 37 +++++++++++++++++++++-
>> src/qemu/qemu_command.c | 10 +++++-
>> src/qemu/qemu_parse_command.c | 16 +++++++++-
>> src/qemu/qemu_process.c | 29 +++++++++++++++++
>> .../qemuxml2argv-disk-drive-network-vxhs.args | 27 ++++++++++++++++
>> tests/qemuxml2argvtest.c | 1 +
>> 6 files changed, 117 insertions(+), 3 deletions(-)
>> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
>>
>> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
>> index c97b787c5..ca6e213b4 100644
>> --- a/src/qemu/qemu_block.c
>> +++ b/src/qemu/qemu_block.c
>> @@ -516,6 +516,37 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
>> }
>>
>>
>> +static virJSONValuePtr
>> +qemuBlockStorageSourceGetVxHSProps(virStorageSourcePtr src)
>> +{
>> + const char *protocol = virStorageNetProtocolTypeToString(src->protocol);
>> + virJSONValuePtr server = NULL;
>> + virJSONValuePtr ret = NULL;
>> +
>> + if (src->nhosts != 1) {
>> + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> + _("VxHS protocol accepts only one host"));
>> + return NULL;
>> + }
>> +
>> + if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(src->hosts, true)))
>> + return NULL;
>
> This creates a json object ...
>
>> +
>> + /* VxHS disk specification example:
>> + * { driver:"vxhs",
>> + * vdisk-id:"eb90327c-8302-4725-4e85ed4dc251",
>> + * server:[{type:"tcp", host:"1.2.3.4", port:9999}]}
>
> ... which is appended below as the 'server' field, while this example
> shows an array of objects. So, which one is correct? Is this a hack to
> force the JSON->commandline generator to compy? If it's so then we need
> to change that and not this, since then QMP commands like 'blockdev-add'
> will not accept it and thus this will be useless for expansion.
>
Oh right, the [ ] is wrong as this isn't an array it's just a single
server element (as seen in patch 4)
I can remove the [ ] and I think that answers your concern. The VxHS
qemu code only likes the "server.type, server.host, and server.port"
syntax and fails on the "server.0.type", "server.0.host", and
"server.0.port" syntax.
John
>> + */
>> + if (virJSONValueObjectCreate(&ret,
>> + "s:driver", protocol,
>> + "s:vdisk-id", src->path,
>> + "a:server", server, NULL) < 0)
>> + virJSONValueFree(server);
>> +
>> + return ret;
>> +}
>> +
>> +
>> /**
>> * qemuBlockStorageSourceGetBackendProps:
>> * @src: disk source
>
> Rest looks okay
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Tue, Sep 19, 2017 at 10:15:38 -0400, John Ferlan wrote:
>
>
> On 09/19/2017 09:37 AM, Peter Krempa wrote:
> > On Thu, Sep 14, 2017 at 08:51:51 -0400, John Ferlan wrote:
> >> From: Ashish Mittal <Ashish.Mittal@veritas.com>
> >>
> >> The VxHS block device will only use the newer formatting options and
> >> avoid the legacy URI syntax.
> >>
> >> An excerpt for a sample QEMU command line is:
> >>
> >> -drive file.driver=vxhs,file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
> >> file.server.type=tcp,file.server.host=192.168.0.1,\
> >> file.server.port=9999,format=raw,if=none,id=drive-virtio-disk0,cache=none \
> >> -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
> >> id=virtio-disk0
> >>
> >> Update qemuxml2argvtest with a simple test.
> >>
> >> Signed-off-by: Ashish Mittal <Ashish.Mittal@veritas.com>
> >> Signed-off-by: John Ferlan <jferlan@redhat.com>
> >> ---
> >> src/qemu/qemu_block.c | 37 +++++++++++++++++++++-
> >> src/qemu/qemu_command.c | 10 +++++-
> >> src/qemu/qemu_parse_command.c | 16 +++++++++-
> >> src/qemu/qemu_process.c | 29 +++++++++++++++++
> >> .../qemuxml2argv-disk-drive-network-vxhs.args | 27 ++++++++++++++++
> >> tests/qemuxml2argvtest.c | 1 +
> >> 6 files changed, 117 insertions(+), 3 deletions(-)
> >> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
> >>
> >> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> >> index c97b787c5..ca6e213b4 100644
> >> --- a/src/qemu/qemu_block.c
> >> +++ b/src/qemu/qemu_block.c
> >> @@ -516,6 +516,37 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
> >> }
> >>
> >>
> >> +static virJSONValuePtr
> >> +qemuBlockStorageSourceGetVxHSProps(virStorageSourcePtr src)
> >> +{
> >> + const char *protocol = virStorageNetProtocolTypeToString(src->protocol);
> >> + virJSONValuePtr server = NULL;
> >> + virJSONValuePtr ret = NULL;
> >> +
> >> + if (src->nhosts != 1) {
> >> + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> >> + _("VxHS protocol accepts only one host"));
> >> + return NULL;
> >> + }
> >> +
> >> + if (!(server = qemuBlockStorageSourceBuildJSONSocketAddress(src->hosts, true)))
> >> + return NULL;
> >
> > This creates a json object ...
> >
> >> +
> >> + /* VxHS disk specification example:
> >> + * { driver:"vxhs",
> >> + * vdisk-id:"eb90327c-8302-4725-4e85ed4dc251",
> >> + * server:[{type:"tcp", host:"1.2.3.4", port:9999}]}
> >
> > ... which is appended below as the 'server' field, while this example
> > shows an array of objects. So, which one is correct? Is this a hack to
> > force the JSON->commandline generator to compy? If it's so then we need
> > to change that and not this, since then QMP commands like 'blockdev-add'
> > will not accept it and thus this will be useless for expansion.
> >
>
> Oh right, the [ ] is wrong as this isn't an array it's just a single
> server element (as seen in patch 4)
>
> I can remove the [ ] and I think that answers your concern. The VxHS
> qemu code only likes the "server.type, server.host, and server.port"
> syntax and fails on the "server.0.type", "server.0.host", and
> "server.0.port" syntax.
Okay, cool. ACK with the docs fixed.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.