[libvirt] [PATCH 5/6] qemu: setup infrastructure to handle NIC_RX_FILTER_CHANGED event
Laine Stump
laine at laine.org
Tue Sep 30 17:38:28 UTC 2014
On 09/30/2014 11:54 AM, Tony Krowiak wrote:
> On 09/24/2014 05:50 AM, Laine Stump wrote:
>> NIC_RX_FILTER_CHANGED is sent by qemu any time a NIC driver in the
>> guest modified the NIC's RX Filter (for example, if the MAC address of
>> the NIC is changed by the guest).
>>
>> This patch doesn't do anything useful with that event; it just sets up
>> all the plumbing to get news of the event into a worker thread with
>> all proper locking/reference counting, and provide an easy place to
>> add in desired functionality.
>>
>> For easy reference the next time a handler for a qemu event is
>> written, here is the sequence:
> I assume you mean qemu_monitor_json.c
>> The handler in qemu_json_monitor.c calls
Yes.
>>
>>
>> + if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) {
>> + VIR_WARN("NIC_RX_FILTER_CHANGED event received for "
>> + "non-existent device %s in domain %s",
>> + devAlias, vm->def->name);
>> + goto endjob;
>> + }
>> + if (dev.type != VIR_DOMAIN_DEVICE_NET) {
>> + VIR_WARN("NIC_RX_FILTER_CHANGED event received for "
>> + "non-network device %s in domain %s",
>> + devAlias, vm->def->name);
>> + goto endjob;
>> + }
> I understand the need to check the device type, but is it necessary to
> log a warning message? I wonder if it may not cause unnecessary
> concern for someone viewing the logs. Is it possible to receive a
> NIC_RX_FILTER_CHANGED event for something other than a network device?
As far as I know this event should never be issued for any device that
isn't a net device. If this was happening, it would mean that either
qemu or libvirt had messed up somewhere, and could be an indicator of
larger problems.
>
>> +
>> +
>> +static void
>> +qemuMonitorJSONHandleNicRxFilterChanged(qemuMonitorPtr mon,
>> virJSONValuePtr data)
>> +{
>> + const char *name;
>> +
>> + if (!(name = virJSONValueObjectGetString(data, "name"))) {
>> + VIR_WARN("missing device in NIC_RX_FILTER_CHANGED event");
>> + return;
>> + }
> The device path is also sent with the event. It may be that data
> element is useless with regard to subsequent NIC_RX_FILTER_CHANGED
> event handling but, for my edification, I am curious as to why you
> ignored it.
Because we don't use it in libvirt. We only use the alias (aka "name")
More information about the libvir-list
mailing list