Improve the formatter so that we can use the 'debug' property straight away when using json. --- src/qemu/qemu_block.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 8b23df8227..3a48f60c00 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -639,6 +639,7 @@ static virJSONValuePtr qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src) { virJSONValuePtr servers = NULL; + virJSONValuePtr props = NULL; virJSONValuePtr ret = NULL; if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, true))) @@ -650,12 +651,24 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src) * server :[{type:"tcp", host:"1.2.3.4", port:24007}, * {type:"unix", socket:"/tmp/glusterd.socket"}, ...]} */ - if (virJSONValueObjectCreate(&ret, + if (virJSONValueObjectCreate(&props, "s:driver", "gluster", "s:volume", src->volume, "s:path", src->path, "a:server", servers, NULL) < 0) - virJSONValueFree(servers); + goto cleanup; + + servers = NULL; + + if (src->debug && + virJSONValueObjectAdd(props, "u:debug", src->debugLevel, NULL) < 0) + goto cleanup; + + VIR_STEAL_PTR(ret, props); + + cleanup: + virJSONValueFree(servers); + virJSONValueFree(props); return ret; } -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list