libxenstore and xentop confused by renamed VIF interfaces
Hi,
I have noticed a strange behaviour on 'xl top' – it would show no network statistics for some of my domU. It turned out that 'xl top' shows no network ('NETS', 'NETTX(k)', 'NETRX(k)' all '0') when the domU VIF has been renamed by using the 'vifname' option in its xl.cfg file.
The 'vifname' option is very useful to have predictable interface names for firewall configuration or network monitoring. The problem is libxenstore under Linux parses /proc/net/dev to extract 'vif.${domid}.*' interfaces, which won't be there, when the interfaces have been renamed.
I think the solution would be to look-up the actual interface name or index in sysfs, e.g. under /sys/devices/vif-${domind}-*.
Greets,
Jacek
Re: [BUG] libxenstat and xentop confused by renamed VIF interfaces
Quoted 3 lines · Jacek Konieczny
The 'vifname' option is very useful to have predictable interface names for firewall configuration or network monitoring. The problem is libxenstore under Linux parses
/proc/net/devto extract 'vif.${domid}.*'
I mean _libxenstat_, of course.
Xen 4.4.0.
Greets,
Jacek
Quoted 8 lines · Jacek Konieczny
Hi,
I have noticed a strange behaviour on 'xl top' – it would show no network statistics for some of my domU. It turned out that 'xl top' shows no network ('NETS', 'NETTX(k)', 'NETRX(k)' all '0') when the domU VIF has been renamed by using the 'vifname' option in its xl.cfg file.
Quoted 4 lines
The 'vifname' option is very useful to have predictable interface names for firewall configuration or network monitoring. The problem is libxenstore under Linux parses
/proc/net/devto extract 'vif.${domid}.*' interfaces, which won't be there, when the interfaces have been renamed.
I suppose it is trying to exclude non-vif network devices (xenbr0, eth0 etc).
Quoted 2 lines
I think the solution would be to look-up the actual interface name or index in sysfs, e.g. under
/sys/devices/vif-${domind}-*.
Sounds plausible.
Or perhaps check that /sys/class/net/${dev}/device/devtype contains "vif"? Might want to handle tap devices too. Perhaps parse the content of /sys/class/net/vif1.0/device/nodename to get the domid and devid?
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [BUG] libxenstat and xentop confused by renamed VIF interfaces
Quoted 5 lines · Ian Campbell
On Wed, 2014-05-21 at 09:52 +0200, Jacek Konieczny wrote:
libxenstore under Linux parses/proc/net/devto extract 'vif.${domid}.*' interfaces, which won't be there, when the interfaces have been renamed. I suppose it is trying to exclude non-vif network devices (xenbr0, eth0 etc).
That is one reason. The more important reason is to match interface with a domid. Also, the /proc/net/dev file is the source of the interface usage statistics collected by libxenstat.
Quoted 8 lines
Quoted 2 lines
I think the solution would be to look-up the actual interface name or index in sysfs, e.g. under
/sys/devices/vif-${domind}-*.Sounds plausible.
Or perhaps check that
/sys/class/net/${dev}/device/devtypecontains "vif"? Might want to handle tap devices too. Perhaps parse the content of/sys/class/net/vif1.0/device/nodenameto get the domid and devid?
Yes, that could work and would probably require less changes in the code – this can be done while iterating /proc/net/dev.
Another approach would be to use the data from the xenstore, but I guess that would be more expensive.
Greets,
Jacek
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [BUG] libxenstat and xentop confused by renamed VIF interfaces
Quoted 9 lines · Jacek Konieczny
Quoted 5 lines · Ian Campbell
On Wed, 2014-05-21 at 09:52 +0200, Jacek Konieczny wrote:
libxenstore under Linux parses/proc/net/devto extract 'vif.${domid}.*' interfaces, which won't be there, when the interfaces have been renamed. I suppose it is trying to exclude non-vif network devices (xenbr0, eth0 etc).That is one reason. The more important reason is to match interface with a domid.
Yes, I figured that out later ;-)
Quoted 12 lines
Also, the
/proc/net/devfile is the source of the interface
usage statistics collected by libxenstat.Quoted 8 lines
Quoted 2 lines
I think the solution would be to look-up the actual interface name or index in sysfs, e.g. under
/sys/devices/vif-${domind}-*.Sounds plausible.
Or perhaps check that
/sys/class/net/${dev}/device/devtypecontains "vif"? Might want to handle tap devices too. Perhaps parse the content of/sys/class/net/vif1.0/device/nodenameto get the domid and devid?
Quoted 5 lines
Yes, that could work and would probably require less changes in the code – this can be done while iterating
/proc/net/dev.Another approach would be to use the data from the xenstore, but I guess that would be more expensive.
Yes, and I don't think all the stats are in xenstore anyway.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [BUG] libxenstat and xentop confused by renamed VIF interfaces
In reply to Ian CampbellQuoted 8 lines · Ian Campbell
Quoted 2 lines · Jacek Konieczny
I think the solution would be to look-up the actual interface name or index in sysfs, e.g. under
/sys/devices/vif-${domind}-*.Sounds plausible.
Or perhaps check that
/sys/class/net/${dev}/device/devtypecontains "vif"? Might want to handle tap devices too.
I am not sure we could easily map a renamed tap (can they be renamed?) device to a domid.
Quoted 2 lines
Perhaps parse the content of
/sys/class/net/vif1.0/device/nodenameto get the domid and devid?
I think I could prepare the patch.
One question: can I assume /sys is always mounted and the '/sys/.../device/nodename', contains 'backend/vif/$domid/*' or should there be a fall-back to the old behaviour?
BTW, when 'device/nodename' exists and contains 'backend/vif/*' we don't need to check 'device/devtype' – one file access less.
Jacek
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [BUG] libxenstat and xentop confused by renamed VIF interfaces
Quoted 11 lines · Jacek Konieczny
Quoted 8 lines · Ian Campbell
Quoted 2 lines · Jacek Konieczny
I think the solution would be to look-up the actual interface name or index in sysfs, e.g. under
/sys/devices/vif-${domind}-*.Sounds plausible.
Or perhaps check that
/sys/class/net/${dev}/device/devtypecontains "vif"? Might want to handle tap devices too.I am not sure we could easily map a renamed tap (can they be renamed?)
I think so, to ${vifname}-emu IIRC.
Quoted 1 line
device to a domid.
True.
Quoted 4 lines
Quoted 2 lines
Perhaps parse the content of
/sys/class/net/vif1.0/device/nodenameto get the domid and devid?I think I could prepare the patch.
Thank you!
Quoted 3 lines
One question: can I assume /sys is always mounted and the '
/sys/.../device/nodename', contains 'backend/vif/$domid/*' or should there be a fall-back to the old behaviour?
I think on Linux we can assume these days that /sys must exist. I'm less sure about the content of nodename, in particular WRT the behaviour of the classic-Xen forward ports. (Jan, CCd, might know).
I'd be inclined to keep the existing code as a fallback for now, I think.
Quoted 2 lines
BTW, when 'device/nodename' exists and contains 'backend/vif/*' we don't need to check 'device/devtype' – one file access less.
Ack.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [BUG] libxenstat and xentop confused by renamed VIF interfaces
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 21.05.14 at 13:52, <[email protected]> wrote:
Quoted 3 lines · Jacek Konieczny
One question: can I assume /sys is always mounted and the '
/sys/.../device/nodename', contains 'backend/vif/$domid/*' or should there be a fall-back to the old behaviour?
Quoted 6 lines
I think on Linux we can assume these days that /sys must exist. I'm less sure about the content of nodename, in particular WRT the behaviour of the classic-Xen forward ports. (Jan, CCd, might know).
I'd be inclined to keep the existing code as a fallback for now, I think.
I agree - an eventual change in sysfs layout would need hunting down between 2.6.18 and 3.15; not something I would do without a very good reason. And I can't tell without doing so...
Jan