On 08/11/2011 09:27 AM, Peter Krempa wrote:
Adds support for QMP and text monitor access to qemu. --- src/qemu/qemu_monitor.c | 19 +++++++++++++++++ src/qemu/qemu_monitor.h | 3 ++ src/qemu/qemu_monitor_json.c | 23 ++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 4 +++ src/qemu/qemu_monitor_text.c | 47 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_text.h | 4 +++ 6 files changed, 100 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index db6107c..53a0ce3 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1135,6 +1135,25 @@ int qemuMonitorGetCPUInfo(qemuMonitorPtr mon, return ret; } +int qemuMonitorSetLink(qemuMonitorPtr mon, + const char *name, + unsigned int state)
If you use VIR_ENUM in domain_conf.h to define the valid link states, then use that enum type here instead of unsigned int.
+int qemuMonitorJSONSetLink(qemuMonitorPtr mon, + const char *name, + unsigned int state) +{ + + int ret; + virJSONValuePtr reply = NULL; + virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("set_link", + "s:name", name, + "b:up", state==VIR_LINK_STATE_DOWN?false:true,
I'm not a fan of cond?false:true; why not just: "b:up", state == VIR_LINK_STATE_UP, Looks nice in general, though. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list