output nc->name in NIC_RX_FILTER_CHANGED event
PATCH 1/1 output nc->name in NIC_RX_FILTER_CHANGED event
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.
--- hw/net/virtio-net.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
hw/net/virtio-net.c +3 -8
@@ -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);
Signature · 1 line
1.8.1.4
Quoted 4 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->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.
Quoted 29 lines
Signed-off-by Amos Kong <[email protected]>--- hw/net/virtio-net.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)hw/net/virtio-net.c +3
-8@@ -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);Signature · 1 line
1.8.1.4
Signature · 1 line
Amos.
Quoted 21 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.Signed-off-by Amos Kong <[email protected]>--- hw/net/virtio-net.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)hw/net/virtio-net.c +0
-3@@ -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,
hw/net/virtio-net.c static void rxfilter_notify(NetClientState *nc) · line 207
Quoted 10 lines
hw/net/virtio-net.c +3
-5- 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);
Is this on top of "[PATCH v3 0/2] mac programming over macvtap"?
Yes, qdev IDs are optional, and therefore can serve as reliable identifier only when the user / management application always specifies one, and even then, you're still screwed for auto-created devices. Easily avoided for NICs, but yes, the problem is real.
However, I don't agree with the solution "use NetCientState name", because that's too ad hoc, and not general. Can we please use QOM paths?
Quoted 7 lines · Amos Kong
Quoted 4 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.
Quoted 7 lines
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.
DEVICE_DELETED uses "device" (the qdev ID) and "path" (the QOM path).
For reasons I don't understand, it sets "path" only when the device has no qdev ID. That should be cleaned up.
Quoted 14 lines · Markus Armbruster
Quoted 12 lines · Amos Kong
Quoted 4 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->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_*)
Quoted 7 lines
Quoted 2 lines
If we assign 'id' for -device, device name will be set to id. Otherwise, a generated device name will set to some device.
DEVICE_DELETEDuses "device" (the qdev ID) and "path" (the QOM path).For reasons I don't understand, it sets "path" only when the device has no qdev ID. That should be cleaned up.
The path are alwasy set.
example:
(have id)
"path": "/machine/peripheral-anon/vnet0/virtio-backend"
(no id)
"path": "/machine/peripheral-anon/device[0]/virtio-backend"
It's enough to just use path to distinguish the changed device. So we ignore this patch.
Signature · 1 line
Amos.
Quoted 19 lines · Markus Armbruster
Quoted 17 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.Signed-off-by Amos Kong <[email protected]>--- hw/net/virtio-net.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)hw/net/virtio-net.c +0
-0@@ -200,14 +200,9 @@ static void rxfilter_notify(NetClientState *nc)VirtIONet *n =qemu_get_nic_opaque (nc);
Quoted 16 lines
Quoted 4 lines
hw/net/virtio-net.c +0
-3if (nc->rxfilter_notify_enabled) { -if (n->netclient_name) { - event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }", - n->netclient_name,hw/net/virtio-net.c static void rxfilter_notify(NetClientState *nc) · line 207
Quoted 10 lines
hw/net/virtio-net.c +3
-5- 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);Is this on top of "[PATCH v3 0/2] mac programming over macvtap"?
It's based on mst's pci tree:
https://git.kernel.org/cgit/virt/kvm/mst/qemu.git/log/?h=pci
https://git.kernel.org/cgit/virt/kvm/mst/qemu.git/commit/?h=pci&id=1c0fa6b709d02fe4f98d4ce7b55a6cc3c925791c
Quoted 8 lines
Yes, qdev IDs are optional, and therefore can serve as reliable identifier only when the user / management application always specifies one, and even then, you're still screwed for auto-created devices. Easily avoided for NICs, but yes, the problem is real.
However, I don't agree with the solution "use NetCientState name", because that's too ad hoc, and not general. Can we please use QOM paths?
path is always provided in event, libvirt can use it.
Signature · 1 line
Amos.
Quoted 18 lines · Amos Kong
Quoted 17 lines · Markus Armbruster
Quoted 14 lines · Amos Kong
Quoted 4 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->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.
Quoted 6 lines
Quoted 4 lines
DEVICE_DELETEDuses "device" (the qdev ID) and "path" (the QOM path).For reasons I don't understand, it sets "path" only when the device has no qdev ID. That should be cleaned up.
The path are alwasy set.
You're right; I misread device_unparent().
[...]
Quoted 6 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.Signed-off-by Amos Kong <[email protected]>
Just making sure - you don't think this patch is necessary, correct?
Quoted 28 lines
--- hw/net/virtio-net.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)hw/net/virtio-net.c +3
-8@@ -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);Signature · 1 line
1.8.1.4
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.Signed-off-by Amos Kong <[email protected]>Just making sure - you don't think this patch is necessary, correct?
Correct.
Am 01.07.2013 04:55, schrieb Amos Kong:
Quoted 20 lines · Markus Armbruster
Quoted 19 lines
Quoted 7 lines · Amos Kong
Quoted 4 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.Quoted 7 lines
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.
DEVICE_DELETEDuses "device" (the qdev ID) and "path" (the QOM path).
Quoted 8 lines
Quoted 2 lines
For reasons I don't understand, it sets "path" only when the device has no qdev ID. That should be cleaned up.
The path are alwasy set.
example:
(have id)
"path": "/machine/peripheral-anon/vnet0/virtio-backend"
You hopefully meant "/machine/peripheral/vnet0/virtio-backend"? Otherwise we have a bug somewhere.
Andreas
Quoted 7 lines
(no id)
"path": "/machine/peripheral-anon/device[0]/virtio-backend"It's enough to just use path to distinguish the changed device. So we ignore this patch.
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 24 lines · Andreas Färber
Am 01.07.2013 04:55, schrieb Amos Kong:
Quoted 23 lines · Markus Armbruster
Quoted 21 lines
Quoted 7 lines · Amos Kong
Quoted 4 lines · Amos Kong
netclient 'name' entry in event is useful for management to know which device is changed.
n->netclient_nameis not always set. This patch changes to usenc->name. If we don't assign 'id', qemu will set a generated name tonc->name.Quoted 7 lines
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.
DEVICE_DELETEDuses "device" (the qdev ID) and "path" (the QOM path).For reasons I don't understand, it sets "path" only when the device has no qdev ID. That should be cleaned up.
Quoted 8 lines
Quoted 5 lines
The path are alwasy set.
example:
(have id)
"path": "/machine/peripheral-anon/vnet0/virtio-backend"You hopefully meant "/machine/peripheral/vnet0/virtio-backend"? Otherwise we have a bug somewhere.
Just my typo in mail.
// -device virtio-net-pci,netdev=h1,id=vnet0 -netdev tap,id=h1
{
"timestamp": {
"seconds": 1375366321,
"microseconds": 595727
},
"event": "NIC_RX_FILTER_CHANGED",
"data": {
"name": "vnet0",
"path": "/machine/peripheral/vnet0/virtio-backend"
}
}Quoted 14 lines
Andreas
Quoted 7 lines
(no id)
"path": "/machine/peripheral-anon/device[0]/virtio-backend"It's enough to just use path to distinguish the changed device. So we ignore this patch.
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Signature · 1 line
Amos.