1. 24 2月, 2011 1 次提交
  2. 16 2月, 2011 1 次提交
    • E
      cgroup: preserve correct errno on failure · 76c57a7c
      Eric Blake 提交于
      * src/util/cgroup.c (virCgroupSetValueStr, virCgroupGetValueStr)
      (virCgroupRemoveRecursively): VIR_DEBUG can clobber errno.
      (virCgroupRemove): Use VIR_DEBUG rather than DEBUG.
      76c57a7c
  3. 15 2月, 2011 1 次提交
    • E
      build: silence false positive clang report · bd6ea303
      Eric Blake 提交于
      clang complained that STREQ(group->controllers[i].mountPoint,...)  was
      a NULL dereference when i==VIR_CGROUP_CONTROLLER_CPUSET, because it
      assumes the worst about virCgroupPathOfController.  Marking the
      argument const doesn't yet have an effect, per this clang bug:
      http://llvm.org/bugs/show_bug.cgi?id=7758
      
      So, we use sa_assert, which was designed to shut up false positives
      from tools like clang.
      
      * src/util/cgroup.c (virCgroupMakeGroup): Teach clang that there
      is no NULL dereference.
      bd6ea303
  4. 09 2月, 2011 2 次提交
  5. 15 1月, 2011 1 次提交
  6. 03 12月, 2010 1 次提交
    • J
      Create file in virFileWriteStr() if it doesn't exist · 966a1bfe
      Jean-Baptiste Rouault 提交于
      This patch adds a mode_t parameter to virFileWriteStr().
      If mode is different from 0, virFileWriteStr() will try
      to create the file if it doesn't exist.
      
      * src/util/util.h (virFileWriteStr): Alter signature.
      * src/util/util.c (virFileWriteStr): Allow file creation.
      * src/network/bridge_driver.c (networkEnableIpForwarding)
      (networkDisableIPV6): Adjust clients.
      * src/node_device/node_device_driver.c
      (nodeDeviceVportCreateDelete): Likewise.
      * src/util/cgroup.c (virCgroupSetValueStr): Likewise.
      * src/util/pci.c (pciBindDeviceToStub, pciUnBindDeviceFromStub):
      Likewise.
      966a1bfe
  7. 17 11月, 2010 1 次提交
    • S
      deprecate fclose() and introduce VIR_{FORCE_}FCLOSE() · 7b7cb1ec
      Stefan Berger 提交于
      Similarly to deprecating close(), I am now deprecating fclose() and
      introduce VIR_FORCE_FCLOSE() and VIR_FCLOSE(). Also, fdopen() is replaced with
      VIR_FDOPEN().
      
      Most of the files are opened in read-only mode, so usage of
      VIR_FORCE_CLOSE() seemed appropriate. Others that are opened in write
      mode already had the fclose()<  0 check and I converted those to
      VIR_FCLOSE()<  0.
      
      I did not find occurrences of possible double-closed files on the way.
      7b7cb1ec
  8. 29 10月, 2010 1 次提交
    • L
      qemu_driver: add virCgroupMounted · 41b2cee2
      Lai Jiangshan 提交于
      When we mount any cgroup without "-o devices", we will fail to start vms:
      
      error: Failed to start domain vm1
      error: Unable to deny all devices for vm1: No such file or directory
      
      When we mount any cgroup without "-o cpu", we will fail to get schedinfo:
      Scheduler      : posix
      error: unable to get cpu shares tunable: No such file or directory
      
      We should only use the cgroup controllers which are mounted on host.
      So I add virCgroupMounted() for qemuCgroupControllerActive()
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      41b2cee2
  9. 13 10月, 2010 1 次提交
  10. 30 6月, 2010 2 次提交
  11. 25 6月, 2010 1 次提交
    • D
      Set labelling for character devices in security drivers · 2bad82f7
      Daniel P. Berrange 提交于
      When configuring serial, parallel, console or channel devices
      with a file, dev or pipe backend type, it is necessary to label
      the file path in the security drivers. For char devices of type
      file, it is neccessary to pre-create (touch) the file if it does
      not already exist since QEMU won't be allowed todo so itself.
      dev/pipe configs already require the admin to pre-create before
      starting the guest.
      
      * src/qemu/qemu_security_dac.c: set file ownership for character
        devices
      * src/security/security_selinux.c: Set file labeling for character
        devices
      * src/qemu/qemu_driver.c: Add character devices to cgroup ACL
      2bad82f7
  12. 24 6月, 2010 2 次提交
    • R
      cgroup: Enable memory.use_hierarchy of cgroup for domain · 4a4eb13e
      Ryota Ozaki 提交于
      Through conversation with Kumar L Srikanth-B22348, I found
      that the function of getting memory usage (e.g., virsh dominfo)
      doesn't work for lxc with ns subsystem of cgroup enabled.
      
      This is because of features of ns and memory subsystems.
      Ns creates child cgroup on every process fork and as a result
      processes in a container are not assigned in a cgroup for
      domain (e.g., libvirt/lxc/test1/). For example, libvirt_lxc
      and init (or somewhat specified in XML) are assigned into
      libvirt/lxc/test1/8839/ and libvirt/lxc/test1/8839/8849/,
      respectively. On the other hand, memory subsystem accounts
      memory usage within a group of processes by default, i.e.,
      it does not take any child (and descendant) groups into
      account. With the two features, virsh dominfo which just
      checks memory usage of a cgroup for domain always returns
      zero because the cgroup has no process.
      
      Setting memory.use_hierarchy of a group allows to account
      (and limit) memory usage of every descendant groups of the group.
      By setting it of a cgroup for domain, we can get proper memory
      usage of lxc with ns subsystem enabled. (To be exact, the
      setting is required only when memory and ns subsystems are
      enabled at the same time, e.g., mount -t cgroup none /cgroup.)
      4a4eb13e
    • R
      cgroup: Change virCgroupRemove to remove all descendant groups at first · 842b51ff
      Ryota Ozaki 提交于
      As same as normal directories, a cgroup cannot be removed if it
      contains sub groups. This patch changes virCgroupRemove to remove
      all descendant groups (subdirectories) of a target group before
      removing the target group.
      
      The handling is required when we run lxc with ns subsystem of cgroup.
      Ns subsystem automatically creates child cgroups on every process
      forks, but unfortunately the groups are not removed on process exits,
      so we have to remove them by ourselves.
      
      With this patch, such child (and descendant) groups are surely removed
      at lxc shutdown, i.e., lxcVmCleanup which calls virCgroupRemove.
      842b51ff
  13. 21 5月, 2010 2 次提交
  14. 04 5月, 2010 1 次提交
  15. 24 4月, 2010 1 次提交
  16. 01 4月, 2010 1 次提交
    • M
      cgroup: Replace sscanf with virStrToLong_ll · 73b45bfb
      Matthias Bolte 提交于
      The switch from %lli to %lld in virCgroupGetValueI64 is intended,
      as virCgroupGetValueU64 uses base 10 too, and virCgroupSetValueI64
      uses %lld to format the number to string.
      
      Parsing is stricter now and doesn't accept trailing characters
      after the actual value anymore.
      73b45bfb
  17. 22 3月, 2010 1 次提交
    • J
      Avoid libvirtd crash when cgroups is not configured on host · 09fafa1e
      Jim Fehlig 提交于
      Invoking virDomainSetMemory() on lxc driver results in libvirtd
      segfault when cgroups has not been configured on the host.
      
      Ensure driver->cgroup is non-null before invoking
      virCgroupForDomain().  To prevent similar segfaults in the future,
      ensure driver parameter to virCgroupForDomain() is non-null before
      dereferencing.
      09fafa1e
  18. 10 3月, 2010 1 次提交
  19. 05 3月, 2010 1 次提交
  20. 09 2月, 2010 1 次提交
  21. 05 2月, 2010 2 次提交
  22. 13 11月, 2009 1 次提交
    • D
      Fix check for existance of cgroups at creation · d11d93f4
      Daniel P. Berrange 提交于
      In the scenario where the cgroups were mounted but the
      particular group did not exist, and the caller had not
      requested auto-creation, the code would fail to return
      an error condition. This caused the lxc_controller to
      think the cgroup existed, and it then later failed when
      attempting to use it
      
      * src/util/cgroup.c: Raise an error if the cgroup path does not
        exist
      d11d93f4
  23. 19 10月, 2009 1 次提交
    • R
      LXC fix virCgroupGetValueStr problem with \n · 41fa653f
      Ryota Ozaki 提交于
      A cgroup file returns integer value terminated with '\n' and remaining
      it has sometimes harmful effects, for example it leads virStrToLong_ull
      to fail.
      * src/util/cgroup.c: strip out terminating \n when reading a value
      41fa653f
  24. 08 10月, 2009 2 次提交
  25. 07 10月, 2009 1 次提交
    • R
      LXC implement memory control APIs · 3a05dc09
      Ryota Ozaki 提交于
      The patch implements the missing memory control APIs for lxc, i.e.,
      domainGetMaxMemory, domainSetMaxMemory, domainSetMemory, and improves
      domainGetInfo to return proper amount of used memory via cgroup.
      
      * src/libvirt_private.syms: Export virCgroupGetMemoryUsage
        and add missing virCgroupSetMemory
      * src/lxc/lxc_driver.c: Implement missing memory functions
      * src/util/cgroup.c, src/util/cgroup.h: Add the function
        to get used memory
      3a05dc09
  26. 22 9月, 2009 1 次提交
    • R
      lxc: suspend/resume support · c8c9ef27
      Ryota Ozaki 提交于
      * src/conf/domain_conf.c: Don't assume all virDomainObjPtr have
        a non-NULL monitor_chr field in virDomainObjFormat.
      * src/lxc/lxc_driver.c: Implement suspend/resume driver APis
      * src/util/cgroup.c, src/util/cgroup.h: Support the 'freezer'
        cgroup controller
      * src/libvirt_private.syms: Export virCgroupSetFreezerState
        and virCgroupGetFreezerState
      c8c9ef27
  27. 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
  28. 24 7月, 2009 6 次提交
    • D
      Fix cgroup compile warnings · 1112330e
      Daniel P. Berrange 提交于
      * src/cgroup.c: Fix cast to uint64 from unsigned long long
      1112330e
    • D
      Make QEMU cgroups use configurable · f4c3acdf
      Daniel P. Berrange 提交于
       * qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug,
         src/qemu.conf: Add 'cgroups_controllers' and 'cgroups_device_acl'
         parameters
       * src/qemu_conf.h, src/qemu_conf.c: Load & parse configuration params
         for cgroups
       * src/qemu_driver.c: Only use cgroups controllers that are activated,
         and use configured device whitelist instead of default, if set.
      f4c3acdf
    • D
      Use cgroups for block device whitelisting in QEMU guests · e88d638a
      Daniel P. Berrange 提交于
      * src/qemu_driver.c: Set a restrictive block device whitelist for
        all QEMU guests. Update whitelist when hotplugging disks.
      * src/cgroup.h, src/cgroup.c: Add some more convenience methods
        for dealing with block device whitelists.
      e88d638a
    • 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
    • D
      Make cgroups a little more efficient · de1ecd53
      Daniel P. Berrange 提交于
      * src/cgroup.c: Detect the mount location of every controller at
        time a virCgroupPtr is created. Detect current process' placement
        within group to avoid assuming it is in the root. Pass controller
        ID into SetValueStr/GetValueStr to enable much duplicated code to
        be eliminated
      de1ecd53
  29. 23 7月, 2009 1 次提交