When we set migrate_speed by json, we receive the following error message: libvirtError: internal error unable to execute QEMU command 'migrate_set_speed': Invalid parameter type, expected: number The reason is that: the arguments of migrate_set_speed by json is json number, not json string. Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> --- src/qemu/qemu_monitor_json.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index da51a4f..2576dc5 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1453,17 +1453,13 @@ int qemuMonitorJSONSetMigrationSpeed(qemuMonitorPtr mon, unsigned long bandwidth) { int ret; - char *bandwidthstr; virJSONValuePtr cmd; virJSONValuePtr reply = NULL; - if (virAsprintf(&bandwidthstr, "%lum", bandwidth) < 0) { - virReportOOMError(); - return -1; - } cmd = qemuMonitorJSONMakeCommand("migrate_set_speed", - "s:value", bandwidthstr, + "U:value", + /* 1048576 = 1024 * 1024 */ + (uint64_t)bandwidth * 1048576, NULL); - VIR_FREE(bandwidthstr); if (!cmd) return -1; -- 1.7.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list