[libvirt] [PATCH] qemu: Fix JSON migrate_set_downtime command

Eric Blake eblake at redhat.com
Thu Aug 19 16:36:55 UTC 2010


On 08/19/2010 10:33 AM, Eric Blake wrote:
> On 08/19/2010 08:47 AM, Jiri Denemark wrote:
>> ---
>>  src/qemu/qemu_monitor_json.c |    9 ++-------
>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
>> index e8609aa..8a586bc 100644
>> --- a/src/qemu/qemu_monitor_json.c
>> +++ b/src/qemu/qemu_monitor_json.c
>> @@ -1481,17 +1481,12 @@ int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon,
>>                                          unsigned long long downtime)
>>  {
>>      int ret;
>> -    char *downtimestr;
>>      virJSONValuePtr cmd;
>>      virJSONValuePtr reply = NULL;
>> -    if (virAsprintf(&downtimestr, "%llums", downtime) < 0) {
>> -        virReportOOMError();
>> -        return -1;
>> -    }
>> +
>>      cmd = qemuMonitorJSONMakeCommand("migrate_set_downtime",
>> -                                     "s:value", downtimestr,
>> +                                     "d:value", downtime / 1000.0,
> 
> Does "d:value" correctly handle an unsigned long long argument passed
> through varargs?  I'm thinking you either need a modifier in
> qemuMonitorJSONMakeCommand that knows how to receive long long
> arguments, or you need a cast here to pass the correct integer type.

Never mind.  I was thinking too much of printf's %d.  But with
qemuMonitorJSONMakeCommand, d: is a double, and your division by 1000.0
does indeed create a value that passes just fine through varargs.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100819/12fd5428/attachment-0001.sig>


More information about the libvir-list mailing list