Description of problem: ifconfig output format has changed since fedora 16 which results in get_host_network_devices returning wrong data. Version-Release number of selected component (if applicable): python-virtinst-0.600.3-1.fc17.noarch How reproducible: Always Steps to Reproduce: 1. python -c 'import virtinst; print virtinst.util.get_host_network_devices()' Actual results: [] Expected results: [['br0', 'link', 'encap:ethernet', 'hwaddr', '00:1a:a0:ad:33:45'], ['em1', 'link', 'encap:ethernet', 'hwaddr', '00:1a:a0:ad:33:45'], ['virbr0', 'link', 'encap:ethernet', 'hwaddr', '52:54:00:50:4e:58'], ['virbr0-nic', 'link', 'encap:ethernet', 'hwaddr', '52:54:00:50:4e:58']]
Was this causing an issue in some way? I think it's only used to make sure the user doesn't specify a MAC address that conflicts with the host NIC, which is not important enough to deal with parsing ifconfig output. I'll probably just drop this function when we merge virt-manager and virtinst repos. Moving to the upstream tracker.
Forgot to set needinfo, richard please see comment #1
(In reply to comment #1) > Was this causing an issue in some way? I think it's only used to make sure > the user doesn't specify a MAC address that conflicts with the host NIC, > which is not important enough to deal with parsing ifconfig output. I'll > probably just drop this function when we merge virt-manager and virtinst > repos. > I've found this by accident while trying to use it in my project. Public API provided by virtinst is actually quite nice and valuable (at least for me). You can probably use my simple version which only returns MAC addresses: def get_host_macs(): with os.popen('LC_ALL=C /sbin/ip addr') as f: return map(lambda x: x.split()[1], filter(lambda x: 'link/ether' in x, f.readlines()))
(In reply to comment #3) > (In reply to comment #1) > > Was this causing an issue in some way? I think it's only used to make sure > > the user doesn't specify a MAC address that conflicts with the host NIC, > > which is not important enough to deal with parsing ifconfig output. I'll > > probably just drop this function when we merge virt-manager and virtinst > > repos. > > > > I've found this by accident while trying to use it in my project. > > Public API provided by virtinst is actually quite nice and valuable (at > least for me). > Is this a public project? If so, virtinst is going to cease to be a public API very soon now so you will be stranded. https://www.redhat.com/archives/virt-tools-list/2012-February/msg00040.html libvirt-gconfig and libvirt-designer will eventually provide the important functionality. If this is a private project you can just keep a copy of the old code around, or even continue to use the API that will eventually exist under /usr/share/virt-manager/virtinst, though understandable there will be no API guarantees. > You can probably use my simple version which only returns MAC addresses: > > def get_host_macs(): > with os.popen('LC_ALL=C /sbin/ip addr') as f: > return map(lambda x: x.split()[1], > filter(lambda x: 'link/ether' in x, > f.readlines())) Thanks for the code, however the purpose of the original code (to make sure a manually specified mac address does not conflict with the host address) is pretty obscure, and not worth calling out to an external tool to verify. And if anything we should be using libvirt interface APIs. So I'll just drop this code when the next release goes out.
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #1) > > > Was this causing an issue in some way? I think it's only used to make sure > > > the user doesn't specify a MAC address that conflicts with the host NIC, > > > which is not important enough to deal with parsing ifconfig output. I'll > > > probably just drop this function when we merge virt-manager and virtinst > > > repos. > > > > > > > I've found this by accident while trying to use it in my project. > > > > Public API provided by virtinst is actually quite nice and valuable (at > > least for me). > > > > Is this a public project? If so, virtinst is going to cease to be a public > API very soon now so you will be stranded. > > https://www.redhat.com/archives/virt-tools-list/2012-February/msg00040.html > > libvirt-gconfig and libvirt-designer will eventually provide the important > functionality. > > If this is a private project you can just keep a copy of the old code > around, or even continue to use the API that will eventually exist under > /usr/share/virt-manager/virtinst, though understandable there will be no API > guarantees. > It will be public but it's not a problem for me to rewrite few API calls I'm using.
virtinst has been merged into virt-manager.git. Moving all virtinst bugs to the virt-manager component.
This has been dropped now as planned in Comment #4