On Mon, Jun 24, 2013 at 02:34:59PM +0800, Amos Kong wrote: > netclient 'name' entry in event is useful for management to know > which device is changed. n->netclient_name is not always set. > This patch changes to use nc->name. If we don't assign 'id', > qemu will set a generated name to nc->name.
IRC: <mst> akong, what do other events include? name or id? I just checked QMP/qmp-event.txt, they all use 'device name'. (eg: BLOCK_IO_ERROR, DEVICE_DELETED, DEVICE_TRAY_MOVED, BLOCK_JOB_*) If we assign 'id' for -device, device name will be set to id. Otherwise, a generated device name will set to some device. > Signed-off-by: Amos Kong <ak...@redhat.com> > --- > hw/net/virtio-net.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index c88403a..e4d9752 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -200,14 +200,9 @@ static void rxfilter_notify(NetClientState *nc) > VirtIONet *n = qemu_get_nic_opaque(nc); > > if (nc->rxfilter_notify_enabled) { > - if (n->netclient_name) { > - event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }", > - n->netclient_name, > - > object_get_canonical_path(OBJECT(n->qdev))); > - } else { > - event_data = qobject_from_jsonf("{ 'path': %s }", > - > object_get_canonical_path(OBJECT(n->qdev))); > - } > + event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }", > + nc->name, > + object_get_canonical_path(OBJECT(n->qdev))); > monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data); > qobject_decref(event_data); > > -- > 1.8.1.4 -- Amos.