[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]