]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fallback to HMP when cpu_set QMP command is not found
authorWen Congyang <wency@cn.fujitsu.com>
Tue, 15 Mar 2011 08:53:06 +0000 (16:53 +0800)
committerEric Blake <eblake@redhat.com>
Tue, 15 Mar 2011 15:55:06 +0000 (09:55 -0600)
src/qemu/qemu_monitor_json.c

index 95fd39c2566031fbf3be6fb78af5b56cb1a390ea..152afbac76a91a1b676c33ec9c0882d52f0117c4 100644 (file)
@@ -1450,7 +1450,14 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon,
     if (!cmd)
         return -1;
 
-    ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+    if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
+        goto cleanup;
+
+    if (qemuMonitorJSONHasError(reply, "CommandNotFound")) {
+        VIR_DEBUG0("cpu_set command not found, trying HMP");
+        ret = qemuMonitorTextSetCPU(mon, cpu, online);
+        goto cleanup;
+    }
 
     if (ret == 0) {
         /* XXX See if CPU soft-failed due to lack of ACPI */
@@ -1468,10 +1475,7 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon,
             ret = 1;
     }
 
-#if 0
 cleanup:
-#endif
-
     virJSONValueFree(cmd);
     virJSONValueFree(reply);
     return ret;