netlink-based ifconfig() routine replacement

Federico Simoncelli fsimonce at redhat.com
Sat Jul 23 10:25:09 UTC 2011


----- Original Message -----
> From: "Peter V. Saveliev" <peet at altlinux.org>
> To: "Federico Simoncelli" <fsimonce at redhat.com>
> Cc: "VDSM Project Patches" <vdsm-patches at lists.fedorahosted.org>, "Dan Kenigsberg" <danken at redhat.com>
> Sent: Saturday, July 23, 2011 9:37:29 AM
> Subject: Re: netlink-based ifconfig() routine replacement
> On 22.07.2011 19:29, Federico Simoncelli wrote:
> > I didn't check the code, but I believe we should use something
> > more standard that is already shipped in rhel: ethtool.
> >
> >>>> import ethtool
> >>>> ethtool.get_interfaces_info('lo')[0].ipv4_address
> > '127.0.0.1'
> >>>> ethtool.get_interfaces_info('eth0')[0].ipv4_broadcast
> > '192.168.123.255'
> 
> I didn't know about this module, so, didn't take it into account, my
> mistake. Now I found and tested python-ethtool here:
> 
> http://git.kernel.org/?p=linux/kernel/git/acme/python-ethtool.git
> 
> 
> >
> > Are there missing features in ethtool?
> 
> I see that python-ethtool uses ioctl() (which are deprecated, though),
> so it can not get secondary addresses from interfaces that are added
> without 'labels'. But VDSM anyway does not recognize them internally
> ('cause it uses ifconfig, that also uses ioctl()), and I think it is
> not
> a problem.
> 
> The big problem is that python-ethtool uses /proc/net/dev to determine
> interface names. So it can not get even secondary addresses _with_
> labels (alias interfaces as it says ifconfig).

How is this going to affect vdsm?
If required, wouldn't make sense to add this functionality to python-ethtool
instead of re-implementing also what is already working?

Looks like the aliases are already detected somewhere:

>>> ethtool.get_active_devices()
['lo', 'eth0', 'eth0:0']

Maybe it's not that hard to add what's missing.

-- 
Federico


More information about the vdsm-patches mailing list