[libvirt] [PATCH] The output of domxml-to-native should be the same as the actual commandline.

Hi, There is a little difference between the output of domxml-to-native and the actual commandline. No matter qemu is in control or readline mode, domxml-to-native always converts it to readline mode. That is because the parameter "monitor_json" for qemuBuildCommandLine() is always set to false in qemuDomainXMLToNative(). Here is the patch, please comment! Signed-off-by: tangchen <tangchen@cn.fujitsu.com> --- src/qemu/qemu_driver.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2e6f3e4..a564afb 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4480,6 +4480,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, virDomainDefPtr def = NULL; virDomainChrSourceDef monConfig; virBitmapPtr qemuCaps = NULL; + bool monitor_json = false; virCommandPtr cmd = NULL; char *ret = NULL; int i; @@ -4577,11 +4578,15 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, &qemuCaps) < 0) goto cleanup; +#ifdef HAVE_YAJL + monitor_json = qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON); +#endif + if (qemuProcessPrepareMonitorChr(driver, &monConfig, def->name) < 0) goto cleanup; if (!(cmd = qemuBuildCommandLine(conn, driver, def, - &monConfig, false, qemuCaps, + &monConfig, monitor_json, qemuCaps, NULL, -1, NULL, VIR_VM_OP_NO_OP))) goto cleanup; -- 1.7.3.1 -- Best Regards, Tang chen

That's a long subject; do 'git shortlog -30' to get a feel for the average commit message length. I shortened it to: qemu: allow json in domxml-to-native On 10/20/2011 04:37 AM, tangchen wrote:
Hi,
There is a little difference between the output of domxml-to-native and the actual commandline. No matter qemu is in control or readline mode, domxml-to-native always converts it to readline mode.
That is because the parameter "monitor_json" for qemuBuildCommandLine() is always set to false in qemuDomainXMLToNative().
Here is the patch, please comment!
+#ifdef HAVE_YAJL + monitor_json = qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON); +#endif
The #ifdef is spurious here. It is useful for situations like calling qemuMonitorSystemPowerdown, where we know the command will fail without json support, but not for the simple querying of a capability bit. For that matter, I'll go ahead and remove the other uses of HAVE_YAJL from this file, as a followup patch.
+ if (qemuProcessPrepareMonitorChr(driver,&monConfig, def->name)< 0) goto cleanup;
if (!(cmd = qemuBuildCommandLine(conn, driver, def, -&monConfig, false, qemuCaps, +&monConfig, monitor_json, qemuCaps, NULL, -1, NULL, VIR_VM_OP_NO_OP))) goto cleanup;
ACK and pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
tangchen