Comment 5 for bug 1764314

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
after sleeping once about this to sort my thoughts I have this morning revisited most of the code.

## Usage and state of ncf ##

In its only user currently being libvirt I checked that usage via:
 $ git log src/interface/
There were only structural changes (how to allocate, make interface accessible, global renames), but no new features "through netcf" or such post 2015 which matches when major activity there stopped.

Once again, I checked former versions this is more or less broken for a long time since NetworkManager configured devices as well as networkd configured devices are not shown.

Other drivers it only check for their old style as well - ifcfg- files (suse), and check scripts in /etc/sysconfig/network-scripts/ (redhat). None handled any other (e.g. those through wicked) configuration scheme either.

I come back to think those iface-* action in libvirt not being important for many use cases for not having broken on someone before :-/

I was also trying other interface API calls of libvirt through virsh, they are all affected in a similar way (e.g. ifup not found, ...).

## Alternatives for Libvirt ##

There is a libvirt udev based interface backend available as well meant for Distribution/Releases with no netcf support. And in some way unless we implement that we are just that now.
That switch would need to be tested as well and would effectively make this backend read-only
It supports
    .connectNumOfInterfaces = udevConnectNumOfInterfaces, /* 1.0.0 */
    .connectListInterfaces = udevConnectListInterfaces, /* 1.0.0 */
    .connectNumOfDefinedInterfaces = udevConnectNumOfDefinedInterfaces, /* 1.0.0 */
    .connectListDefinedInterfaces = udevConnectListDefinedInterfaces, /* 1.0.0 */
    .connectListAllInterfaces = udevConnectListAllInterfaces, /* 1.0.0 */
    .interfaceLookupByName = udevInterfaceLookupByName, /* 1.0.0 */
    .interfaceLookupByMACString = udevInterfaceLookupByMACString, /* 1.0.0 */
    .interfaceIsActive = udevInterfaceIsActive, /* 1.0.0 */
    .interfaceGetXMLDesc = udevInterfaceGetXMLDesc, /* 1.0.0 */
But drops transactions and:
     .interfaceDefineXML = netcfInterfaceDefineXML, /* 0.7.0 */
     .interfaceUndefine = netcfInterfaceUndefine, /* 0.7.0 */
     .interfaceCreate = netcfInterfaceCreate, /* 0.7.0 */
     .interfaceDestroy = netcfInterfaceDestroy, /* 0.7.0 */

So (if tests confirm to be ok) at the reduced functionality of no write (better than broken write still) one option we have is switching to udev backend in libvirt and completely remove netcf.

## netcf usage and implementation ##

Of the netcf API the currently used set is:
ncf_change_begin
ncf_change_commit
ncf_change_rollback
ncf_close
ncf_define
ncf_error
ncf_if_down
ncf_if_free
ncf_if_mac_string
ncf_if_name
ncf_if_status
ncf_if_undefine
ncf_if_up
ncf_if_xml_desc
ncf_if_xml_state
ncf_init
ncf_list_interfaces
ncf_lookup_by_mac_string
ncf_lookup_by_name
ncf_num_of_interfaces

All implementations use augeas to handle the config files for read as well as write.
All Debian/Ubuntu code still is on /etc/network/interfaces.

One option to consider as long as there will be ifupdown is to just depend on it to get back the support we had since the usage of networkd/NetworkManager - we would get:
- iface write support through E/N/I
- partial visiblity (devices not created through E/N/I are not visible to libvirt/netcf (as they are for quite a while). Essentially as it was since ~Xenial with nobody complaining so far.
=> But this would lock in ifupdown forever until effort is taken to e.g. implement a new backend in lbvirt or netcf.

After reading through netcf code I decided it is too much to "just switch" to a new implementation via fixes. It is essentially a new backend. Actually worse so - it is NetworkManager / Networkd / neplan backend. Netplan abstracts from the former two for us, but I'm not yet sure we can map all of the API perfectly - so this is a real a.k.a. needs to be jointly planned effort on netcf+netplan.

## TL:DR - Options I see atm ##

1. ifupdown is effectively a hard dependency of netcf, so we must add
   that dependency in packaging.
   This will fix and enable support as we had it since ~Xenial
   Libvirt is seeded, but not part of the default install, so we don't break our
   "get ifupdown out of the default install" efforts we have made.
2. We likely want to get rid of the ifupdown dependency at some point
   (later releases), options for that are:
   2A) switch in libvirt to udev backend (readonly), drop netcf lib completely
   (reduced functionality, but if we consider it almost unused anyway...?)
   2B) networkd/networkManager/netplan backend for libvirt to drop netcf from Archive
   2C) networkd/networkManager/netplan driver for netcf in a "Ubuntu" custom driver

I'd need coordination with Foundations Team on do-ability for 2B/2C.
I'd also appreciate if one would read the above and agree on #1 being the most reasonable short term fix for Bionic at least.