From 50192e990f4e0469f8415f3f8315b2f9c4a0f4a1 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 16 May 2018 17:55:39 +0200 Subject: [PATCH] qemu: command: Fix formatting of TLS backend properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/qemu/qemu_command.c | 20 +++---------------- .../disk-drive-network-tlsx509-vxhs.args | 4 ++-- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 173745ee49..19c7149b5b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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; - - ret = 0; + return -1; - cleanup: - virBufferFreeAndReset(&buf); - VIR_FREE(path); - return ret; + return 0; } diff --git a/tests/qemuxml2argvdata/disk-drive-network-tlsx509-vxhs.args b/tests/qemuxml2argvdata/disk-drive-network-tlsx509-vxhs.args index a2b4d2bcbd..91d3a8a70a 100644 --- a/tests/qemuxml2argvdata/disk-drive-network-tlsx509-vxhs.args +++ b/tests/qemuxml2argvdata/disk-drive-network-tlsx509-vxhs.args @@ -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,\ -- GitLab