On Tue, Jul 02, 2013 at 09:39:20AM -0400, John Ferlan wrote:
Add a new qemuMonitorGetObjectProperty() method to support
invocation
of the 'qom-get' JSON monitor command with a provided path, property, and
expected data type return. The qemuMonitorObjectProperty is similar to
virTypedParameter; however, a future patch will extend it a bit to include
a void pointer to balloon driver statistic data.
The provided test will execute a qom-get on "/machine/i440fx" which will
return a property "realized".
---
src/qemu/qemu_monitor.c | 23 ++++++++++++
src/qemu/qemu_monitor.h | 33 +++++++++++++++++
src/qemu/qemu_monitor_json.c | 86 ++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 6 ++++
tests/qemumonitorjsontest.c | 48 +++++++++++++++++++++++++
5 files changed, 196 insertions(+)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 2e92f8c..cc22123 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -694,6 +694,39 @@ int qemuMonitorGetObjectListPaths(qemuMonitorPtr mon,
void qemuMonitorListPathFree(qemuMonitorListPathPtr paths);
+/* Flags for the 'type' field in _qemuMonitorObjectProperty */
+typedef enum {
+ QEMU_MONITOR_OBJECT_PROPERTY_BOOLEAN=1,
+ QEMU_MONITOR_OBJECT_PROPERTY_INT,
+ QEMU_MONITOR_OBJECT_PROPERTY_LONG,
+ QEMU_MONITOR_OBJECT_PROPERTY_UINT,
+ QEMU_MONITOR_OBJECT_PROPERTY_ULONG,
+ QEMU_MONITOR_OBJECT_PROPERTY_DOUBLE,
+ QEMU_MONITOR_OBJECT_PROPERTY_STRING,
+
+ QEMU_MONITOR_OBJECT_PROPERTY_LAST
+} qemuMonitorObjectPropertyType;
+
+typedef struct _qemuMonitorObjectProperty qemuMonitorObjectProperty;
+typedef qemuMonitorObjectProperty *qemuMonitorObjectPropertyPtr;
+struct _qemuMonitorObjectProperty {
+ int type; /* qemuMonitorObjectPropertyType */
+ union {
+ bool b;
+ int i;
+ long long l;
+ unsigned int ui;
+ unsigned long long ul;
+ double d;
+ char *str;
+ } val;
+};
I think the struct/enum should be kept in qemu_monitor_json.h
+
+int qemuMonitorGetObjectProperty(qemuMonitorPtr mon,
+ const char *path,
+ const char *property,
+ qemuMonitorObjectPropertyPtr prop);
and not expose this method in qemu_monitor.h
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|