On Wed, 2010-07-28 at 13:27 -0500, Shaun Ruffell wrote:
> On 07/28/2010 01:12 PM, Lucas Meneghel Rodrigues wrote:
> > On Tue, 2010-07-20 at 09:35 +0800, Amos Kong wrote:
> >> + try:
> >> + # FIXME: Try three waies to get nic driver name, because the
> >> + # modprobe.conf is dropped in latest system, and ethtool method
> >> is not
> >> + # supported by virtio_nic.
> >> +
> >> + output = session.get_command_output("cat /etc/modprobe.conf")
> >> + driver = re.findall(r'%s (\w+)' % ethname,output)
> >> + if not driver:
> >> + output = session.get_command_output("ethtool -i %s" % ethname)
> >> + driver = re.findall(r'driver: (\w+)', output)
> >> + if not driver:
> >> + output = session.get_command_output("lspci -k")
> >> + driver = re.findall("Ethernet controller.*\n.*\n.*Kernel
> >> driver"
> >> + " in use: (\w+)", output)
> >> + driver = driver[0]
> >> + except IndexError:
> >> + raise error.TestError("Could not find driver name")
> >
> > ^ About this whole block where there's an attempt to discover what the
> > driver name is. The methods listed there are not reliable (depends on
> > ethtool being installed, lspci -k not allways will list the kernel
> > driver in use, /etc/modprobe.conf will not be present on more recent
> > distributions). Instead of these methods, why don't we have a variant
> > for this test on each linux distro definition block, with the
> > appropriate driver names? It'd be something along the lines:
> >
> > - 13.64:
> > image_name = f13-64
> > cdrom_cd1 = linux/Fedora-13-x86_64-DVD.iso
> > md5sum = 6fbae6379cf27f36e1f2c7827ba7dc35
> > md5sum_1m = 68821b9de4d3b5975d6634334e7f47a6
> > unattended_install:
> > unattended_file = unattended/Fedora-13.ks
> > tftp = images/f13-64/tftpboot
> > floppy = images/f13-64/floppy.img
> > nicdriver_unload:
> > e1000:
> > driver = e1000c
> > virtio:
> > driver = virtio_net
> > rtl8139:
> > driver = rtl8939
> >
> > I believe it's safer than having to rely on the above methods.
> >
>
> What about looking for the driver link? i.e.:
>
> def get_netdriver_from_ethname(ethname):
> temp_path = "/sys/class/net/%s/device/driver" % (ethname)
> if os.path.islink(temp_path):
> return os.path.split(os.path.realpath(temp_path))[-1]
> else:
> raise Exception("'%s' not found" % (ethname))
>
That looks good, except that we'll execute this on the guest, so we'll
have to use commands typed on the ssh session to get a similar result.
There's a very minor concern that this won't work on distros that use
kernel 2.4, and we do test RHEL3.9, as it is supported under KVM, so
we'll have to look into the analogous way to do it under 2.4.
Thanks for bringing up this solution!
Amos, please implement the solution proposed by Shaun.
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest