提交 50192e99 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 82ca8ad6
...@@ -712,35 +712,21 @@ qemuBuildTLSx509BackendProps(const char *tlspath, ...@@ -712,35 +712,21 @@ qemuBuildTLSx509BackendProps(const char *tlspath,
virQEMUCapsPtr qemuCaps, virQEMUCapsPtr qemuCaps,
virJSONValuePtr *propsret) virJSONValuePtr *propsret)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *path = NULL;
int ret = -1;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_TLS_CREDS_X509)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_TLS_CREDS_X509)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("tls-creds-x509 not supported in this QEMU binary")); _("tls-creds-x509 not supported in this QEMU binary"));
return -1; return -1;
} }
virQEMUBuildBufferEscapeComma(&buf, tlspath);
if (virBufferCheckError(&buf) < 0)
goto cleanup;
path = virBufferContentAndReset(&buf);
if (virJSONValueObjectCreate(propsret, if (virJSONValueObjectCreate(propsret,
"s:dir", path, "s:dir", tlspath,
"s:endpoint", (isListen ? "server": "client"), "s:endpoint", (isListen ? "server": "client"),
"b:verify-peer", (isListen ? verifypeer : true), "b:verify-peer", (isListen ? verifypeer : true),
"S:passwordid", secalias, "S:passwordid", secalias,
NULL) < 0) NULL) < 0)
goto cleanup; return -1;
ret = 0;
cleanup: return 0;
virBufferFreeAndReset(&buf);
VIR_FREE(path);
return ret;
} }
......
...@@ -24,7 +24,7 @@ server,nowait \ ...@@ -24,7 +24,7 @@ server,nowait \
-boot c \ -boot c \
-usb \ -usb \
-object tls-creds-x509,id=objvirtio-disk0_tls0,dir=/etc/pki/libvirt-vxhs/dummy,\ -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,\ -drive file.driver=vxhs,file.tls-creds=objvirtio-disk0_tls0,\
file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\ file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,\
file.server.host=192.168.0.1,file.server.port=9999,format=raw,if=none,\ 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 \ ...@@ -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,\ -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
id=virtio-disk0 \ id=virtio-disk0 \
-object tls-creds-x509,id=objvirtio-disk1_tls0,dir=/etc/pki/libvirt-vxhs/dummy,\ -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,\ -drive file.driver=vxhs,file.tls-creds=objvirtio-disk1_tls0,\
file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc252,\ file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc252,\
file.server.host=192.168.0.2,file.server.port=9999,format=raw,if=none,\ file.server.host=192.168.0.2,file.server.port=9999,format=raw,if=none,\
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册