[libvirt] [PATCH 00/27] network: refactor to decouple virt drivers from network driver

Michal Privoznik mprivozn at redhat.com
Tue Jan 8 16:15:50 UTC 2019


On 12/24/18 3:58 PM, Daniel P. Berrangé wrote:
> Currently the network driver registers a set of callbacks with the virt
> driver in order to handle allocating/releasing network ports associated
> with guest NICs.
> 
> This series introduces a virNetworkPortPtr object and associated XML
> that describes a network port. The virt drivers now call public APIs
> associated with this new object to create/delete ports for guest NICs.
> 
> There are some parts that are not yet addressed by this series
> 
>  - The live updating of bandwidth limits on network ports
>  - The old code would re-connect VIFs to bridges, and/or change
>    bridges during startup. This code is deleted right now as it
>    doesn't belong in the network driver. It needs to move to the
>    virt drivers in some (to be determined) manner.
> 
> Daniel P. Berrangé (27):
>   conf: make virPCIDeviceAddressFormat void
>   network: restrict usage of port management APIs
>   network: pass a virNetworkPtr to port management APIs
>   conf: simplify link from hostdev back to network device
>   network: add missing bandwidth limits for bridge forward type
>   network: use 'bridge' as actual type instead of 'network'
>   virt drivers: don't handle type=network after resolving actual network
>     type
>   network: unconditionally merge port profiles
>   conf: introduce virNetworkPortDefPtr struct and XML support
>   network: stop passing virDomainNetDefPtr into bandwidth functions
>   network: make networkLogAllocation independent of domain conf
>   util: add API for copying virtual port profile data
>   conf: add APIs to convert virDomainNetDef to virNetworkPortDef
>   network: convert networkAllocateActualDevice to virNetworkPortDef
>   network: convert networkNotifyActualDevice to virNetworkPortDef
>   network: convert networkReleaseActualDevice to virNetworkPortDef
>   network: convert hook script to take a network port XML
>   network: introduce networkAllocatePort
>   network: introduce networkNotifyPort
>   network: introduce networkReleasePort
>   network: add public APIs for network port object
>   access: add permissions for network port objects
>   remote: add support for new network port APIs
>   virsh: add support for network port APIs
>   conf: support recording ports against virNetworkObjPtr
>   network: add implementation of network port APIs
>   conf: switch over to use network port APIs for virt drivers
> 
>  include/libvirt/libvirt-network.h             |   49 +
>  include/libvirt/virterror.h                   |    3 +
>  src/access/genpolkit.pl                       |    2 +-
>  src/access/viraccessdriver.h                  |    6 +
>  src/access/viraccessdrivernop.c               |   11 +
>  src/access/viraccessdriverpolkit.c            |   26 +
>  src/access/viraccessdriverstack.c             |   25 +
>  src/access/viraccessmanager.c                 |   16 +
>  src/access/viraccessmanager.h                 |    6 +
>  src/access/viraccessperm.c                    |    8 +-
>  src/access/viraccessperm.h                    |   38 +
>  src/conf/Makefile.inc.am                      |    2 +
>  src/conf/device_conf.c                        |    3 +-
>  src/conf/device_conf.h                        |    6 +-
>  src/conf/domain_conf.c                        |  413 ++++++-
>  src/conf/domain_conf.h                        |   46 +-
>  src/conf/network_conf.c                       |    7 +-
>  src/conf/storage_adapter_conf.c               |    4 +-
>  src/conf/virnetworkobj.c                      |  303 +++++
>  src/conf/virnetworkobj.h                      |   30 +
>  src/conf/virnetworkportdef.c                  |  497 ++++++++
>  src/conf/virnetworkportdef.h                  |  112 ++
>  src/datatypes.c                               |   60 +
>  src/datatypes.h                               |   41 +
>  src/driver-network.h                          |   27 +
>  src/libvirt-network.c                         |  351 ++++++
>  src/libvirt_private.syms                      |   21 +
>  src/libvirt_public.syms                       |   14 +
>  src/libxl/libxl_conf.c                        |   21 +-
>  src/libxl/libxl_domain.c                      |   28 +-
>  src/libxl/libxl_driver.c                      |   27 +-
>  src/lxc/lxc_driver.c                          |   37 +-
>  src/lxc/lxc_process.c                         |   21 +-
>  src/network/bridge_driver.c                   | 1069 +++++++++--------
>  src/qemu/qemu_command.c                       |   11 +-
>  src/qemu/qemu_domain_address.c                |    4 +-
>  src/qemu/qemu_driver.c                        |    2 +-
>  src/qemu/qemu_hotplug.c                       |   84 +-
>  src/qemu/qemu_hotplug.h                       |    2 +-
>  src/qemu/qemu_interface.c                     |   12 +-
>  src/qemu/qemu_process.c                       |   32 +-
>  src/remote/remote_daemon_dispatch.c           |   25 +
>  src/remote/remote_driver.c                    |   28 +
>  src/remote/remote_protocol.x                  |   89 +-
>  src/remote_protocol-structs                   |   47 +
>  src/rpc/gendispatch.pl                        |   18 +-
>  src/util/virerror.c                           |    9 +
>  src/util/virhook.c                            |    4 +-
>  src/util/virhook.h                            |    4 +-
>  src/util/virhostdev.c                         |   17 +-
>  src/util/virnetdevvportprofile.c              |   16 +
>  src/util/virnetdevvportprofile.h              |    2 +
>  tests/Makefile.am                             |    7 +
>  .../plug-bridge-mactbl.xml                    |    9 +
>  .../virnetworkportxml2xmldata/plug-bridge.xml |    9 +
>  .../virnetworkportxml2xmldata/plug-direct.xml |   12 +
>  .../plug-hostdev-pci.xml                      |   12 +
>  tests/virnetworkportxml2xmldata/plug-none.xml |    8 +
>  tests/virnetworkportxml2xmltest.c             |  104 ++
>  tools/virsh-completer.c                       |   51 +
>  tools/virsh-completer.h                       |    4 +
>  tools/virsh-network.c                         |  399 +++++-
>  tools/virsh-network.h                         |    5 +
>  63 files changed, 3681 insertions(+), 675 deletions(-)
>  create mode 100644 src/conf/virnetworkportdef.c
>  create mode 100644 src/conf/virnetworkportdef.h
>  create mode 100644 tests/virnetworkportxml2xmldata/plug-bridge-mactbl.xml
>  create mode 100644 tests/virnetworkportxml2xmldata/plug-bridge.xml
>  create mode 100644 tests/virnetworkportxml2xmldata/plug-direct.xml
>  create mode 100644 tests/virnetworkportxml2xmldata/plug-hostdev-pci.xml
>  create mode 100644 tests/virnetworkportxml2xmldata/plug-none.xml
>  create mode 100644 tests/virnetworkportxml2xmltest.c
> 

There are few problem with these patches (not the idea). The idea is sound.

The first is that "<plug type='bridge' bridge='virbr0'/>" is lost from 'virsh net-port-dumpxml --network default --port $UUID' on daemon restart.

The second is that a running domain is lost on daemon restart because of the bandwidth problem I'm mentioning in 09/27:

2019-01-08 16:11:44.945+0000: 127017: error : virNetDevBandwidthParse:174 : unsupported configuration: floor attribute is supported only for interfaces of type network
2019-01-08 16:11:44.945+0000: 127017: error : virDomainObjListLoadAllConfigs:628 : Failed to load config for domain 'fedora'

The third is that if there is a domain already running that was starter prior applying these patches I see the following error on daemon restart (the domain is gone too):

2019-01-08 16:11:44.946+0000: 127017: error : virDomainActualNetDefParseXML:10789 : internal error: unsupported type 'user' in interface's <actual> element
2019-01-08 16:11:44.946+0000: 127017: error : virDomainObjListLoadAllConfigs:628 : Failed to load config for domain 'gentoo'


Michal




More information about the libvir-list mailing list