1. 23 6月, 2011 2 次提交
    • S
      cleanup: make nlComm commonly available · 6a597883
      Stefan Berger 提交于
      In a first cleanup step, make nlComm from macvtap.c commonly available
      for other code to use. Since nlComm uses Linux-specific structures as
      parameters it's prototype is only visible on Linux.
      6a597883
    • D
      Remove macvtap dependency on domain configuration · caf808c7
      Daniel P. Berrange 提交于
      Files under src/util must not depend on src/conf
      Solve the macvtap problem by moving the definition
      of macvtap modes from domain_conf.h into macvtap.h
      
      * src/util/macvtap.c, src/util/macvtap.h: Add enum
        for macvtap modes
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Remove
        enum for macvtap modes
      caf808c7
  2. 22 6月, 2011 1 次提交
  3. 21 6月, 2011 3 次提交
    • D
      set and restore MAC address of a NIC when using PASSTHROUGH mode · cbd8227e
      Dirk Herrendoerfer 提交于
      The following patch addresses the problem that when a PASSTHROUGH
      mode DIRECT NIC connection is made the MAC address of the NIC is
      not automatically set and reset to the configured VM MAC and
      back again.
      
      The attached patch fixes this problem by setting and resetting the MAC
      while remembering the previous setting while the VM is running.
      This also works if libvirtd is restarted while the VM is running.
      
      the patch passes make syntax-check
      cbd8227e
    • C
      events: Correct virEventAddTimeout docs · 27e47955
      Cole Robinson 提交于
      27e47955
    • C
      Promote virEvent*Handle/Timeout to public API · 6094ad7b
      Cole Robinson 提交于
      Since we virEventRegisterDefaultImpl is now a public API, callers need
      a way to invoke the default registered Handle and Timeout functions. We
      already have general functions for these internally, so promote
      them to the public API.
      
      v2:
          Actually add APIs to libvirt.h
      6094ad7b
  4. 17 6月, 2011 1 次提交
    • D
      Fix errno return in safezero() · a8182206
      Daniel P. Berrange 提交于
      Most of the safezero() implementations return -1 on error,
      setting errno. The safezero() impl using posix_fallocate()
      though returned a positive errno value on error (due to
      the unusual API contract of posix_fallocate() compared to
      most syscall APIs).
      
      * src/util/util.c: Ensure safezero() returns -1 and sets
        errno on error.
      * src/storage/storage_backend.c: Change safezero != 0 to
        < 0 for detecting errors
      a8182206
  5. 14 6月, 2011 4 次提交
    • E
      command: avoid double close · f3d67544
      Eric Blake 提交于
      Previously, the parent process opened 'null' to /dev/null, then
      the child process closes 'null' as well as 'childout'.  But if
      childout was set to be null, then this is a double close.  At
      least the double close was confined to the child process after a
      fork, and therefore there is no risk of another thread opening
      an fd of the same value to be bitten by the double close, but it
      is always better to avoid double-close to begin with.
      
      Additionally, if all three fds were specified, then opening
      'null' was wasted.
      
      This patch fixes things to lazily open null on the first use,
      then guarantees it gets closed exactly once.
      
      * src/util/command.c (getDevNull): New helper function.
      (virExecWithHook): Use it to avoid spurious opens and double close.
      f3d67544
    • E
      command: reduce duplicated debug messages · c668c897
      Eric Blake 提交于
      This also reduces malloc pressure for invoking a child when
      VIR_DEBUG is enabled.
      
      * src/util/command.c (virExecWithHook): Drop debug, since the only
      caller (virCommandRunAsync) also prints debug info.
      c668c897
    • O
      util: Cleanup indention problem in virterror.c · e22a6e9d
      Osier Yang 提交于
      Push under trivial rule.
      e22a6e9d
    • S
      qemu: Faster response time to qemu startup errors · f5358fdc
      Stefan Berger 提交于
      The below patch decreases the response time of libvirt to errors reported by Qemu upon startup by checking whether the qemu process is still alive while polling for the local socket to show up.
      
      This patch also introduces a special handling of signal for the Win32 part of virKillProcess.
      f5358fdc
  6. 13 6月, 2011 2 次提交
  7. 08 6月, 2011 4 次提交
    • E
      uuid: annotate non-null requirements · 208a6756
      Eric Blake 提交于
      Coverity already saw through a NULL dereference without these
      annotations, and gcc is still too puny to do good NULL analysis.
      But clang still benefits (and is easier to run than coverity),
      not to mention that adding this bit of documentation to the code
      may help future developers remember the constraints.
      
      * src/util/uuid.h (virGetHostUUID, virUUIDFormat): Document
      restrictions, for improved static analysis.
      208a6756
    • E
      build: silence coverity false positive · f876c30c
      Eric Blake 提交于
      Similar in nature to commit fd21ecfd, which shut up valgrind.
      
      sigaction is apparently a nasty interface for analyzer tools,
      at least for how many false positives it generates.
      
      * src/util/command.c (virExecWithHook): Initialize entire var, since
      coverity gripes about the (unused and non-standard) sa_restorer.
      f876c30c
    • E
      storage: avoid mishandling backing store > 2GB · 54456cc0
      Eric Blake 提交于
      Detected by Coverity.  The code was doing math on shifted unsigned
      char (which promotes to int), then promoting that to unsigned long
      during assignment to size.  On 64-bit platforms, this risks sign
      extending values of size > 2GiB.  Bug present since commit
      489fd3 (v0.6.0).
      
      I'm not sure if a specially-crafted bogus qcow2 image could
      exploit this, although it's probably not possible, since we
      were already checking for the computed results being within
      range of our fixed-size buffer.
      
      * src/util/storage_file.c (qcowXGetBackingStore): Avoid sign
      extension.
      54456cc0
    • C
      Move virRun, virExec*, virFork to util/command · 02e86910
      Cole Robinson 提交于
      Seems reasonable to have all command wrappers in the same place
      
      v2:
          Dont move SetInherit
      
      v3:
          Comment spelling fix
          Adjust WARN0 comment
          Remove spurious #include movement
          Don't include sys/types.h
          Combine virExec enums
      Signed-off-by: NCole Robinson <crobinso@redhat.com>
      02e86910
  8. 07 6月, 2011 2 次提交
  9. 03 6月, 2011 3 次提交
    • E
      build: silence coverity false positive · 89e651fa
      Eric Blake 提交于
      Coverity complained that infd could be -1 at the point where it is
      passed to write, when in reality, this code can only be reached if
      infd is non-negative.
      
      * src/util/command.c (virCommandProcessIO): Help out coverity.
      89e651fa
    • E
      storage: avoid memory leak on stat failure · f515bab7
      Eric Blake 提交于
      Spotted by coverity.  Triggers on failed stat, although I'm not sure
      how easy that condition is, so I'm not sure if this is a runtime
      memory hog.  Regression introduced in commit 8077d64f (unreleased).
      
      * src/util/storage_file.c (virStorageFileGetMetadataFromFD):
      Reduce need for malloc, avoiding a leak.
      f515bab7
    • E
      command: avoid leak on failure · bb889529
      Eric Blake 提交于
      Detected by Coverity.  While it is possible on OOM condition, as
      well as with bad code that passes binary == NULL, it is unlikely
      to be encountered in the wild.
      
      * src/util/command.c (virCommandNewArgList): Don't leak memory.
      bb889529
  10. 02 6月, 2011 2 次提交
    • D
      Basic framework for lock manager plugins · 6a943419
      Daniel P. Berrange 提交于
      Define the basic framework lock manager plugins. The
      basic plugin API for 3rd parties to implemented is
      defined in
      
        src/locking/lock_driver.h
      
      This allows dlopen()able modules for alternative locking
      schemes, however, we do not install the header. This
      requires lock plugins to be in-tree allowing changing of
      the lock manager plugin API in future.
      
      The libvirt code for loading & calling into plugins
      is in
      
        src/locking/lock_manager.{c,h}
      
      * include/libvirt/virterror.h, src/util/virterror.c: Add
        VIR_FROM_LOCKING
      * src/locking/lock_driver.h: API for lock driver plugins
        to implement
      * src/locking/lock_manager.c, src/locking/lock_manager.h:
        Internal API for managing locking
      * src/Makefile.am: Add locking code
      6a943419
    • D
      Allow handshake with child process during startup · 285c2fdf
      Daniel P. Berrange 提交于
      Allow the parent process to perform a bi-directional handshake
      with the child process during fork/exec. The child process
      will fork and do its initial setup. Immediately prior to the
      exec(), it will stop & wait for a handshake from the parent
      process. The parent process will spawn the child and wait
      until the child reaches the handshake point. It will do
      whatever extra setup work is required, before signalling the
      child to continue.
      
      The implementation of this is done using two pairs of blocking
      pipes. The first pair is used to block the parent, until the
      child writes a single byte. Then the second pair pair is used
      to block the child, until the parent confirms with another
      single byte.
      
      * src/util/command.c, src/util/command.h,
        src/libvirt_private.syms: Add APIs to perform a handshake
      285c2fdf
  11. 01 6月, 2011 2 次提交
    • O
      util: Fix incorrect error in PCI functions · a74575e3
      Osier Yang 提交于
      Substitute VIR_ERR_NO_SUPPORT with VIR_ERR_INTERNAL_ERROR. Error
      like following is not what user want to see.
      
      error : pciDeviceIsAssignable:1487 : this function is not supported
      by the connection driver: Device 0000:07:10.0 is behind a switch
      lacking ACS and cannot be assigned
      a74575e3
    • C
      storage: List directory volumes for dir/fs/netfs pools · 8077d64f
      Cole Robinson 提交于
      Since directories can be used for <filesystem> passthrough, they are
      basically storage volumes.
      
      v2:
          Skip ., .., lost+found dirs
      
      v3:
          Use gnulib last_component
      
      v4:
          Use gnulib "dirname.h", not system <dirname.h>
          Don't skip lost+found
      8077d64f
  12. 31 5月, 2011 2 次提交
    • D
      Fix sysinfo/virsh build problems on Win32 · ef983dfe
      Daniel P. Berrange 提交于
      The virSysinfoIsEqual method was mistakenly inside a #ifndef WIN32
      conditional.
      
      The existing virSysinfoFormat is also stubbed out on Win32, even
      though the code works without any trouble. This breaks XML output
      on Win32, so the stub is removed.
      
      virsh migrate mistakenly had some variables inside the conditional
      
      * src/util/sysinfo.c: Build virSysinfoIsEqual on Win32 and remove
        Win32 stub for virSysinfoFormat
      * tools/virsh.c: Fix variable declaration on Win32
      ef983dfe
    • D
      Add an API for comparing the ABI of two guest configurations · 08106e20
      Daniel P. Berrange 提交于
      To allow a client app to pass in custom XML during migration
      of a guest it is neccessary to ensure the guest ABI remains
      unchanged. The virDomainDefCheckABIStablity method accepts
      two virDomainDefPtr structs and compares everything in them
      that could impact the guest machine ABI
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/libvirt_private.syms: Add virDomainDefCheckABIStablity
      * src/conf/cpu_conf.c, src/conf/cpu_conf.h: Add virCPUDefIsEqual
      * src/util/sysinfo.c, src/util/sysinfo.h: Add virSysinfoIsEqual
      08106e20
  13. 29 5月, 2011 1 次提交
    • R
      Fix virExecWithHook Prototype · 4996c314
      Richard Laager 提交于
      This was necessary to get libvirt to build on Solaris 11 Express and
      seems correct (as it makes this match the definition in util.c):
      4996c314
  14. 27 5月, 2011 2 次提交
  15. 25 5月, 2011 1 次提交
    • E
      build: fix VIR_DEBUG on mingw · 4486f3a2
      Eric Blake 提交于
      We don't use the gnulib vsnprintf replacement, which means that
      on mingw, vsnprintf doesn't support %zn or %lln.
      
      And as it turns out, VIR_GET_VAR_STR was a rather inefficient
      reimplementation of virVasprintf logic.
      
      * src/util/logging.c (VIR_GET_VAR_STR): Drop.
      (virLogMessage): Inline a simpler version here.
      * src/util/virterror.c (VIR_GET_VAR_STR, virRaiseErrorFull):
      Likewise.
      Reported by Matthias Bolte.
      4486f3a2
  16. 24 5月, 2011 2 次提交
  17. 18 5月, 2011 2 次提交
    • C
      Fix messages using VIR_ERR_XML_ERROR · ed97be61
      Cole Robinson 提交于
      This error code has existed since the dawn of time, yet the messages it
      generates are almost universally busted. Here's a small sampling:
      
      src/conf/domain_conf.c:4889 : XML description for missing root element is not well formed or invalid
      src/conf/domain_conf.c:4951 : XML description for unknown device type is not well formed or invalid
      src/conf/domain_conf.c:5460 : XML description for maximum vcpus must be an integer is not well formed or invalid
      src/conf/domain_conf.c:5468 : XML description for invalid maxvcpus %(count)lu is not well formed or invalid
      
      Fix up the error code to instead be
      
      XML error: <msg>
      
      Adjust the few locations that were using the original correctly (or shouldn't
      have been using the error code at all).
      
      v2:
          Fix wording of error code without a passed argument
      ed97be61
    • D
      Add support for 'passthru' mode for direct network interfaces · 5252a06d
      Dirk Herrendorefer 提交于
      starting with kernel 2.6.38 macvtap supports a 'passthru' mode for
      attaching virtual functions of a SRIOV capable network card directly to a VM.
      This patch adds the capability to configure such a device.
      Signed-off-by: NDirk Herrendoerfer <d.herrendoerfer@herrendoerfer.name>
      5252a06d
  18. 17 5月, 2011 3 次提交
  19. 16 5月, 2011 1 次提交
    • D
      Disable virCommandExec on Win32 · 91e5c3dc
      Daniel P. Berrange 提交于
      Mingw execve() has a broken signature. Disable this
      function until gnulib fixes the signature, since we
      don't really need this on Win32 anyway.
      
      * src/util/command.c: Disable virCommandExec on Win32
      91e5c3dc