On Mon, Sep 10, 2012 at 5:08 AM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote: > On Sun, Sep 09, 2012 at 05:02:09PM -0500, Doug Goldstein wrote: >> Add a read-only udev based backend for virInterface. Useful for distros >> that do not have netcf support yet. Multiple libvirt based utilities use >> a HAL based fallback when virInterface is not available which is less >> than ideal. This implements: >> * virConnectNumOfInterfaces() >> * virConnectListInterfaces() >> * virConnectNumOfDefinedInterfaces() >> * virConnectListDefinedInterfaces() >> * virConnectInterfaceLookupByName() >> * virConnectInterfaceLookupByMACString() >> --- >> .gnulib | 2 +- >> configure.ac | 10 +- >> src/Makefile.am | 12 +- >> src/interface/interface_backend_udev.c | 395 ++++++++++++++++++++++++++++++++ >> tools/virsh.c | 3 + >> 5 files changed, 417 insertions(+), 5 deletions(-) >> create mode 100644 src/interface/interface_backend_udev.c > > I'm somewhat loathe to include this impl. > > The functionality provided is so limited as compared to netcf, that I > don't think it'd really be a viable alternative. Also the semantics > of this driver are somewhat different to what we intend these APIs to > report. The intent was not that we report all physical interfaces, but > rather that we have an idea of "logical interfaces" which comprise > potentially many physical interfaces. I know you are filtering out > TUN devices and anything that's part of a bridge, so you get kind of > close to what netcf would do, but it still feels a little wrong. > > If we did, however, want to go down the route of having a generic > udev based impl, then I think you'd probably want to actually do > this as an alternative netcf driver. That way you can re-use the > existing code for reverse-engineering an interface XML config from > the live config. > > Daniel > -- The goal here is to provide virInterface APIs for everyone out there that doesn't have netcf, which is basically every Linux distro except RedHat/Fedora and Debian. Things like virt-install / virt-manger fall back to using HAL, which no distro carries anymore, when virInterface is unavailable. Other programs out there fall back to their own udev based implementation. The idea with these patches is to do the same thing that's being done with libvirt-designer, rather than every user of libvirt implementing virInterface calls with a fall back implementation that's different, we combine it into libvirt and just tell people to use virInterface. The reason why the creation is left out is that it's really the task for netcf. Also having libvirt bring up and teardown physical interfaces outside of the normal distro's network configs feels wrong. I'm not opposed to change that behavior and implement the full API. Lastly, I've run this on a RHEL6 machine and the output is identical to the netcf based backend. The machine doesn't have a bond device hence why I haven't compared that, but I noted that in the patchset. -- Doug Goldstein -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list