1. 21 10月, 2013 1 次提交
  2. 14 10月, 2013 2 次提交
    • D
      Initialize threading & error layer in LXC controller · 97973ebb
      Daniel P. Berrange 提交于
      In Fedora 20, libvirt_lxc crashes immediately at startup with a
      trace
      
       #0  0x00007f0cddb653ec in free () from /lib64/libc.so.6
       #1  0x00007f0ce0e16f4a in virFree (ptrptr=ptrptr@entry=0x7f0ce1830058) at util/viralloc.c:580
       #2  0x00007f0ce0e2764b in virResetError (err=0x7f0ce1830030) at util/virerror.c:354
       #3  0x00007f0ce0e27a5a in virResetLastError () at util/virerror.c:387
       #4  0x00007f0ce0e28858 in virEventRegisterDefaultImpl () at util/virevent.c:233
       #5  0x00007f0ce0db47c6 in main (argc=11, argv=0x7fff4596c328) at lxc/lxc_controller.c:2352
      
      Normally virInitialize calls virErrorInitialize and
      virThreadInitialize, but we don't link to libvirt.so
      in libvirt_lxc, and nor did we ever call the error
      or thread initializers.
      
      I have absolutely no idea how this has ever worked, let alone
      what caused it to stop working in Fedora 20.
      
      In addition not all code paths from virLogSetFromEnv will
      ensure virLogInitialize is called correctly, which is another
      possible crash scenario.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      97973ebb
    • D
      Fix flaw in detecting log format · 5787f0b9
      Daniel P. Berrange 提交于
      The log message regex has been
      
      [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{4}: [0-9]+: debug|info|warning|error :
      
      The precedence of '|' is high though, so this is equivalent to matching
      
         [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\+[0-9]{4}: [0-9]+: debug
      
      Or
      
         info
      
      Or
      
         warning
      
      Or
      
         error :
      
      Which is clearly not what it should have done. This caused the code to
      skip over things which are not log messages. The solution is to simply
      add brackets.
      
      A test case is also added to validate correctness.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5787f0b9
  3. 05 9月, 2013 1 次提交
  4. 02 8月, 2013 1 次提交
  5. 11 7月, 2013 1 次提交
  6. 10 7月, 2013 2 次提交
  7. 14 6月, 2013 1 次提交
  8. 06 6月, 2013 1 次提交
  9. 28 5月, 2013 1 次提交
    • E
      syntax: prefer space after semicolon in for loop · 146ba114
      Eric Blake 提交于
      I noticed several unusual spacings in for loops, and decided to
      fix them up.  See the next commit for the syntax check that found
      all of these.
      
      * examples/domsuspend/suspend.c (main): Fix spacing.
      * python/libvirt-override.c: Likewise.
      * src/conf/interface_conf.c: Likewise.
      * src/security/virt-aa-helper.c: Likewise.
      * src/util/virconf.c: Likewise.
      * src/util/virhook.c: Likewise.
      * src/util/virlog.c: Likewise.
      * src/util/virsocketaddr.c: Likewise.
      * src/util/virsysinfo.c: Likewise.
      * src/util/viruuid.c: Likewise.
      * src/vbox/vbox_tmpl.c: Likewise.
      * src/xen/xen_hypervisor.c: Likewise.
      * tools/virsh-domain-monitor.c (vshDomainStateToString): Drop
      default case, to let compiler check us.
      * tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      146ba114
  10. 24 5月, 2013 1 次提交
  11. 07 5月, 2013 1 次提交
  12. 03 5月, 2013 1 次提交
    • E
      build: avoid non-portable cast of pthread_t · 22d12905
      Eric Blake 提交于
      POSIX says pthread_t is opaque.  We can't guarantee if it is scaler
      or a pointer, nor what size it is; and BSD differs from Linux.
      We've also had reports of gcc complaining on attempts to cast it,
      if we use a cast to the wrong type (for example, pointers have to be
      cast to void* or intptr_t before being narrowed; while casting a
      function return of scalar pthread_t to void* triggers a different
      warning).
      
      Give up on casts, and use unions to get at decent bits instead.  And
      rather than futz around with figuring which 32 bits of a potentially
      64-bit pointer are most likely to be unique, convert the rest of
      the code base to use 64-bit values when using a debug id.
      
      Based on a report by Guido Günther against kFreeBSD, but with a
      fix that doesn't regress commit 4d970fd2 for FreeBSD.
      
      * src/util/virthreadpthread.c (virThreadSelfID, virThreadID): Use
      union to get at a decent bit representation of thread_t bits.
      * src/util/virthread.h (virThreadSelfID, virThreadID): Alter
      signature.
      * src/util/virthreadwin32.c (virThreadSelfID, virThreadID):
      Likewise.
      * src/qemu/qemu_domain.h (qemuDomainJobObj): Alter type of owner.
      * src/qemu/qemu_domain.c (qemuDomainObjTransferJob)
      (qemuDomainObjSetJobPhase, qemuDomainObjReleaseAsyncJob)
      (qemuDomainObjBeginNestedJob, qemuDomainObjBeginJobInternal): Fix
      clients.
      * src/util/virlog.c (virLogFormatString): Likewise.
      * src/util/vireventpoll.c (virEventPollInterruptLocked):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      22d12905
  13. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  14. 23 4月, 2013 1 次提交
  15. 27 3月, 2013 1 次提交
    • J
      log: Separate thread ID from timestemp in ring buffer · a1fe02f0
      Jiri Denemark 提交于
      When we write a log message into a log, we separate thread ID from
      timestamp using ": ". However, when storing the message into the ring
      buffer, we omitted the separator, e.g.:
      
          2013-02-27 11:49:11.852+00003745: ...
      a1fe02f0
  16. 14 3月, 2013 1 次提交
  17. 08 3月, 2013 1 次提交
  18. 30 1月, 2013 1 次提交
    • D
      virlog: remove old code comment · 1c23ba28
      Doug Goldstein 提交于
      Setting the log output prefix to 0 is not supported and in fact results
      in the following message:
      warning : virLogParseOutputs:1021 : Ignoring invalid log output setting.
      1c23ba28
  19. 21 12月, 2012 6 次提交
  20. 15 11月, 2012 3 次提交
    • M
      Use helper functions to format the journal iov array · 39c814ff
      Miloslav Trmač 提交于
      This simplifies the top-level code, at the cost of using a little more
      stack space.  The primary benefit is being able to send more fields
      without knowing in advance how many of them, and of which types, these
      fields will be, and without having to individually add buffer variables.
      
      The code imposes an upper limit on the total number of iovs/buffers
      used, and fields that wouldn't fit are silently dropped.  This is not
      significant in this patch, but will affect the following one.
      Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
      39c814ff
    • 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
  21. 02 11月, 2012 4 次提交
  22. 26 10月, 2012 1 次提交
    • C
      daemon: Fix LIBVIRT_DEBUG=1 default output · eba36a38
      Cole Robinson 提交于
      This commit changes the behavior of LIBVIRT_DEBUG=1 libvirtd:
      
      $ git show 7022b091
      commit 7022b091
      Author: Daniel P. Berrange <berrange@redhat.com>
      Date:   Thu Sep 27 13:13:09 2012 +0100
      
          Automatically enable systemd journal logging
      
          Probe to see if the systemd journal is accessible, and if
          so enable logging to the journal by default, rather than
          stderr (current default under systemd).
      
      Previously  'LIBVIRT_DEBUG=1 /usr/sbin/libvirtd' would show all debug
      output to stderr, now it send debug output to the journal.
      
      Only use the journal by default if running in daemon mode, or
      if stdin is _not_ a tty. This should make libvirtd launched from
      systemd use the journal, but preserve the old behavior in most
      situations.
      eba36a38
  23. 12 10月, 2012 1 次提交
  24. 02 10月, 2012 1 次提交
    • E
      build: avoid journald on rhel 5 · cd1e8d1c
      Eric Blake 提交于
      Commit f6430390 broke builds on RHEL 5, where glibc (2.5) is too
      old to support mkostemp (2.7) or htole64 (2.9).  While gnulib
      has mkostemp, it still lacks htole64; and it's not worth dragging
      in replacements on systems where journald is unlikely to exist
      in the first place, so we just use an extra configure-time check
      as our witness of whether to attempt compiling the code.
      
      * src/util/logging.c (virLogParseOutputs): Don't attempt to
      compile journald on older glibc.
      * configure.ac (AC_CHECK_DECLS): Check for htole64.
      cd1e8d1c
  25. 28 9月, 2012 4 次提交
    • D
      Add systemd journal support · f6430390
      Daniel P. Berrange 提交于
      Add support for logging to the systemd journal, using its
      simple client library. The benefit over syslog is that it
      accepts structured log data, so the journald can store
      individual items like code file/line/func separately from
      the string message. Tools which require structured log
      data can then query the journal to extract exactly what
      they desire without resorting to string parsing
      
      While systemd provides a simple client library for logging,
      it is more convenient for libvirt to directly write its
      own client code. This lets us build up the iovec's on
      the stack, avoiding the need to alloc memory when writing
      log messages.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f6430390
    • D
      Change logging category parameter into an enum · e8fd8757
      Daniel P. Berrange 提交于
      The 'const char *category' parameter only has a few possible
      values now that the filename has been separated. Turn this
      parameter into an enum instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e8fd8757
    • D
      Include filename explicitly in logging APIs · 0225c566
      Daniel P. Berrange 提交于
      Currently the logging APIs have a 'const char *category' parameter
      which indicates where the log message comes from. This is typically
      a combination of the __FILE__ string and other prefix. Split the
      __FILE__ off into a dedicated parameter so it can passed to the
      log outputs
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      0225c566
    • D
      Whitespace cleanup in logging files · 96a1be95
      Daniel P. Berrange 提交于
      General whitespace cleanup in the logging files
      
       - Move '{' to a new line after funtion declaration
       - Put each parameter on a new line to avoid long lines
       - Put return type on new line
       - Leave 2 blank lines between functions
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      96a1be95