1. 06 12月, 2016 1 次提交
    • V
      cgroup: Use system reported "unlimited" value for comparison · ac8ac9e0
      Viktor Mihajlovski 提交于
      With kernel 3.18 (since commit 3e32cb2e0a12b6915056ff04601cf1bb9b44f967)
      the "unlimited" value for cgroup memory limits has changed once again as
      its byte value is now computed from a page counter.
      The new "unlimited" value reported by the cgroup fs is therefore 2**51-1
      pages which is (VIR_DOMAIN_MEMORY_PARAM_UNLIMITED - 3072). This results
      e.g. in virsh memtune displaying 9007199254740988 instead of unlimited
      for the limits.
      
      This patch uses the value of memory.limit_in_bytes from the cgroup
      memory root which is the system's "real" unlimited value for comparison.
      
      See also libvirt commit 231656bb for the
      history for kernel 3.12 and before.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      ac8ac9e0
  2. 25 11月, 2016 1 次提交
    • M
      virstring: Unify string list function names · c2a5a4e7
      Michal Privoznik 提交于
      We have couple of functions that operate over NULL terminated
      lits of strings. However, our naming sucks:
      
      virStringJoin
      virStringFreeList
      virStringFreeListCount
      virStringArrayHasString
      virStringGetFirstWithPrefix
      
      We can do better:
      
      virStringListJoin
      virStringListFree
      virStringListFreeCount
      virStringListHasString
      virStringListGetFirstWithPrefix
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c2a5a4e7
  3. 24 11月, 2016 1 次提交
  4. 13 10月, 2016 1 次提交
    • M
      src: Treat PID as signed · b7d2d4af
      Michal Privoznik 提交于
      This initially started as a fix of some debug printing in
      virCgroupDetect. However it turned out that other places suffer
      from the similar problem. While dealing with pids, esp. in cases
      where we cannot use pid_t for ABI stability reasons, we often
      chose an unsigned integer type. This makes no sense as pid_t is
      signed.
      Also, new syntax-check rule is introduced so we won't repeat this
      mistake.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b7d2d4af
  5. 06 9月, 2016 1 次提交
    • M
      Make sure sys/types.h is included after sys/sysmacros.h · f3f15cc2
      Michal Privoznik 提交于
      In the latest glibc, major() and minor() functions are marked as
      deprecated (glibc commit dbab6577):
      
        CC       util/libvirt_util_la-vircgroup.lo
      util/vircgroup.c: In function 'virCgroupGetBlockDevString':
      util/vircgroup.c:768:5: error: '__major_from_sys_types' is deprecated:
        In the GNU C Library, `major' is defined by <sys/sysmacros.h>.
        For historical compatibility, it is currently defined by
        <sys/types.h> as well, but we plan to remove this soon.
        To use `major', include <sys/sysmacros.h> directly.
        If you did not intend to use a system-defined macro `major',
        you should #undef it after including <sys/types.h>.
        [-Werror=deprecated-declarations]
           if (virAsprintf(&ret, "%d:%d ", major(sb.st_rdev), minor(sb.st_rdev)) < 0)
           ^~
      In file included from /usr/include/features.h:397:0,
                       from /usr/include/bits/libc-header-start.h:33,
                       from /usr/include/stdio.h:28,
                       from ../gnulib/lib/stdio.h:43,
                       from util/vircgroup.c:26:
      /usr/include/sys/sysmacros.h:87:1: note: declared here
       __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_FST_IMPL_TEMPL)
       ^
      
      Moreover, in the glibc commit, there's suggestion to keep
      ordering of including of header files as implemented here.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f3f15cc2
  6. 25 8月, 2016 1 次提交
  7. 26 7月, 2016 1 次提交
  8. 24 6月, 2016 6 次提交
  9. 10 6月, 2016 3 次提交
  10. 06 5月, 2016 1 次提交
    • M
      virCgroupValidateMachineGroup: Reflect change in CGroup struct naming · fb377701
      Michal Privoznik 提交于
      Fron c3bd0019 on instead of creating the following path for
      cgroups:
      
        /sys/fs/cgroupX/$name.libvirt-$driver
      
      we generate rather more verbose one:
      
        /sys/fs/cgroupX/$driver-$id-$name.libvirt-$driver
      
      where $name is optional and included iff contains allowed chars.
      See original commit for more reasoning. Now, problem with the
      original commit is that we are unable to start any LXC domain
      after it. Because when starting LXC container, the CGroup layout
      is created by our lxc_controller process and then detected and
      validated by libvirtd. The validation is done by trying to match
      detected layout against all the possible patterns for cgroup
      paths that we've ever had. And the commit in question forgot to
      update this part of the code.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      fb377701
  11. 19 4月, 2016 1 次提交
  12. 01 3月, 2016 2 次提交
  13. 17 2月, 2016 4 次提交
  14. 08 2月, 2016 2 次提交
  15. 05 2月, 2016 1 次提交
    • M
      systemd: Modernize machine naming · c3bd0019
      Martin Kletzander 提交于
      So, systemd-machined has this philosophy that machine names are like
      hostnames and hence should follow the same rules.  But we always allowed
      international characters in domain names.  Thus we need to modify the
      machine name we are passing to systemd.
      
      In order to change some machine names that we will be passing to systemd,
      we also need to call TerminateMachine at the end of a lifetime of a
      domain.  Even for domains that were started with older libvirt.  That
      can be achieved thanks to virSystemdGetMachineNameByPID().  And because
      we can change machine names, we can get rid of the inconsistent and
      pointless escaping of domain names when creating machine names.
      
      So this patch modifies the naming in the following way.  It creates the
      name as <drivername>-<id>-<name> where invalid hostname characters are
      stripped out of the name and if the resulting name is longer, it
      truncates it to 64 characters.  That way we can start domains we
      couldn't start before.  Well, at least on systemd.
      
      To make it work all together, the machineName (which is needed only with
      systemd) is saved in domain's private data.  That way the generation is
      moved to the driver and we don't need to pass various unnecessary
      arguments to cgroup functions.
      
      The only thing this complicates a bit is the scope generation when
      validating a cgroup where we must check both old and new naming, so a
      slight modification was needed there.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1282846Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c3bd0019
  16. 03 2月, 2016 1 次提交
  17. 27 1月, 2016 2 次提交
    • M
      vircgroup: Finish renaming of virCgroupIsolateMount · c7f5e26b
      Michal Privoznik 提交于
      In dc576025 we renamed virCgroupIsolateMount function to
      virCgroupBindMount. However, we forgot about one occurrence in
      section of the code which provides stubs for platforms without
      support for CGroups like *BSD for instance.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c7f5e26b
    • D
      lxc: don't try to hide parent cgroups inside container · dc576025
      Daniel P. Berrange 提交于
      On the host when we start a container, it will be
      placed in a cgroup path of
      
         /machine.slice/machine-lxc\x2ddemo.scope
      
      under /sys/fs/cgroup/*
      
      Inside the containers' namespace we need to setup
      /sys/fs/cgroup mounts, and currently will bind
      mount /machine.slice/machine-lxc\x2ddemo.scope on
      the host to appear as / in the container.
      
      While this may sound nice, it confuses applications
      dealing with cgroups, because /proc/$PID/cgroup
      now does not match the directory in /sys/fs/cgroup
      
      This particularly causes problems for systems and
      will make it create repeated path components in
      the cgroup for apps run in the container eg
      
        /machine.slice/machine-lxc\x2ddemo.scope/machine.slice/machine-lxc\x2ddemo.scope/user.slice/user-0.slice/session-61.scope
      
      This also causes any systemd service that uses
      sd-notify to fail to start, because when systemd
      receives the notification it won't be able to
      identify the corresponding unit it came from.
      In particular this break rabbitmq-server startup
      
      Future kernels will provide proper cgroup namespacing
      which will handle this problem, but until that time
      we should not try to play games with hiding parent
      cgroups.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dc576025
  18. 15 1月, 2016 1 次提交
  19. 12 1月, 2016 1 次提交
  20. 25 12月, 2015 1 次提交
  21. 15 12月, 2015 1 次提交
  22. 20 8月, 2015 1 次提交
    • R
      util: fix build without cgroup · 46550cde
      Roman Bogorodskiy 提交于
      Commit 89c509a0 added getters for cgroup block device I/O throttling,
      however stub versions of these functions have not matching function
      prototypes that result in compilation fail on platforms not supporting
      cgroup.
      
      Fix build by correcting prototypes of the stubbed functions.
      
      Pushing under build-breaker rule.
      46550cde
  23. 19 8月, 2015 2 次提交
  24. 22 7月, 2015 1 次提交
    • P
      cgroup: Drop resource partition from virSystemdMakeScopeName · 88f6c007
      Peter Krempa 提交于
      The scope name, even according to our docs is
      "machine-$DRIVER\x2d$VMNAME.scope" virSystemdMakeScopeName would use the
      resource partition name instead of "machine-" if it was specified thus
      creating invalid scope paths.
      
      This makes libvirt drop cgroups for a VM that uses custom resource
      partition upon reconnecting since the detected scope name would not
      match the expected name generated by virSystemdMakeScopeName.
      
      The error is exposed by the following log entry:
      
      debug : virCgroupValidateMachineGroup:302 : Name 'machine-qemu\x2dtestvm.scope' for controller 'cpu' does not match 'testvm', 'testvm.libvirt-qemu' or 'machine-test-qemu\x2dtestvm.scope'
      
      for a "/machine/test" resource and "testvm" vm.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1238570
      88f6c007
  25. 14 7月, 2015 1 次提交
  26. 10 4月, 2015 1 次提交