From: Peter Krempa Date: Mon, 9 Dec 2019 06:46:53 +0000 (+0100) Subject: qemu: monitor: Extract internals of qemuMonitorJSONBlockGetNamedNodeData X-Git-Tag: v6.0.0-rc1~324 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a185d2f6e8cac26c305900b14bfde3ce6dae68c;p=thirdparty%2Flibvirt.git qemu: monitor: Extract internals of qemuMonitorJSONBlockGetNamedNodeData For testing purposes it will be beneficial to be able to parse the data from JSON directly rather than trying to simulate the monitor. Extract the worker bits and export them. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9f1c3efb35..c47ca94dba 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2988,14 +2988,10 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos G_GNUC_UNUSED, virHashTablePtr -qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon) +qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes) { - g_autoptr(virJSONValue) nodes = NULL; g_autoptr(virHashTable) ret = NULL; - if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon))) - return NULL; - if (!(ret = virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeDataFree))) return NULL; @@ -3008,6 +3004,18 @@ qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon) } +virHashTablePtr +qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon) +{ + g_autoptr(virJSONValue) nodes = NULL; + + if (!(nodes = qemuMonitorJSONQueryNamedBlockNodes(mon))) + return NULL; + + return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes); +} + + int qemuMonitorJSONBlockResize(qemuMonitorPtr mon, const char *device, const char *nodename, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 5d05772fa2..44926464b9 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -87,6 +87,9 @@ int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitorPtr mon, int qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitorPtr mon, virHashTablePtr stats); +virHashTablePtr +qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes); + virHashTablePtr qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon);