[PATCH 00/33] Remove the now misleading virReportOOMError infra

Peter Krempa pkrempa at redhat.com
Wed Feb 24 16:16:35 UTC 2021


'virReportOOMError' is nowadays mostly useless since an OOM error will
trigger yet another allocation failure in the logger when attempting to
log the error.

Additionally it was also used in few places which can fail with other
failures than OOM.

To prevent both errorneous usage types, let's remove it completely. In
the rare case we'd want to allocate a massive buffer and want to fail
gracefully we still can use virReportError with VIR_ERR_NO_MEMORY.

The series starts by some cleanup, then removes error handling from
places where it's now dead code as we'll abort before the reporting,
then converts some real OOM scenarios to abort() directly and lastly
fixes the error message for cases where other errors are possible and
lastly removes virReportOOMError.

Pipelines are stuck, so hopefully it will go through:
https://gitlab.com/pipo.sk/libvirt/-/pipelines/261161989

Peter Krempa (33):
  Remove useless comments for VIR_FROM_THIS definition
  util: xml: Introduce autoptr cleanup support for 'xmlNode'
  virDomainDefSetMetadata: Avoid temporary variable for string copy
  virCommandAddEnv: Make stealing of argument more obvious
  virCommandAddArgBuffer: Simplify clearing of @buf
  virCPUx86DataParse: Don't check error from x86FeatureNames
  virhostcputest: linuxCPUStatsCompareFiles: Don't check return value of
    virBufferContentAndReset
  virBuildPath: Remove return value
  lxc_process: Remove OOM handling from logging setup
  virDomainDefSetMetadata: Rework memory handling
  util: vircommand: Remove OOM handling
  virCloseCallbacksGetForConn: Remove OOM handling
  virfirewall: Don't check OOM in ADD_ARG macro
  virfirewall: Remove OOM checks from virFirewallStartTransaction
  virfirewall: virFirewallAddRuleFullV: Remove OOM check from
    VIR_APPEND_ELEMENT
  virfirewall: Remove impossible OOM error reporting
  util: virnetlink: Add wrapper for 'nlmsg_alloc_simple'
  util: xml: Add virXMLBufferCreate wrapper
  util: xml: Add wrapper for 'xmlNewNode'
  Don't report OOM error on xmlCopyNode failure
  virXMLXPathContextNew: abort() on allocation failure
  virXMLParseHelper: abort() on allocation failure
  util: virprocess: abort() on CPU_ALLOC failure
  virURIFormat: abort() on failure
  util: iohelper: Don't handle OOM from posix_memalign
  hyperv: abort() failure of wsmc_fault_new()
  vbox: abort() on allocation failure in UTF8<->UTF16 conversion
  libxl: abort() on failure of libxl_cpu_bitmap_alloc()
  virVBoxSnapshotConfSaveVboxFile: abort() on failure to allocate xmlDoc
    and comment
  util: json: Report non-OOM error on yajl failure
  storage: Don't report OOM error on failure of glfs_new
  virVMXConvertToUTF8: Report non-OOM error on failure of
    xmlBufferCreateStatic
  util: virerror: Remove virReportOOMError

 build-aux/syntax-check.mk                     |   8 --
 docs/internals/command.html.in                |   8 +-
 src/conf/domain_conf.c                        |  62 ++++-----
 src/conf/network_conf.c                       |   5 +-
 src/cpu/cpu_x86.c                             |   6 +-
 src/hyperv/hyperv_wmi.c                       |   8 +-
 src/hypervisor/virclosecallbacks.c            |  15 +--
 src/libvirt_private.syms                      |   3 +-
 src/libxl/libxl_conf.c                        |   6 +-
 src/libxl/libxl_driver.c                      |   7 +-
 src/lxc/lxc_process.c                         |   9 +-
 src/storage/storage_backend_gluster.c         |   3 +-
 .../storage_file_backend_gluster.c            |   3 +-
 src/test/test_driver.c                        |   6 +-
 src/util/iohelper.c                           |   7 +-
 src/util/vircommand.c                         | 119 +++++-------------
 src/util/virerror.c                           |  22 ----
 src/util/virerror.h                           |   8 --
 src/util/virfcp.c                             |   3 +-
 src/util/virfile.c                            |   7 +-
 src/util/virfile.h                            |   2 +-
 src/util/virfirewall.c                        |  62 ++-------
 src/util/virhook.c                            |  14 +--
 src/util/virjson.c                            |   6 +-
 src/util/virnetdev.c                          |  18 +--
 src/util/virnetdevbridge.c                    |  10 +-
 src/util/virnetdevip.c                        |  15 +--
 src/util/virnetdevvportprofile.c              |   6 +-
 src/util/virnetlink.c                         |  38 +++---
 src/util/virnetlink.h                         |   4 +
 src/util/virpci.c                             |  12 +-
 src/util/virprocess.c                         |  12 +-
 src/util/virscsi.c                            |   1 -
 src/util/virscsivhost.c                       |   1 -
 src/util/viruri.c                             |   8 +-
 src/util/virxml.c                             |  44 ++++---
 src/util/virxml.h                             |   8 ++
 src/vbox/vbox_common.c                        |  20 ---
 src/vbox/vbox_common.h                        |  15 ++-
 src/vbox/vbox_snapshot_conf.c                 |  46 ++-----
 src/vmx/vmx.c                                 |   9 +-
 tests/virhostcputest.c                        |   5 +-
 tools/virsh-domain.c                          |   5 +-
 43 files changed, 214 insertions(+), 462 deletions(-)

-- 
2.29.2




More information about the libvir-list mailing list