This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-users] How to tell which tapX interface belongs to which domain

On Tue, Oct 09, 2007 at 03:35:47PM +1000, James Harper wrote:
> You can get that from xenstore.
> [..]
> /usr/sbin/xenstore-list /local/domain | while read domid
> do
>   name=`/usr/sbin/xenstore-read /local/domain/$domid/name`
>   if [ "$name" = "$domname" ]
>   then
>     type=`/usr/sbin/xenstore-read
> /local/domain/0/backend/vif/$domid/$vifindex/type 2>/dev/null`
>     if [ "$type" = "ioemu" ]
>     then
>       if=`/usr/sbin/brctl show | sed 's/.*[      ]//' | egrep -B 1
> "^vif$domid.$vifindex" | head -1`
>     else
>       if=vif$domid.$vifindex
>     fi
>     /usr/local/bin/if_traffic $if
>     exit
>   fi
> done
> "

Works great, thanks.
And /proc/net/dev gives me all values at ones, till today i read single
files under /sys for each interface.

> The only problem I can see with the second script, is that I don't think
> you can rely on the 'ioemu' text being present in that key, on another
> machine it is blank. It probably comes from the config script...
My perl-script here returns different errorcodes for 'value could not
be read' (=para-domU) and 'error executing xenstore-read' at all.


Xen-users mailing list