qemu: command: Fix formatting of TLS backend properties

The JSON property generator should not escape commas as we do on the
command line. The JSON->commandline generator already does that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-05-16 17:55:39 +02:00
parent 82ca8ad6c1
commit 50192e990f
2 changed files with 5 additions and 19 deletions

View File

@ -712,35 +712,21 @@ qemuBuildTLSx509BackendProps(const char *tlspath,
virQEMUCapsPtr qemuCaps,
virJSONValuePtr *propsret)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *path = NULL;
int ret = -1;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_TLS_CREDS_X509)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("tls-creds-x509 not supported in this QEMU binary"));
return -1;
}
virQEMUBuildBufferEscapeComma(&buf, tlspath);
if (virBufferCheckError(&buf) < 0)
goto cleanup;
path = virBufferContentAndReset(&buf);
if (virJSONValueObjectCreate(propsret,
"s:dir", path,
"s:dir", tlspath,
"s:endpoint", (isListen ? "server": "client"),
"b:verify-peer", (isListen ? verifypeer : true),
"S:passwordid", secalias,
NULL) < 0)
goto cleanup;
return -1;
ret = 0;
cleanup:
virBufferFreeAndReset(&buf);
VIR_FREE(path);
return ret;
return 0;
}

View File

@ -24,7 +24,7 @@ server,nowait \
-boot c \
-usb \
-object tls-creds-x509,id=objvirtio-disk0_tls0,dir=/etc/pki/libvirt-vxhs/dummy,\
,,,path,endpoint=client,verify-peer=yes \
,path,endpoint=client,verify-peer=yes \
-drive file.driver=vxhs,file.tls-creds=objvirtio-disk0_tls0,\
file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
file.server.host=192.168.0.1,file.server.port=9999,format=raw,if=none,\
@ -32,7 +32,7 @@ id=drive-virtio-disk0,serial=eb90327c-8302-4725-9e1b-4e85ed4dc251,cache=none \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
id=virtio-disk0 \
-object tls-creds-x509,id=objvirtio-disk1_tls0,dir=/etc/pki/libvirt-vxhs/dummy,\
,,,path,endpoint=client,verify-peer=yes \
,path,endpoint=client,verify-peer=yes \
-drive file.driver=vxhs,file.tls-creds=objvirtio-disk1_tls0,\
file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc252,\
file.server.host=192.168.0.2,file.server.port=9999,format=raw,if=none,\