[libvirt] [PATCH 00/38] Introduce APIs to change daemon's logging settings

Erik Skultety eskultet at redhat.com
Thu Mar 31 17:48:33 UTC 2016


This series implements administration APIs to modify daemon's logging settings
which include priority, filters, and outputs. It also performs all necessary
changes to enable this feature. Patches also involve some slight refactors
to the existing code as well as wiring up the APIs to virt-admin client.

The major change in internal code is how definition of filters and outputs is
achieved. Until now each filter/output has been defined and appended to the
global set of filters/outputs individually whilst holding a lock that was
repeatedly released after each filter/output. If modification to filters and
outputs should be exported through public APIs, all these setter operations
must be atomic, i.e. accomplished as a unit, not gradually. For filters and
priority, these are replaced normally, i.e. reset the original and replace it
with the new copy while having the lock. For outputs, there was a slight issue,
since resetting the global set of outputs would result in closing all the file
descriptors, which might not be exactly what we want, since the new set of
outputs that is meant to replace the original set might include outputs that
are also contained within the original set. The logic for such outputs is
following:

Each file-based output that already exists in the original set and
should continue existing in the new set will copy the existing FD from the
global set. For each syslog-based output, closelog and openlog must be called
anyway (because syslog keeps its FD private), but will be called at
the very last moment if such an output already exists to prevent from changing
before the lock for unit replaced is acquired, and thus breaking the atomicity
that we want. For journald-based outputs, the FD is global, we just need to
prevent it from being closed if such an output shall continue to exist.
All outputs that need to continue to exist are prevented from closing when
being destroyed-deallocated. On the other hand, all outputs that do not exist
in the new set of outputs shall be closed correctly.

Erik Skultety (38):
  virlog: Return void instead of int in virLogReset<Foo> methods
  virlog: Convert virLogOutputs to a list of pointers to outputs
  virlog: Convert virLogFilters to a list of pointers to filters
  virlog: Export virLogOutputPtr through header
  virlog: Export virLogFilterPtr through header
  virlog: Introduce virLogSetFilters
  virlog: Introduce virLogSetOutputs
  daemon: Replace virLogParseOutputs with virLogSetOutputs in callers
  daemon: Replace virLogParseFilters with virLogSetFilters in callers
  virlog: Introduce virLogDefineOutputs
  virlog: Introduce virLogDefineFilters
  virlog: Rename virLogAddOutputTo to virLogNewOutput
  virlog: Rename virLogDefineOutput to virLogOutputNew
  virlog: Rename virLogDefineFilter to virLogFilterNew
  virlog: Introduce virLogOutputFree
  virlog: Introduce virLogOutputListFree
  virlog: Introduce virLogFilterFree
  virlog: Introduce virLogFilterListFree
  virlog: Make virLogReset methods use of virLog(Output|Filter)ListFree
  virlog: Split output parsing and output defining to separate
    operations
  virlog: Split filter parsing and filter defining to separate
    operations
  virlog: Split parsing and setting priority
  virlog: Introduce virLogOutputExists
  virlog: Make use of virLogOutputExists
  virlog: Take a special care of syslog when setting new set of log
    outputs
  virlog: Swap the new copy of outputs with the global existing one
  virlog: Rename virLogFiltersSerial to virLogSerial
  virlog: Make virLogSetDefaultPriority trigger source update as well
  virlog: Introduce an API mutex that serializes all setters
  virlog: Acquire virLogAPILock in each setter API
  admin: Introduce virAdmConnectGetLoggingLevel
  admin: Introduce virAdmConnectGetLoggingFilters
  admin: Introduce virAdmConnectGetLoggingOutputs
  admin: Introduce virAdmConnectSetLoggingLevel
  admin: Introduce virAdmConnectSetLoggingFilters
  admin: Introduce virAdmConnectSetLoggingOutputs
  admin: Export logging level constants via libvirt-admin.h
  virt-admin: Wire-up the logging APIs

 daemon/admin.c                  | 125 +++++++
 daemon/libvirtd.c               |   8 +-
 include/libvirt/libvirt-admin.h |  37 +++
 src/admin/admin_protocol.x      |  73 ++++-
 src/admin/admin_remote.c        |  86 +++++
 src/admin_protocol-structs      |  38 +++
 src/libvirt-admin.c             | 219 +++++++++++++
 src/libvirt_admin_private.syms  |   9 +
 src/libvirt_admin_public.syms   |   6 +
 src/libvirt_private.syms        |  14 +-
 src/locking/lock_daemon.c       |   8 +-
 src/logging/log_daemon.c        |   8 +-
 src/util/virlog.c               | 698 +++++++++++++++++++++++++++-------------
 src/util/virlog.h               |  50 +--
 tests/eventtest.c               |   3 +-
 tests/testutils.c               |  19 +-
 tests/virlogtest.c              |  12 +-
 tools/virt-admin.c              | 208 ++++++++++++
 18 files changed, 1361 insertions(+), 260 deletions(-)

-- 
2.4.3




More information about the libvir-list mailing list