1. 16 5月, 2014 1 次提交
  2. 29 4月, 2014 1 次提交
    • E
      util: use virDirRead API · ac1d42ac
      Eric Blake 提交于
      In making the conversion to the new API, I fixed a couple bugs:
      virSCSIDeviceGetSgName would leak memory if a directory
      unexpectedly contained multiple entries;
      virNetDevTapGetRealDeviceName could report a spurious error
      from a stale errno inherited before starting the readdir search.
      
      The decision on whether to store the result of virDirRead into
      a variable is based on whether the end of the loop falls through
      to cleanup code automatically.  In some cases, we have loops that
      are documented to return NULL on failure, and which raise an
      error on most failure paths but not in the case where the directory
      was unexpectedly empty; it may be worth a followup patch to
      explicitly report an error if readdir was successful but the
      directory was empty, so that a NULL return always has an error set.
      
      * src/util/vircgroup.c (virCgroupRemoveRecursively): Use new
      interface.
      (virCgroupKillRecursiveInternal, virCgroupSetOwner): Report
      readdir failures.
      * src/util/virfile.c (virFileLoopDeviceOpenSearch)
      (virFileNBDDeviceFindUnused, virFileDeleteTree): Use new
      interface.
      * src/util/virnetdevtap.c (virNetDevTapGetRealDeviceName):
      Properly check readdir errors.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceFileIterate, virPCIGetNetName): Report readdir
      failures.
      (virPCIDeviceAddressIOMMUGroupIterate): Use new interface.
      * src/util/virscsi.c (virSCSIDeviceGetSgName): Report readdir
      failures, and avoid memory leak.
      (virSCSIDeviceGetDevName): Report readdir failures.
      * src/util/virusb.c (virUSBDeviceSearch): Report readdir
      failures.
      * src/util/virutil.c (virGetFCHostNameByWWN)
      (virFindFCHostCapableVport): Report readdir failures.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ac1d42ac
  3. 09 4月, 2014 6 次提交
    • J
      Fix build on mingw32 · 5dfcd6fb
      Ján Tomko 提交于
      My commit 897808e7 added a parameter to virCgroupGetPercpuStats,
      but didn't change the stub for systems where cgroups are not supported.
      5dfcd6fb
    • J
      Clean up virCgroupGetPercpuStats · 2adf59eb
      Ján Tomko 提交于
      The iterator is checked for being less than or equal to need_cpus.
      The 'n' variable is incremented need_cpus + 1 times.
      
      Simplify the computation of need_cpus and make its value one larger,
      to let it be used instead of 'n' and compared without the equal sign
      in loop conditions.
      
      Just index the sum_cpu_time array instead of using a helper variable.
      
      Start the loop at start_cpu instead of continuing for all lower values.
      2adf59eb
    • J
      Check maximum startcpu value correctly · 9fe5267a
      Ján Tomko 提交于
      The cpus are indexed from 0, so a startcpu value equal
      to the number of CPUs is invalid.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1070680
      9fe5267a
    • J
      Rename id, max_id to need_cpus, total_cpus · dd74ab4e
      Ján Tomko 提交于
      total_cpus is the total number of CPUs on the host
      need_cpus is the number of CPUs we need to look at
      
      (need_cpus can be larger than ncpus, because we need to look
       at CPUs before the startcpu too, even if we aren't reporting
       their stats)
      dd74ab4e
    • J
      Extend virCgroupGetPercpuStats to fill in vcputime too · 897808e7
      Ján Tomko 提交于
      Currently, virCgroupGetPercpuStats is only used by the LXC driver,
      filling out the CPUTIME stats. qemuDomainGetPercpuStats does this
      and also filles out VCPUTIME stats.
      
      Extend virCgroupGetPercpuStats to also report VCPUTIME stats if
      nvcpupids is non-zero. In the LXC driver, we don't have cpupids.
      In the QEMU driver, there is at least one cpupid for a running domain,
      so the behavior shouldn't change for QEMU either.
      
      Also rename getSumVcpuPercpuStats to virCgroupGetPercpuVcpuSum.
      897808e7
    • J
      Fix return value of virCgroupGetPercpuStats · 23d2d863
      Ján Tomko 提交于
      We need to return the number of successfully populated stats,
      not the nparams supplied by the user.
      23d2d863
  4. 31 3月, 2014 1 次提交
  5. 25 3月, 2014 1 次提交
  6. 21 3月, 2014 1 次提交
    • W
      cgroup: Fix start VMs coincidently failed · bfb29654
      Wang Yufei 提交于
      When I start multi VMs coincidently and any of the cgroup directories
      named machine doesn't exist. There's a chance that VM start failed because
      of creating directory failed:
      Unable to initialize /machine cgroup: File exists
      When the errno returned by mkdir in virCgroupMakeGroup is EEXIST,
      we should pass it through and continue to start the VM.
      Signed-off-by: NWang Yufei <james.wangyufei@huawei.com>
      bfb29654
  7. 18 3月, 2014 2 次提交
  8. 26 2月, 2014 1 次提交
    • E
      build: fix cgroups on non-Linux · fa2e4dbf
      Eric Blake 提交于
      Running ./autobuild.sh detected a mingw failure:
      
        CCLD     libvirt.la
      Cannot export virCgroupGetPercpuStats: symbol not defined
      Cannot export virCgroupSetOwner: symbol not defined
      
      * src/util/vircgroup.c (virCgroupGetPercpuStats)
      (virCgroupSetOwner): Implement stubs.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fa2e4dbf
  9. 24 2月, 2014 1 次提交
  10. 21 2月, 2014 1 次提交
  11. 20 2月, 2014 3 次提交
  12. 20 1月, 2014 1 次提交
  13. 10 12月, 2013 1 次提交
    • M
      cgroups: Redefine what "unlimited" means wrt memory limits · 231656bb
      Martin Kletzander 提交于
      Since kernel 3.12 (commit 34ff8dc08956098563989d8599840b130be81252 in
      linux-stable.git in particular) the value for 'unlimited' in cgroup
      memory limits changed from LLONG_MAX to ULLONG_MAX.  Due to rather
      unfortunate choice of our VIR_DOMAIN_MEMORY_PARAM_UNLIMITED constant
      (which we transfer as an unsigned long long in Kibibytes), we ended up
      with the situation described below (applies to x86_64):
      
       - 2^64-1 (ULLONG_MAX) -- "unlimited" in kernel = 3.12
      
       - 2^63-1 (LLONG_MAX) -- "unlimited" in kernel < 3.12
       - 2^63-1024 -- our PARAM_UNLIMITED scaled to Bytes
      
       - 2^53-1 -- our PARAM_UNLIMITED unscaled (in Kibibytes)
      
      This means that when any number within (2^63-1, 2^64-1] is read from
      memory cgroup, we are transferring that number instead of "unlimited".
      Unfortunately, changing VIR_DOMAIN_MEMORY_PARAM_UNLIMITED would break
      ABI compatibility and thus we have to resort to a different solution.
      
      With this patch every value greater than PARAM_UNLIMITED means
      "unlimited".  Even though this may seem misleading, we are already in
      such unclear situation when running 3.12 kernel with memory limits set
      to 2^63.
      
      One example showing most of the problems at once (with kernel 3.12.2):
       # virsh memtune asdf --hard-limit 9007199254740991 --swap-hard-limit -1
       # echo 12345678901234567890 >\
      /sys/fs/cgroup/memory/machine/asdf.libvirt-qemu/memory.soft_limit_in_bytes
       # virsh memtune asdf
       hard_limit     : 18014398509481983
       soft_limit     : 12056327051986884
       swap_hard_limit: 18014398509481983
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      231656bb
  14. 06 12月, 2013 1 次提交
  15. 15 10月, 2013 2 次提交
  16. 09 10月, 2013 1 次提交
  17. 16 9月, 2013 2 次提交
  18. 12 9月, 2013 1 次提交
  19. 11 9月, 2013 1 次提交
    • D
      Fix cgroups when all are mounted on /sys/fs/cgroup · f0b6d8d4
      Daniel P. Berrange 提交于
      Some users in Ubuntu/Debian seem to have a setup where all the
      cgroup controllers are mounted on /sys/fs/cgroup rather than
      any /sys/fs/cgroup/<controller> name. In the loop which detects
      which controllers are present for a mount point we were modifying
      'mnt_dir' field in the 'struct mntent' var, but not always restoring
      the original value. This caused detection to break in the all-in-one
      mount setup.
      
      Fix that logic bug and add test case coverage for this mount
      setup.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f0b6d8d4
  20. 13 8月, 2013 8 次提交
  21. 01 8月, 2013 3 次提交
    • D
      Enable support for systemd-machined in cgroups creation · 2fe24701
      Daniel P. Berrange 提交于
      Make the virCgroupNewMachine method try to use systemd-machined
      first. If that fails, then fallback to using the traditional
      cgroup setup code path.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2fe24701
    • D
      Cope with races while killing processes · 75304eaa
      Daniel P. Berrange 提交于
      When systemd is involved in managing processes, it may start
      killing off & tearing down croups associated with the process
      while we're still doing virCgroupKillPainfully. We must
      explicitly check for ENOENT and treat it as if we had finished
      killing processes
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      75304eaa
    • D
      Add support for systemd cgroup mount · aedd46e7
      Daniel P. Berrange 提交于
      Systemd uses a named cgroup mount for tracking processes. Add
      it as another type of controller, albeit one which we have to
      special case in a number of places. In particular we must
      never create/delete directories there, nor add tasks. Essentially
      the systemd mount is to be considered read-only for libvirt.
      
      With this change both the virCgroupDetectPlacement and
      virCgroupCopyPlacement methods must be invoked. The copy
      placement method will copy setup for resource controllers
      only. The detect placement method will probe for any
      named controllers, or resource controllers not already
      setup.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      aedd46e7