1. 02 2月, 2010 1 次提交
  2. 01 2月, 2010 1 次提交
    • C
      Look in /usr/libexec for the qemu-kvm binary. · b16cd226
      Chris Lalancette 提交于
      On RHEL-5 the qemu-kvm binary is located in /usr/libexec.
      To reduce confusion for people trying to run upstream libvirt
      on RHEL-5 machines, make the qemu driver look in /usr/libexec
      for the qemu-kvm binary.
      
      To make this work, I modified virFindFileInPath to handle an
      absolute path correctly.  I also ran into an issue where
      NULL was sometimes being passed for the file parameter
      to virFindFileInPath; it didn't crash prior to this patch
      since it was building paths like /usr/bin/(null).  This
      is non-standard behavior, though, so I added a NULL
      check at the beginning.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      b16cd226
  3. 30 1月, 2010 1 次提交
  4. 26 1月, 2010 1 次提交
    • 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
  5. 21 1月, 2010 2 次提交
    • 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
  6. 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
  7. 14 1月, 2010 1 次提交
    • 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
  8. 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
  9. 16 12月, 2009 1 次提交
    • 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
  10. 10 12月, 2009 1 次提交
    • 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
  11. 04 12月, 2009 1 次提交
    • M
      Add virIndexToDiskName and fix mapping gap · 63166a4e
      Matthias Bolte 提交于
      esxVMX_IndexToDiskName handles indices up to 701. This limit comes
      from a mapping gap in virDiskNameToIndex:
      
        sdzy -> 700
        sdzz -> 701
        sdaaa -> 728
        sdaab -> 729
      
      This line in virDiskNameToIndex causes this gap:
      
        idx = (idx + i) * 26;
      
      Fixing it by altering this line to:
      
        idx = (idx + (i < 1 ? 0 : 1)) * 26;
      
      Also add a new version of virIndexToDiskName that handles the inverse
      mapping for arbitrary indices.
      
      * src/esx/esx_vmx.[ch]: remove esxVMX_IndexToDiskName
      * src/util/util.[ch]: add virIndexToDiskName and fix mapping gap
      * tests/esxutilstest.c: update test to verify that the gap is fixed
      63166a4e
  12. 13 11月, 2009 1 次提交
    • D
      Implement a node device backend using libudev · 3ad6dcf3
      David Allan 提交于
      * configure.in: add new --with-udev, disabled by default, and requiring
        libudev > 145
      * src/node_device/node_device_udev.c src/node_device/node_device_udev.h:
        the new node device backend
      * src/node_device/node_device_linux_sysfs.c: moved node_device_hal_linux.c
        to a better file name
      * src/conf/node_device_conf.c src/conf/node_device_conf.h: add a couple
        of fields in node device definitions, and an API to look them up,
        remove a couple of unused fields from previous patch.
      * src/node_device/node_device_driver.c src/node_device/node_device_driver.h:
        plug the new driver
      * po/POTFILES.in src/Makefile.am src/libvirt_private.syms: add the new
        files and symbols
      * src/util/util.h src/util/util.c: add a new convenience macro
        virBuildPath and virBuildPathInternal() function
      3ad6dcf3
  13. 04 11月, 2009 1 次提交
    • C
      Improve error reporting for virConnectGetHostname calls · 517761fd
      Cole Robinson 提交于
      All drivers have copy + pasted inadequate error reporting which wraps
      util.c:virGetHostname. Move all error reporting to this function, and improve
      what we report.
      
      Changes from v1:
        Drop the driver wrappers around virGetHostname. This means we still need
        to keep the new conn argument to virGetHostname, but I think it's worth
        it.
      517761fd
  14. 03 11月, 2009 1 次提交
    • D
      Annotate many methods with ATTRIBUTE_RETURN_CHECK & fix problems · 46992453
      Daniel P. Berrange 提交于
      Nearly all of the methods in src/util/util.h have error codes that
      must be checked by the caller to correct detect & report failure.
      Add ATTRIBUTE_RETURN_CHECK to ensure compile time validation of
      this
      
      * daemon/libvirtd.c: Add explicit check on return value of virAsprintf
      * src/conf/domain_conf.c: Add missing check on virParseMacAddr return
        value status & report error
      * src/network/bridge_driver.c: Add missing OOM check on virAsprintf
        and report error
      * src/qemu/qemu_conf.c: Add missing check on virParseMacAddr return
        value status & report error
      * src/security/security_selinux.c: Remove call to virRandomInitialize
        that's done in libvirt.c already
      * src/storage/storage_backend_logical.c: Add check & log on virRun
        return status
      * src/util/util.c: Add missing checks on virAsprintf/Run status
      * src/util/util.h: Annotate all methods with ATTRIBUTE_RETURN_CHECK
        if they return an error status code
      * src/vbox/vbox_tmpl.c: Add missing check on virParseMacAddr
      * src/xen/xm_internal.c: Add missing checks on virAsprintf
      * tests/qemuargv2xmltest.c: Remove bogus call to virRandomInitialize()
      46992453
  15. 13 10月, 2009 1 次提交
    • D
      Fix virFileReadLimFD/virFileReadAll to handle EINTR · 11a36d95
      Daniel P. Berrange 提交于
      The fread_file_lim() function uses fread() but never handles
      EINTR results, causing unexpected failures when reading QEMU
      help arg info. It was unneccessarily using FILE * instead
      of plain UNIX file handles, which prevented use of saferead()
      
      * src/util/util.c: Switch fread_file_lim over to use saferead
        instead of fread, remove FILE * use, and rename
      11a36d95
  16. 08 10月, 2009 2 次提交
  17. 30 9月, 2009 1 次提交
  18. 23 9月, 2009 1 次提交
    • C
      Introduce virStrncpy. · 03d777f3
      Chris Lalancette 提交于
      Add the virStrncpy function, which takes a dst string, source string,
      the number of bytes to copy and the number of bytes available in the
      dest string.  If the source string is too large to fit into the
      destination string, including the \0 byte, then no data is copied and
      the function returns NULL.  Otherwise, this function copies n bytes
      from source into dst, including the \0, and returns a pointer to the
      dst string.  This function is intended to replace all unsafe uses
      of strncpy in the code base, since strncpy does *not* guarantee that
      the buffer terminates with a \0.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      03d777f3
  19. 21 9月, 2009 1 次提交
    • D
      Move all shared utility files to src/util/ · 1355e055
      Daniel P. Berrange 提交于
      * src/bridge.c, src/bridge.h, src/buf.c, src/buf.h, src/cgroup.c,
        src/cgroup.h, src/conf.c, src/conf.h, src/event.c, src/event.h,
        src/hash.c, src/hash.h, src/hostusb.c, src/hostusb.h,
        src/iptables.c, src/iptables.h, src/logging.c, src/logging.h,
        src/memory.c, src/memory.h, src/pci.c, src/pci.h, src/qparams.c,
        src/qparams.h, src/stats_linux.c, src/stats_linux.h,
        src/threads-pthread.c, src/threads-pthread.h, src/threads-win32.c,
        src/threads-win32.h, src/threads.c, src/threads.h, src/util.c,
        src/util.h, src/uuid.c, src/uuid.h, src/virterror.c,
        src/virterror_internal.h, src/xml.c, src/xml.h: Move all files
        into src/util/
      * daemon/Makefile.am: Add -Isrc/util/ to build flags
      * src/Makefile.am: Add -Isrc/util/ to build flags and update for
        moved files
      * src/libvirt_private.syms: Export cgroup APIs since they're now
        in util rather than linking directly to drivers
      * src/xen/xs_internal.c: Disable bogus virEventRemoveHandle call
        when built under PROXY
      * proxy/Makefile.am: Update for changed file locations. Remove
        bogus build of event.c
      * tools/Makefile.am, tests/Makefile.am: Add -Isrc/util/ to build flags
      1355e055
  20. 10 9月, 2009 1 次提交
    • D
      Fix use of dlopen modules · fcd4e269
      Daniel P. Berrange 提交于
      Remove the bogus dependancy between node_device.c & storage_backend.c
      by moving the virWaitForDevices into util.h where it can be shared
      safely
      
      * src/storage_backend_disk.c, src/storage_backend_logical.c,
        src/storage_backend_mpath.c, src/storage_backend_scsi.c: Replace
        virStorageBackendWaitForDevices with virFileWaitForDevices
      * src/storage_backend.c, src/storage_backend.h: Remove
        virStorageBackendWaitForDevices, virWaitForDevices
      * src/util.h, src/util.c: Add virFileWaitForDevices
      * configure.in: Move xmlrpc check further down after pkgconfig
        is detected
      * src/Makefile.am: Add missing XMLRPC_CFLAGS/LIBS to opennebula
      * src/libvirt_private.syms: Add many missing exports
      fcd4e269
  21. 08 9月, 2009 1 次提交
  22. 04 9月, 2009 1 次提交
    • D
      Move QEMU monitor socket in /var/lib/libvirt/qemu · 182a80b9
      Daniel P. Berrange 提交于
      Separate the guest created QEMU monitor socket location
      from the libvirtd create XML / PID data files, to improve
      security separation when running QEMU non-root
      
      * libvirt.spec.in: Leave /var/run/libvirt/qemu as root:root
      * src/qemu_conf.h: Add libDir and cacheDir directory paths
      * src/qemu_driver.c: Move QEMU monitor socket from
        stateDir to libDir to avoid making security critical directory
        accessible to QEMU guests.
      * src/util.c: Delay running hook till after damonizing to
        ensure pidfile is still written before changing UID/GID
      182a80b9
  23. 03 9月, 2009 1 次提交
    • D
      Support configuration of huge pages in guests · d823a05a
      Daniel P. Berrange 提交于
      Add option to domain XML for
      
           <memoryBacking>
              <hugepages/>
           </memoryBacking>
      
      * configure.in: Add check for mntent.h
      * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
        Add 'hugetlbfs_mount' config parameter
      * src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
        and pass it when hugepages are requested.
        Load hugetlbfs_mount config parameter, search for mount if not given.
      * src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
        Create directory for QEMU hugepage usage, chowning if required.
      * docs/formatdomain.html.in: Document memoryBacking/hugepages elements
      * docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
      * src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
        helper API
      * tests/qemuhelptest.c: Add -mem-path constants
      * tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
        handling
      * tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
        tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
        hugepage tests
      d823a05a
  24. 01 8月, 2009 1 次提交
  25. 31 7月, 2009 1 次提交
    • D
      Fix problem writing QEMU pidfile · 9a152d48
      Daniel P. Berrange 提交于
      * src/util.c: Don't drop capabilities until after the PID file has
        been written. Kill off child if writing the PID file fails
      * src/qemu_driver.c: Remove bogus trailing '/' in state dir
      9a152d48
  26. 24 7月, 2009 2 次提交
    • D
      Implement schedular tunables API using cgroups · 55bc5090
      Daniel P. Berrange 提交于
      * src/qemu_driver.c:  Add driver methods qemuGetSchedulerType,
        qemuGetSchedulerParameters, qemuSetSchedulerParameters
      * src/lxc_driver.c: Fix to use unsigned long long consistently
        for schedular parameters
      * src/cgroup.h, src/cgroup.c: Fix cpu_shares to take unsigned
        long long
      * src/util.c, src/util.h, src/libvirt_private.syms: Add a
        virStrToDouble helper
      * src/virsh.c: Fix handling of --set arg to schedinfo command
        to honour the designated data type of each schedular tunable
        as declared by the driver
      55bc5090
    • D
      Refactor cgroups to allow a group per driver to be managed directly · 946c489c
      Daniel P. Berrange 提交于
      Allow the driver level cgroup to be managed explicitly by the
      hypervisor drivers, in order to detect whether to enable or
      disable cgroup support for domains. Provides better error
      reporting of failures. Also allow for creation of cgroups for
      unprivileged drivers if controller is accessible by the user.
      
      * src/cgroup.c, src/cgroup.h: Add an API to obtain a driver cgroup
      * src/lxc_conf.h, src/lxc_controller.c, src/lxc_driver.c:
        Obtain a driver cgroup at startup and use that instead of
        re-creating everytime.
      * src/util.c, src/util.h, src/libvirt_private.syms: Add a
        virGetUserName() helper
      946c489c
  27. 17 7月, 2009 1 次提交
    • D
      Run QEMU guests as an unprivileged user · 0714b2ba
      Daniel P. Berrange 提交于
      * configure.in: Add --with-qemu-user and --with-qemu-group args
      * libvirt.spec.in: use 'qemu' for user/group for Fedora >= 12
      * qemud/libvirtd_qemu.arg, qemud/test_libvirtd_qemu.aug,
        src/qemu.conf: Add 'user' and 'group' args for configuration
      * src/Makefile.am: Create %localstatedir/cache/libvirt/qemu
      * src/qemu_conf.c, src/qemu_conf.h: Load user/group from config
      * src/qemu_driver.c: Change user ID/group ID when launching QEMU
        guests. Change user/group ownership on disks/usb/pci devs.
        Put memory dumps in %localstatedir/cache/libvirt/qemu
      * src/util.c, src/util.h: Add convenient APIs for converting
        username/groupname to user ID / group ID
      0714b2ba
  28. 16 7月, 2009 1 次提交
  29. 30 6月, 2009 1 次提交
  30. 26 6月, 2009 1 次提交
    • D
      big cleanup of the debug configuration option · 173c230e
      Daniel Veillard 提交于
      * src/Makefile.am src/libvirt.c src/libvirt_private.syms src/logging.c
        src/logging.h src/util.c src/libvirt_debug.syms: big cleanup of
        the debug configuration option and code by Amy Griffis
      daniel
      173c230e
  31. 23 6月, 2009 1 次提交
  32. 15 6月, 2009 1 次提交
  33. 11 6月, 2009 1 次提交
  34. 03 6月, 2009 1 次提交
  35. 20 5月, 2009 1 次提交
    • D
      cleanup of some direct stderr logging · e8da9875
      Daniel Veillard 提交于
      * qemud/qemud.c src/console.c src/network_driver.c
        src/node_device_conf.c src/node_device_hal.c src/storage_conf.c
        src/util.c: cleanup of some direct stderr logging
      daniel
      e8da9875
  36. 11 5月, 2009 2 次提交
    • C
      Add pidfile argument to __virExec · a331653d
      Cole Robinson 提交于
      virExec will write out the pid of the daemonized process only. Use this
      in the QEMU driver, rather than QEMU's pidfile, so we can catch errors we
      might miss if the emulator bails early.
      a331653d
    • C
      Add helper function virExecDaemonize · 79d9d243
      Cole Robinson 提交于
      Wraps __virExec with the VIR_EXEC_DAEMON flag. Waits on the intermediate
      process to ensure we don't end up with any zombies, and differentiates between
      original process errors and intermediate process errors.
      79d9d243