1. 02 2月, 2010 2 次提交
  2. 01 2月, 2010 2 次提交
  3. 30 1月, 2010 1 次提交
  4. 27 1月, 2010 2 次提交
  5. 26 1月, 2010 4 次提交
    • J
      hostusb: closedir only if non-NULL; rename labels: s/error/cleanup/ · fb54230b
      Jim Meyering 提交于
      * src/util/hostusb.c (usbSysReadFile): Rename labels s/error/cleanup/
      (usbFindBusByVendor): Likewise.  And closedir only if non-NULL.
      fb54230b
    • L
      Cleanup of large buffer on stack in virFileMakePath · ba1d379c
      Laine Stump 提交于
      virFileMakePath is a recursive function that was creates a buffer
      PATH_MAX bytes long for each recursion (one recursion for each element
      in the path). This changes it to have no buffers on the stack, and to
      allocate just one buffer total, no matter how many elements are in the
      path. Because the modified algorithm requires a char* to be passed in
      rather than const char *, it is now 2 functions - a toplevel API
      function that remains identical in function, and a 2nd helper function
      called for the recursions, which 1) doesn't allocate anything, and 2)
      takes a char* arg, so it can modify the contents.
      * src/util/util.c: rewrite virFileMakePath
      ba1d379c
    • D
      Misc fixes to QMP monitor support for QEMU · 2c7f5ca6
      Daniel P. Berrange 提交于
      * src/util/json.c, src/util/json.h: Declare returned strings
        to be const
      * src/qemu/qemu_monitor.c: Wire up JSON mode for qemuMonitorGetPtyPaths
      * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Fix
        const correctness. Add missing error message in the function
        qemuMonitorJSONGetAllPCIAddresses. Add implementation of the
        qemuMonitorGetPtyPaths function calling 'query-chardev'.
      2c7f5ca6
    • J
      usbGetDevice: don't leak a "usbDevice" buffer on failure path · 3dc42686
      Jim Meyering 提交于
      * src/util/hostusb.c (usbGetDevice): Free "dev" when returning NULL.
      3dc42686
  6. 25 1月, 2010 1 次提交
  7. 23 1月, 2010 1 次提交
    • C
      qemu: Fix race between device rebind and kvm cleanup · be34c3c7
      Chris Lalancette 提交于
      Certain hypervisors (like qemu/kvm) map the PCI bar(s) on
      the host when doing device passthrough.  This can lead to a race
      condition where the hypervisor is still cleaning up the device while
      libvirt is trying to re-attach it to the host device driver.  To avoid
      this situation, we look through /proc/iomem, and if the hypervisor is
      still holding onto the bar (denoted by the string in the matcher variable),
      then we can wait around a bit for that to clear up.
      
      v2: Thanks to review by DV, make sure we wait the full timeout per-device
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      be34c3c7
  8. 22 1月, 2010 1 次提交
    • C
      Fix device assignment with root devices · 654dd290
      Chris Lalancette 提交于
      The patches to add ACS checking to PCI device passthrough
      introduced a bug.  With the current code, if you try to
      passthrough a device on the root bus (i.e. bus 0), then
      it denies the passthrough.  This is because the code in
      pciDeviceIsBehindSwitchLackingACS() to check for a parent
      device doesn't take into account the possibility of the
      root bus.  If we are on the root bus, it means we
      legitimately can't find a parent, and it also means that
      we don't have to worry about whether ACS is enabled.
      Therefore return 0 (indicating we don't lack ACS) from
      pciDeviceIsBehindSwitchLackingACS().
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      654dd290
  9. 21 1月, 2010 3 次提交
    • D
      Allow surrounding whitespace in uuid · ca18b710
      Dan Kenigsberg 提交于
      * src/util/uuid.c: extend virUUIDParse to allow leading and trailing
        spaces in UUIDs
      ca18b710
    • L
      New utility functions virFileCreate and virDirCreate · 98f6f381
      Laine Stump 提交于
      These functions create a new file or directory with the given
      uid/gid. If the flag VIR_FILE_CREATE_AS_UID is given, they do this by
      forking a new process, calling setuid/setgid in the new process, and
      then creating the file. This is better than simply calling open then
      fchown, because in the latter case, a root-squashing nfs server would
      create the new file as user nobody, then refuse to allow fchown.
      
      If VIR_FILE_CREATE_AS_UID is not specified, the simpler tactic of
      creating the file/dir, then chowning is is used. This gives better
      results in cases where the parent directory isn't on a root-squashing
      NFS server, but doesn't give permission for the specified uid/gid to
      create files. (Note that if the fork/setuid method fails to create the
      file due to access privileges, the parent process will make a second
      attempt using this simpler method.)
      
      If the bit VIR_FILE_CREATE_ALLOW_EXIST is set in the flags, an
      existing file/directory will not cause an error; in this case, the
      function will simply set the permissions of the file/directory to
      those requested. If VIR_FILE_CREATE_ALLOW_EXIST is not specified, an
      existing file/directory is considered (and reported as) an error.
      
      Return from both of these functions is 0 on success, or the value of
      errno if there was a failure.
      
      * src/util/util.[ch]: add the 2 new util functions
      98f6f381
    • L
      Add virRunWithHook util function · d2259ada
      Laine Stump 提交于
      * src/util/util.[ch]: similar to virExecWithHook, but waits for child to
        exit. Useful for doing things like setuid after the fork but before the
        exec.
      d2259ada
  10. 20 1月, 2010 3 次提交
    • J
      logging: confirm that we want to ignore a write error · eb895e74
      Jim Meyering 提交于
      * src/util/logging.c (virLogMessage): Include "ignore-value.h".
      Use it to ignore the return value of safewrite.
      Use STDERR_FILENO, rather than "2".
      * bootstrap (modules): Add ignore-value.
      * gnulib: Update to latest, for ignore-value that is now LGPLv2+.
      eb895e74
    • J
      Remove superfluous new lines from messages · 4bc3bd7b
      Jiri Denemark 提交于
      I noticed some debug messages are printed with an empty lines after
      them. This patch removes these empty lines from all invocations of the
      following macros:
          VIR_DEBUG
          VIR_DEBUG0
          VIR_ERROR
          VIR_ERROR0
          VIR_INFO
          VIR_WARN
          VIR_WARN0
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      4bc3bd7b
    • J
      Tests for ACS in PCIe switches · 379eb395
      Jiri Denemark 提交于
      New pciDeviceIsAssignable() function for checking whether a given PCI
      device can be assigned to a guest was added. Currently it only checks
      for ACS being enabled on all PCIe switches between root and the PCI
      device. In the future, it could be the right place to check whether a
      device is unbound or bound to a stub driver.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      379eb395
  11. 18 1月, 2010 1 次提交
    • J
      util.c: include required header, no longer masked by gnulib · 30a9329a
      Jim Meyering 提交于
      Until recently, some gnulib-generated replacement headers
      included *other* headers that were not strictly necessary,
      thus masking the need in this file for an explicit <stdlib.h>.
      * src/util/util.c: Include <stdlib.h> for declarations of e.g.,
      strtol, random_r, getenv, etc.
      30a9329a
  12. 14 1月, 2010 2 次提交
    • C
      util: Make sure virExec hook failures are raised · 522776ed
      Cole Robinson 提交于
      With the introduction virDispatchError, hook function errors are
      never sent through the error callback, so users will never see
      these messages.
      
      Fix this by calling virDispatchError after hook failure.
      522776ed
    • C
      Implement path lookup for USB by vendor:product · 5073aa99
      Cole Robinson 提交于
      Based off how QEMU does it, look through /sys/bus/usb/devices/* for
      matching vendor:product info, and if found, use info from the surrounding
      files to build the device's /dev/bus/usb path.
      
      This fixes USB device assignment by vendor:product when running qemu
      as non-root (well, it should, but for some reason I couldn't reproduce
      the failure people are seeing in [1], but it appears to work properly)
      
      [1] https://bugzilla.redhat.com/show_bug.cgi?id=542450
      5073aa99
  13. 13 1月, 2010 1 次提交
    • C
      util: Remove logging handlers in virExec · 28613908
      Cole Robinson 提交于
      This allows debug statements and raised errors in hook functions to
      actually be logged somewhere (stderr). Users can enable debugging in the
      daemon and now see more info in /var/log/libvirt/...
      28613908
  14. 12 1月, 2010 2 次提交
    • C
      virterror: Add virSetError · fd5eb45b
      Cole Robinson 提交于
      Can be used to re-set an old error, which may have been squashed by
      other functions (like cleanup routines). Will be used in subsequent patches
      fd5eb45b
    • D
      Ensure error handling callback functions are called from safe context · 3a80f2f7
      Daniel P. Berrange 提交于
      The virRaiseErrorFull() may invoke the error handler callback
      functions an application has registered. This is not good
      because the connection object may not be available at this
      point, and the caller may be holding locks. This creates a
      problem if the error handler calls back into libvirt.
      
      The solutuon is to move invocation of the handler into the
      final cleanup code in the public API entry points, where it
      is guarenteed to have safe state.
      
      * src/libvirt.c: Invoke virDispatchError() in all error paths
      * src/util/virterror.c: Remove virSetConnError/virSetGlobalError,
        replacing with virDispatchError(). Move invocation of the
        error callbacks into virDispatchError() instead of the
        virRaiseErrorFull function which is not in a safe context
      3a80f2f7
  15. 11 1月, 2010 1 次提交
    • L
      Fix UUID random generator to use /dev/random · 28024f23
      Laine Stump 提交于
      Only use pseudo-random generator for uuid if using /dev/random fails.
      * src/util/uuid.c: The original code. would only print the warning
        message if using /dev/random failed, but would still go ahead and call
        virUUIDGeneratePseudoRandomBytes in all cases anyway.
      28024f23
  16. 23 12月, 2009 2 次提交
  17. 22 12月, 2009 2 次提交
  18. 18 12月, 2009 1 次提交
    • J
      XML parsing/formating code for CPU flags · 6695818c
      Jiri Denemark 提交于
      * include/libvirt/virterror.h src/util/virterror.c: add new domain
        VIR_FROM_CPU for errors
      * src/conf/cpu_conf.c src/conf/cpu_conf.h: new parsing module
      * src/Makefile.am proxy/Makefile.am: include new files
      * src/conf/capabilities.[ch] src/conf/domain_conf.[ch]: reference
        new code
      * src/libvirt_private.syms: private export of new entry points
      6695818c
  19. 16 12月, 2009 2 次提交
    • J
      avoid malfunction when virFileResolveLink is applied to non-POSIX FS · 5baa4635
      Jim Meyering 提交于
      The virFileResolveLink utility function relied on the POSIX guarantee
      that stat.st_size of a symlink is the length of the value.  However,
      on some types of file systems, it is invalid, so do not rely on it.
      Use gnulib's areadlink module instead.
      * bootstrap (modules): Add areadlink.
      * src/util/util.c: Include "areadlink.h".
      Let areadlink perform the readlink and malloc.
      * configure.in (AC_CHECK_FUNCS): Remove readlink.  No need,
      since it's presence is guaranteed by gnulib.
      5baa4635
    • J
      xm_internal.c: remove misleading dead code · 11f6cc32
      Jim Meyering 提交于
      * src/xen/xm_internal.c (xenXMConfigGetULong): Remove useless and
      misleading test (always false) for val->str == NULL before code that
      always dereferences val->str.  "val" comes from virConfGetValue, and
      at that point, val->str is guaranteed to be non-NULL.
      (xenXMConfigGetBool): Likewise.
      * src/util/conf.c (virConfSetValue): Ensure that vir->str is never NULL,
      not even if someone tries to set such a value via virConfSetValue.
      11f6cc32
  20. 10 12月, 2009 3 次提交
    • M
      remove iptablesReloadRules() and related code · 4ecf9c65
      Mark McLoughlin 提交于
      We don't use this method of reloading rules anymore, so we can just
      kill the code.
      
      This simplifies things a lot because we no longer need to keep a
      table of the rules we've added.
      
      * src/util/iptables.c: kill iptablesReloadRules()
      4ecf9c65
    • M
      remove all traces of lokkit support · 3b3305d8
      Mark McLoughlin 提交于
      Long ago we tried to use Fedora's lokkit utility in order to register
      our iptables rules so that 'service iptables restart' would
      automatically load our rules.
      
      There was one fatal flaw - if the user had configured iptables without
      lokkit, then we would clobber that configuration by running lokkit.
      
      We quickly disabled lokkit support, but never removed it. Let's do
      that now.
      
      The 'my virtual network stops working when I restart iptables' still
      remains. For all the background on this saga, see:
      
        https://bugzilla.redhat.com/227011
      
      * src/util/iptables.c: remove lokkit support
      
      * configure.in: remove --enable-lokkit
      
      * libvirt.spec.in: remove the dirs used only for saving rules for lokkit
      
      * src/Makefile.am: ditto
      
      * src/libvirt_private.syms, src/network/bridge_driver.c,
        src/util/iptables.h: remove references to iptablesSaveRules
      3b3305d8
    • M
      Add virBufferFreeAndReset() and replace free() · 1b9d0744
      Matthias Bolte 提交于
      Replace free(virBufferContentAndReset()) with virBufferFreeAndReset().
      Update documentation and replace all remaining calls to free() with
      calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset()
      and virReportOOMError() in OOM error cases.
      1b9d0744
  21. 08 12月, 2009 3 次提交
    • D
      Avoid an type-punned pointer aliasing pbm · 2b2dae81
      Daniel Veillard 提交于
      Fix this warning, there is no need to use an intermediate,
      different array pointer.
      network.c: In function 'getIPv6Addr':
      network.c:50: warning: dereferencing type-punned pointer will break strict-aliasing rules
      * src/util/network.c: avoid an intermediary pointer cast
      2b2dae81
    • D
      Fix a compilation failure if yajl not avail · a4e09c1e
      Daniel Veillard 提交于
      configure:     yajl: no
      CC     libvirt_util_la-json.lo
      util/json.c:32:27: error: yajl/yajl_gen.h: No such file or directory
      util/json.c:33:29: error: yajl/yajl_parse.h: No such file or directory
      
      * src/util/json.c: remove the includes if yajl not configured in
      a4e09c1e
    • D
      Fix ReprotError vs ReportError typo in JSON code · 0a4283cb
      Daniel P. Berrange 提交于
      * src/util/json.c: Fix ReprotError typo when YAJL is not available
      0a4283cb