Daniel P. Berrange wrote:
The virbrN / xenbrN devices are bridges so see all traffic from any guest attached. We need to look at ths individual vifN.N or vnetN devices which are per-guest. This info isn't included in the XML though. If we can figure out a efficient way to export vif name in the XML we could use that, otherwie the API should probably take the MAC address on the device and use that to resolve the underlying VIF. The former is nicer though if we can do it.
The best I could come up with is this little bundle of joy ... diff -u -p -r1.132 xend_internal.c --- src/xend_internal.c 9 Aug 2007 20:19:12 -0000 1.132 +++ src/xend_internal.c 10 Aug 2007 15:07:20 -0000 @@ -1354,6 +1354,7 @@ xend_parse_sexp_desc(virConnectPtr conn, int max_mem, cur_mem; unsigned char uuid[VIR_UUID_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN]; + int vif_index = 0; if (root == NULL) { /* ERROR */ @@ -1626,6 +1627,9 @@ xend_parse_sexp_desc(virConnectPtr conn, if (tmp) virBufferVSprintf(&buf, " <target dev='%s'/>\n", tmp); + else + virBufferVSprintf(&buf, " <target dev='vif%d.%d'/>\n", + domid, vif_index); tmp = sexpr_node(node, "device/vif/mac"); if (tmp) virBufferVSprintf(&buf, " <mac address='%s'/>\n", @@ -1639,6 +1643,7 @@ xend_parse_sexp_desc(virConnectPtr conn, tmp2); virBufferAdd(&buf, " </interface>\n", 17); + vif_index++; } else if (sexpr_lookup(node, "device/vfb")) { /* New style graphics config for PV guests in >= 3.0.4, * or for HVM guests in >= 3.0.5 */If that isn't acceptable then I suggest we just modify the Xen implementation of domainInterfaceStats so that it accepts a path of the form "vif<domid>.<portnum>" for now, and return to the problem of getting the real vif later.
Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list