提交 eeaf6657 编写于 作者: P Peter Krempa

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.
上级 0a1870dd
...@@ -654,6 +654,7 @@ static virJSONValuePtr ...@@ -654,6 +654,7 @@ static virJSONValuePtr
qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src) qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
{ {
virJSONValuePtr servers = NULL; virJSONValuePtr servers = NULL;
virJSONValuePtr props = NULL;
virJSONValuePtr ret = NULL; virJSONValuePtr ret = NULL;
if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, true))) if (!(servers = qemuBlockStorageSourceBuildHostsJSONSocketAddress(src, true)))
...@@ -665,12 +666,24 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src) ...@@ -665,12 +666,24 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourcePtr src)
* server :[{type:"tcp", host:"1.2.3.4", port:24007}, * server :[{type:"tcp", host:"1.2.3.4", port:24007},
* {type:"unix", socket:"/tmp/glusterd.socket"}, ...]} * {type:"unix", socket:"/tmp/glusterd.socket"}, ...]}
*/ */
if (virJSONValueObjectCreate(&ret, if (virJSONValueObjectCreate(&props,
"s:driver", "gluster", "s:driver", "gluster",
"s:volume", src->volume, "s:volume", src->volume,
"s:path", src->path, "s:path", src->path,
"a:server", servers, NULL) < 0) "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; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册