[libvirt] [PATCH v2 3/9] qemu: Add the capabilitie to detect if the qemu binary have the capability to use bps_max and friends

Matthias Gatto matthias.gatto at outscale.com
Mon Sep 22 09:39:12 UTC 2014


For virQEMUCapsInitQMPMonitor I didn't find other way to check the
capability than to check the version, and virQEMUCapsComputeCmdFlags
is not call when qemu use QMP(or I've miss how to call it).
I don't understand how i should change this patch, can you explain it
to me please ?

On Fri, Sep 19, 2014 at 1:11 PM, Michal Privoznik <mprivozn at redhat.com> wrote:
> On 15.09.2014 19:27, Matthias Gatto wrote:
>>
>> Add a value in the enum virQEMUCapsFlags for the qemu capability.
>> Set it with virQEMUCapsSet if the binary suport bps_max and they friends.
>>
>> Signed-off-by: Matthias Gatto <matthias.gatto at outscale.com>
>> ---
>>   src/qemu/qemu_capabilities.c | 6 ++++++
>>   src/qemu/qemu_capabilities.h | 1 +
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>> index 360cc67..a97ca03 100644
>> --- a/src/qemu/qemu_capabilities.c
>> +++ b/src/qemu/qemu_capabilities.c
>> @@ -265,6 +265,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>>                 "numa",
>>                 "memory-backend-file",
>>                 "usb-audio",
>> +              "drive-iotune-max",
>>       );
>>
>>
>> @@ -1063,6 +1064,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
>>               virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ);
>>           if (strstr(help, "bps="))
>>               virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE);
>> +        if (strstr(help, "bps_max="))
>> +            virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX);
>>       }
>>       if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
>>           const char *nl = strstr(p, "\n");
>> @@ -3141,6 +3144,9 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
>>       if (qemuCaps->version >= 1006000)
>>           virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
>>
>> +    if (qemuCaps->version >= 1007000)
>> +        virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX);
>> +
>
>
> What's wrong with just the above chunk? I mean, version based checks are not
> good. I'd just drop this one.
>
>
>>       if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
>>           goto cleanup;
>>       if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0)
>> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
>> index 2911759..394a836 100644
>> --- a/src/qemu/qemu_capabilities.h
>> +++ b/src/qemu/qemu_capabilities.h
>> @@ -213,6 +213,7 @@ typedef enum {
>>       QEMU_CAPS_NUMA               = 171, /* newer -numa handling with
>> disjoint cpu ranges */
>>       QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file
>> */
>>       QEMU_CAPS_OBJECT_USB_AUDIO   = 173, /* usb-audio device support */
>> +    QEMU_CAPS_DRIVE_IOTUNE_MAX   = 174, /* -drive bps_max= and friends */
>>
>>       QEMU_CAPS_LAST,                   /* this must always be the last
>> item */
>>   } virQEMUCapsFlags;
>>
>
> Michal




More information about the libvir-list mailing list