1. 04 7月, 2016 4 次提交
  2. 11 5月, 2016 1 次提交
  3. 16 3月, 2016 1 次提交
    • E
      virlog: Introduce Type{To,From}String for virLogDestination · 034337fb
      Erik Skultety 提交于
      In order to refactor the ugly virLogParseOutputs method, this is a neat way of
      finding out whether the destination type (in the form of a string) user
      provided is a valid one. As a bonus, if it turns out it is valid, we get the
      actual enum which will later be passed to any of virLogAddOutput methods right
      away.
      034337fb
  4. 06 2月, 2015 1 次提交
  5. 18 3月, 2014 4 次提交
    • D
      Remove global log buffer feature entirely · c0c8c1d7
      Daniel P. Berrange 提交于
      A earlier commit changed the global log buffer so that it only
      records messages that are explicitly requested via the log
      filters setting. This removes the performance burden, and
      improves the signal/noise ratio for messages in the global
      buffer. At the same time though, it is somewhat pointless, since
      all the recorded log messages are already going to be sent to an
      explicit log output like syslog, stderr or the journal. The
      global log buffer is thus just duplicating this data on stderr
      upon crash.
      
      The log_buffer_size config parameter is left in the augeas
      lens to prevent breakage for users on upgrade. It is however
      completely ignored hereafter.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c0c8c1d7
    • D
      Switch to filtering based on log source name instead of filename · 975b2392
      Daniel P. Berrange 提交于
      Currently the log filter strings are used in a string comparison
      against the source filename each time log message is emitted.
      If no log filters at all are set, there's obviously no string
      comparison to be done. If any single log filter is set though,
      this imposes a compute burden on every logging call even if logs
      from the file in question are disabled. This string comparison
      must also be done while the logging mutex is held, which has
      implications for concurrency when multiple threads are emitting
      log messages.
      
      This changes the log filtering to be done based on the virLogSource
      object name. The virLogSource struct is extended to contain
      'serial' and 'priority' fields. Any time the global log filter
      rules are changed a global serial number is incremented. When a
      log message is emitted, the serial in the virLogSource instance
      is compared with the global serial number. If out of date, then
      the 'priority' field in the virLogSource instance is updated based
      on the new filter rules. The 'priority' field is checked to see
      whether the log message should be sent to the log outputs.
      
      The comparisons of the 'serial' and 'priority' fields are done
      with no locks held. So in the common case each logging call has
      an overhead of 2 integer comparisons, with no locks held. Only
      if the decision is made to forward the message to the log output,
      or if the 'serial' value is out of date do locks need to be
      acquired.
      
      Technically the comparisons of the 'serial' and 'priority' fields
      should be done with locks held, or using atomic operations. Both
      of these options have a notable performance impact, however, and
      since all writes a protected by a global mutex, it is believed
      that worst case behaviour where the fields are read concurrently
      with being written would merely result in an mistaken emission
      or dropping of the log message in question. This is an acceptable
      tradeoff for the performance benefit of avoiding locking.
      
      As a quick benchmark, a demo program that registers 500 file
      descriptors with the event loop (eg equiv of 500 QEMU monitor
      commands), creates pending read I/O on every FD, and then runs
      virEventRunDefaultImpl() took 4.6 seconds to do 51200 iterations.
      After this optimization it only takes 3.3 seconds, with the log
      APIs no longer being a relevant factor in the running time.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      975b2392
    • D
      Add virLogSource variables to all source files · 2835c1e7
      Daniel P. Berrange 提交于
      Any source file which calls the logging APIs now needs
      to have a VIR_LOG_INIT("source.name") declaration at
      the start of the file. This provides a static variable
      of the virLogSource type.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2835c1e7
    • D
      Turn virLogSource into a struct instead of an enum · 098dd79e
      Daniel P. Berrange 提交于
      As part of the goal to get away from doing string matching on
      filenames when deciding whether to emit a log message, turn
      the virLogSource enum into a struct which contains a log
      "name". There will eventually be one virLogSource instance
      statically declared per source file. To minimise churn in this
      commit though, a single global instance is used.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      098dd79e
  6. 01 3月, 2014 1 次提交
  7. 11 7月, 2013 1 次提交
  8. 14 6月, 2013 1 次提交
  9. 08 3月, 2013 1 次提交
  10. 21 12月, 2012 2 次提交
  11. 15 11月, 2012 2 次提交
    • M
      Add metadata to virLogOutputFunc · 37f7a1fa
      Miloslav Trmač 提交于
      ... and update all users.  No change in functionality, the parameter
      will be used in the next patch.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      37f7a1fa
    • M
      Add a metadata parameter to virLog{, V}Message · c780e9b8
      Miloslav Trmač 提交于
      ... and update all users.  No change in functionality, the parameter
      will be used later.
      
      The metadata representation is as minimal as possible, but requires
      the caller to allocate an array on stack explicitly.
      
      The alternative of using varargs in the virLogMessage() callers:
      * Would not allow the caller to optionally omit some metadata elements,
        except by having two calls to virLogMessage.
      * Would not be as type-safe (e.g. using int vs. size_t), and the compiler
        wouldn't be able to do type checking
      * Depending on parameter order:
        a) virLogMessage(..., message format, message params...,
                         metadata..., NULL)
           can not be portably implemented (parse_printf_format() is a glibc
           function)
        b) virLogMessage(..., metadata..., NULL,
                         message format, message params...)
           would prevent usage of ATTRIBUTE_FMT_PRINTF and the associated
           compiler checking.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      c780e9b8
  12. 15 10月, 2012 1 次提交
    • J
      util: switch virLogEatParams to virLogSource · a9e3b4f7
      Ján Tomko 提交于
      Commit e8fd8757 changed 'const char *'
      category to virLogSource enum. This changes it in virLogEatParams as
      well, thus fixing the build with --disable-debug.
      --
      Hopefully moving the enum declarations is less ugly than using int.
      a9e3b4f7
  13. 28 9月, 2012 7 次提交
  14. 27 9月, 2012 1 次提交
  15. 22 9月, 2012 1 次提交
    • M
      Drop unused return value of virLogOutputFunc · fca338a0
      Miloslav Trmač 提交于
      Nothing uses the return value, and creating it requries otherwise
      unnecessary strlen () calls.
      
      This cleanup is conceptually independent from the rest of the series
      (although the later patches won't apply without it).  This just seems
      a good opportunity to clean this up, instead of entrenching the unnecessary
      return value in the virLogOutputFunc instance that will be added in this
      series.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      fca338a0
  16. 21 9月, 2012 1 次提交
  17. 02 8月, 2012 1 次提交
  18. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  19. 13 7月, 2012 1 次提交
    • H
      fix failure when building with --disable-debug · 102c6941
      Hu Tao 提交于
      When building with --disable-debug, VIR_DEBUG expands to a nop.
      But parameters to VIR_DEBUG can be variables that are passed only
      to VIR_DEBUG. In the case the building system complains about unused
      variables.
      102c6941
  20. 17 5月, 2012 1 次提交
  21. 16 5月, 2012 1 次提交
    • D
      Allow stack traces to be included with log messages · 54856395
      Daniel P. Berrange 提交于
      Sometimes it is useful to see the callpath for log messages.
      This change enhances the log filter syntax so that stack traces
      can be show by setting '1:+NAME' instead of '1:NAME'.
      
      This results in output like:
      
      2012-05-09 14:18:45.136+0000: 13314: debug : virInitialize:414 : register drivers
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virInitialize+0xd6)[0x7f89188ebe86]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x431921]
      /lib64/libc.so.6(__libc_start_main+0xf5)[0x3a21e21735]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x40a279]
      
      2012-05-09 14:18:45.136+0000: 13314: debug : virRegisterDriver:775 : driver=0x7f8918d02760 name=Test
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virRegisterDriver+0x6b)[0x7f89188ec717]
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(+0x11b3ad)[0x7f891891e3ad]
      /home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virInitialize+0xf3)[0x7f89188ebea3]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x431921]
      /lib64/libc.so.6(__libc_start_main+0xf5)[0x3a21e21735]
      /home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x40a279]
      
      * docs/logging.html.in: Document new syntax
      * configure.ac: Check for execinfo.h
      * src/util/logging.c, src/util/logging.h: Add support for
        stack traces
      * tests/testutils.c: Adapt to API change
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      54856395
  22. 29 9月, 2011 1 次提交
  23. 13 7月, 2011 1 次提交
    • E
      util: reject unknown flags, and prefer unsigned flags · 833fe8ab
      Eric Blake 提交于
      Silently ignored flags get in the way of new features that
      use those flags.  Also, an upcoming syntax check will favor
      unsigned flags.
      
      * src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Drop
      unused attribute.
      * src/interface/netcf_driver.c (interfaceOpenInterface)
      (interfaceDefineXML, interfaceCreate, interfaceDestroy): Reject
      unknown flags.
      * src/network/bridge_driver.c (networkOpenNetwork)
      (networkGetXMLDesc): Likewise.
      * src/nwfilter/nwfilter_driver.c (nwfilterOpen): Likewise.
      * src/secret/secret_driver.c (secretOpen, secretDefineXML)
      (secretGetXMLDesc, secretSetValue): Likewise.
      * src/util/logging.c (virLogDefineFilter, virLogDefineOutput)
      (virLogMessage): Likewise; also use unsigned flags.
      * src/util/logging.h (virLogDefineFilter, virLogDefineOutput)
      (virLogMessage): Change signature.
      * src/util/command.c (virExecWithHook): Likewise.
      833fe8ab
  24. 12 5月, 2011 2 次提交
    • E
      build: avoid gcc preprocessor extensions · bc6bfeaa
      Eric Blake 提交于
      Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by
      C99; thankfully, we can avoid it by lumping the format argument
      into the var-args set.
      
      * src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT)
      (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick
      to C99 var-arg macro syntax.
      * examples/domain-events/events-c/event-test.c (VIR_DEBUG):
      Simplify.
      bc6bfeaa
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  25. 15 3月, 2011 1 次提交
    • D
      Allow to dynamically set the size of the debug buffer · b16f47ab
      Daniel Veillard 提交于
      This is the part allowing to dynamically resize the debug log
      buffer from it's default 64kB size. The buffer is now dynamically
      allocated.
      It adds a new API virLogSetBufferSize() which resizes the buffer
      If passed a zero size, the buffer is deallocated and we do the small
      optimization of not formatting messages which are not output anymore.
      On the daemon side, it just adds a new option log_buffer_size to
      libvirtd.conf and call virLogSetBufferSize() if needed
      * src/util/logging.h src/util/logging.c src/libvirt_private.syms:
        make buffer dynamic and add virLogSetBufferSize() internal API
      * daemon/libvirtd.conf: document the new log_buffer_size option
      * daemon/libvirtd.c: read and use the new log_buffer_size option
      b16f47ab