[libvirt] [PATCH 4/6] qemu: qemuMonitorQueryRxFilter - retrieve guest netdev rx-filter

Laine Stump laine at laine.org
Mon Sep 29 19:07:44 UTC 2014


On 09/27/2014 12:41 AM, Amos Kong wrote:
> On Wed, Sep 24, 2014 at 05:50:54AM -0400, Laine Stump wrote:
>> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
>> index a3d7c2c..58007e6 100644
>> --- a/src/qemu/qemu_monitor_json.c
>> +++ b/src/qemu/qemu_monitor_json.c
>> @@ -3194,6 +3194,221 @@ int qemuMonitorJSONRemoveNetdev(qemuMonitorPtr mon,
>>  }
>>  
>>  
>> +static int
>> +qemuMonitorJSONQueryRxFilterParse(virJSONValuePtr msg,
>> +                                  virNetDevRxFilterPtr *filter)
>> +{
>> +    int ret = -1;
>> +    const char *tmp;
>> +    virJSONValuePtr returnArray, entry, table, element;
>> +    int nTable;
>> +    size_t i;
>> +    virNetDevRxFilterPtr fil = virNetDevRxFilterNew();
>> +
>> +    if (!(returnArray = virJSONValueObjectGet(msg, "return"))) {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> +                       _("query-rx-filter reply was missing return data"));
>> +        goto cleanup;
>> +    }
>> +    if (returnArray->type != VIR_JSON_TYPE_ARRAY) {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> +                       _("query-rx-filter return data was not an array"));
>> +        goto cleanup;
>> +    }
>> +    if (!(entry = virJSONValueArrayGet(returnArray, 0))) {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> +                       _("query -rx-filter returne data missing array element"));
>> +        goto cleanup;
>> +    }
>> +
>> +    if (!fil)
>> +        goto cleanup;
> How about checking fil after virNetDevRxFilterNew()?

Derp.

I added in the extra stuff to drill into the JSON structure after the
initial writing of the function, and wasn't paying attention. Thanks for
catching that!




More information about the libvir-list mailing list