[PATCH 00/37] qemu: Improve 'qemuFDPass' usability and refactor interface code to use it

Peter Krempa pkrempa at redhat.com
Tue May 10 15:19:36 UTC 2022


This series modifies qemuFDPass to be a bit more convenient to use by
e.g. remembering the maximum fd set index currently used across libvirtd
restarts so that we can avoid having to pass the FDs before actually
constructing the device properties.

Along with that this code refactors the handling of FDs used for network
interfaces. There was a substantial amount of duplicated code with
plethora of helper variables and such. By converting to qemuFDPass
stored in the private data we can simplify the functions.

Peter Krempa (37):
  qemu_fd: Add return value handling for qemuFDPassTransfer* APIs
  qemu_fd: Add validation before transferring file descriptors
  qemu_fd: Remove error checking from qemuFDPassAddFD
  qemuDomainAttachNetDevice: Use 'qemuFDPass' for the vdpa file
    descriptor
  qemu: monitor: Don't parse actual fd's from query-fdsets/add-fd
    replies
  qemuMonitorJSONQueryFdsets: Ensure that JSON arrays are valid before
    using them
  qemu: domain: Store and update 'fdsetindex' across libvirtd restarts
  qemu_fd: Don't rely on fdset id allocation by qemu
  qemuMonitorAddFileHandleToSet: Remove return of 'qemuMonitorAddFdInfo'
  qemuFDPassTransferMonitor: Close local copy of the FD as soon as it's
    passed to qemu
  qemu: Clear 'qemuFDPass' helpers of char devices when no longer needed
  qemu: domain: Add qemuFDPass helpers into network private data
  qemu: command: Introduce 'qemuBuildInterfaceConnect' helper
  qemuBuildInterfaceConnect: Connect to 'vdpa' netdev
  qemuBuildHostNetProps: Move all 'tap' code together
  qemuBuildHostNetProps: Refactor construction of tapfd/vhostfd
    arguments
  qemuDomainAttachNetDevice: Don't construct network device properties
    under monitor lock
  qemu: Prepare netdev code for use of qemuFDPass for tapfd/vhostfd
    passing
  qemuBuildNicDevProps: Don't pass 'vhostfdSize'
  qemuInterfaceOpenVhostNet: Reformat error messages per new guidelines
  qemu: Move opening of vhost file descriptors for net devices into
    qemuBuildInterfaceConnect
  qemuDomainAttachNetDevice: Remove 'vhostfd' machinery
  qemuBuildInterfaceCommandLine: Remove 'vhostfd' machinery
  qemuBuildHostNetProps: Remove 'vhostfd' machinery
  qemuMonitorAddNetdev: Remove 'vhostfd' machinery
  qemu: Move opening of tap file descriptors for net devices into
    qemuBuildInterfaceConnect
  qemuBuildInterfaceCommandLine: Remove 'tapfd' infrastructure
  qemuDomainAttachNetDevice: Remove unused 'tapfd' infrastructure
  qemuBuildNicDevProps: Remove unused 'tapfd' infrastructure
  qemuMonitorAddNetdev: Remove unused 'tapfd' infrastructure
  qemuInterfacePrepareSlirp: Directly populate the 'slirp' variable in
    network private data
  qemuSlirpStart: Simplify parameters
  qemu: slirp: Call qemuSlirpOpen directly from qemuSlirpStart
  qemu: slirp: Pass FDs to qemu via qemuFDPass in the network private
    data
  qemuDomainAttachNetDevice: Clean up unneeded 'slirp' helper variables
  qemuMonitorAddNetdev: Remove unneeded 'slirp' variables and useless
    debug
  qemu: slirp: Remove unused 'qemuSlirpGetFD'

 src/qemu/qemu_command.c                       | 393 +++++++++---------
 src/qemu/qemu_command.h                       |  15 +-
 src/qemu/qemu_domain.c                        |  34 +-
 src/qemu/qemu_domain.h                        |  14 +-
 src/qemu/qemu_extdevice.c                     |  13 +-
 src/qemu/qemu_fd.c                            | 118 +++---
 src/qemu/qemu_fd.h                            |   7 +-
 src/qemu/qemu_hotplug.c                       | 172 ++------
 src/qemu/qemu_interface.c                     |  83 ++--
 src/qemu/qemu_interface.h                     |   9 +-
 src/qemu/qemu_monitor.c                       |  50 +--
 src/qemu/qemu_monitor.h                       |  14 +-
 src/qemu/qemu_monitor_json.c                  |  78 +---
 src/qemu/qemu_monitor_json.h                  |   3 +-
 src/qemu/qemu_process.c                       |  47 ++-
 src/qemu/qemu_slirp.c                         |  30 +-
 src/qemu/qemu_slirp.h                         |  10 +-
 tests/qemuhotplugtest.c                       |   1 +
 tests/qemumonitorjsontest.c                   |   3 -
 .../qemustatusxml2xmldata/backup-pull-in.xml  |   1 +
 .../blockjob-blockdev-in.xml                  |   1 +
 .../blockjob-mirror-in.xml                    |   1 +
 .../migration-in-params-in.xml                |   1 +
 .../migration-out-nbd-bitmaps-in.xml          |   1 +
 .../migration-out-nbd-out.xml                 |   1 +
 .../migration-out-nbd-tls-out.xml             |   1 +
 .../migration-out-params-in.xml               |   1 +
 tests/qemustatusxml2xmldata/modern-in.xml     |   1 +
 tests/qemustatusxml2xmldata/upgrade-out.xml   |   1 +
 .../qemustatusxml2xmldata/vcpus-multi-in.xml  |   1 +
 .../net-eth-unmanaged-tap.args                |   2 +-
 tests/qemuxml2argvdata/user-aliases.args      |   2 +-
 tests/qemuxml2argvmock.c                      |  28 +-
 tests/testutilsqemu.c                         |   6 +-
 34 files changed, 502 insertions(+), 641 deletions(-)

-- 
2.35.1



More information about the libvir-list mailing list