mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: block: Add support for formatting gluster debug level via JSON
Improve the formatter so that we can use the 'debug' property straight away when using json.
This commit is contained in:
parent
0a1870ddd0
commit
eeaf6657f7
@ -654,6 +654,7 @@ static virJSONValuePtr
|
||||
qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
|
||||
{
|
||||
virJSONValuePtr servers = NULL;
|
||||
virJSONValuePtr props = NULL;
|
||||
virJSONValuePtr ret = NULL;
|
||||
|
||||
if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, true)))
|
||||
@ -665,12 +666,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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user