1. 16 9月, 2013 4 次提交
    • E
      build: fix build with latest rawhide kernel headers · e62e0094
      Eric Blake 提交于
      Bother those kernel developers.  In the latest rawhide, kernel
      and glibc have now been unified so that <netinet/in.h> and
      <linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
      not self-contained.  Because of the latest header change, the
      build is failing with:
      
      checking for linux/param.h... no
      configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
      
      with details:
      
      In file included from conftest.c:561:0:
      /usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
        struct in6_addr flr_dst;
      
      We need a workaround to avoid our workaround :)
      
      * configure.ac (NETINET_LINUX_WORKAROUND): New test.
      * src/util/virnetdevbridge.c (includes): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e62e0094
    • P
      cgroup: Move [qemu|lxc]GetCpuBWStatus to vicgroup.c and refactor it · d79fe8b5
      Peter Krempa 提交于
      The function existed in two identical instances in lxc and qemu. Move it
      to vircgroup.c and simplify it. Refactor the callers too.
      d79fe8b5
    • P
      cleanup: Kill usage of access(PATH, F_OK) in favor of virFileExists() · 4baa8d76
      Peter Krempa 提交于
      Semantics of the libvirt helper are more clear. This change also allows
      to clean up some pieces of code.
      4baa8d76
    • P
      util: Declare that virFileExists shall honor errno · d66e7ce6
      Peter Krempa 提交于
      Explicitly state that some parts of the code may require virFileExists
      to set or preserve a correct errno so that future modifications don't
      break.
      d66e7ce6
  2. 12 9月, 2013 1 次提交
  3. 11 9月, 2013 3 次提交
  4. 09 9月, 2013 1 次提交
  5. 05 9月, 2013 3 次提交
    • I
      Use loop-control to allocate loop device. · 9ba230d4
      Ian Main 提交于
      This patch changes virFileLoopDeviceOpen() to use the new loop-control
      device to allocate a new loop device.  If this behavior is unsupported
      we fall back to the previous method of searching /dev for a free device.
      
      With this patch you can start as many image based LXC domains as you
      like (well almost).
      
      Fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=995543
      9ba230d4
    • D
      Stop free'ing 'const char *' strings · bbcdd9b5
      Daniel P. Berrange 提交于
      The VIR_FREE() macro will cast away any const-ness. This masked a
      number of places where we passed a 'const char *' string to
      VIR_FREE. Fortunately in all of these cases, the variable was not
      in fact const data, but a heap allocated string. Fix all the
      variable declarations to reflect this.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bbcdd9b5
    • D
      virGet{User,Group}Ent() don't say success on fail · 4c7d1eab
      Doug Goldstein 提交于
      When virGetUserEnt() and virGetGroupEnt() fail due to the uid or gid not
      existing on the machine they'll print a message like:
      
      $ virsh -c vbox:///session list
      error: failed to connect to the hypervisor
      error: Failed to find user record for uid '32655': Success
      
      The success at the end is a bit confusing. This changes it to:
      
      $ virsh -c vbox:///session list
      error: failed to connect to the hypervisor
      error: Failed to find user record for uid '32655'
      4c7d1eab
  6. 04 9月, 2013 1 次提交
  7. 03 9月, 2013 1 次提交
    • M
      qemu: Handle huge number of queues correctly · 1dc5dea7
      Michal Privoznik 提交于
      Currently, kernel supports up to 8 queues for a multiqueue tap device.
      However, if user tries to enter a huge number (e.g. one million) the tap
      allocation fails, as expected. But what is not expected is the log full
      of warnings:
      
          warning : virFileClose:83 : Tried to close invalid fd 0
      
      The problem is, upon error we iterate over an array of FDs (handlers to
      queues) and VIR_FORCE_CLOSE() over each item. However, the array is
      pre-filled with zeros. Hence, we repeatedly close stdin. Ouch.
      But there's more. The queues allocation is done in virNetDevTapCreate()
      which cleans up the FDs in case of error. Then, its caller, the
      virNetDevTapCreateInBridgePort() iterates over the FD array and tries to
      close them too. And so does qemuNetworkIfaceConnect() and
      qemuBuildInterfaceCommandLine().
      1dc5dea7
  8. 30 8月, 2013 1 次提交
    • E
      random: don't mix RAND_MAX with random_r · dd3688e4
      Eric Blake 提交于
      FreeBSD 10 recently changed their definition of RAND_MAX, to try
      and cover the fact that their evenly distributed results of rand()
      really are a smaller range than a full power of 2.  As a result,
      I did some investigation, and learned:
      
      1. POSIX requires random() to be evenly distributed across exactly
      31 bits.  glibc also guarantees this for rand(), but the two are
      unrelated, and POSIX only associates RAND_MAX with rand().
      Avoiding RAND_MAX altogether thus avoids a build failure on
      FreeBSD 10.
      
      2. Concatenating random bits from a PRNG will NOT provide uniform
      coverage over the larger value UNLESS the period of the original
      PRNG is at least as large as the number of bits being concatenated.
      Simple example: suppose that RAND_MAX were 1 with a period of 2**1
      (which means that the PRNG merely alternates between 0 and 1).
      Concatenating two successive rand() calls would then invariably
      result in 01 or 10, which is a rather non-uniform distribution
      (00 and 11 are impossible) and an even worse period (2**0, since
      our second attempt will get the same number as our first attempt).
      But a RAND_MAX of 1 with a period of 2**2 (alternating between
      0, 1, 1, 0) provides sane coverage of all four values, if properly
      tempered.  (Back-to-back calls would still only see half the values
      if we don't do some tempering).  We therefore want to guarantee a
      period of at least 2**64, preferably larger (as a tempering factor);
      POSIX only makes this guarantee for random() with 256 bytes of info.
      
      * src/util/virrandom.c (virRandomBits): Use constants that are
      accurate for the PRNG we are using, not an unrelated PRNG.
      (randomState): Ensure the period of our PRNG exceeds our usage.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      dd3688e4
  9. 22 8月, 2013 2 次提交
  10. 19 8月, 2013 2 次提交
    • P
      virsystemd: Don't fail to start VM if DBus isn't available or compiled in · ee3db56f
      Peter Krempa 提交于
      On hosts that don't have the DBus service running or installed the new
      systemd cgroups code failed with hard error instead of falling back to
      "manual" cgroup creation.
      
      Use the new helper to check for the system bus and use the fallback code
      in case it isn't available.
      ee3db56f
    • P
      virdbus: Add virDBusHasSystemBus() · 2398dd3d
      Peter Krempa 提交于
      Some systems may not use DBus in their system. Add a method to check if
      the system bus is available that doesn't print error messages so that
      code can later check for this condition and use an alternative approach.
      2398dd3d
  11. 16 8月, 2013 2 次提交
    • P
      virbitmap: Refactor virBitmapParse to avoid access beyond bounds of array · 47b9127e
      Peter Krempa 提交于
      The virBitmapParse function was calling virBitmapIsSet() function that
      requires the caller to check the bounds of the bitmap without checking
      them. This resulted into crashes when parsing a bitmap string that was
      exceeding the bounds used as argument.
      
      This patch refactors the function to use virBitmapSetBit without
      checking if the bit is set (this function does the checks internally)
      and then counts the bits in the bitmap afterwards (instead of keeping
      track while parsing the string).
      
      This patch also changes the "parse_error" label to a more common
      "error".
      
      The refactor should also get rid of the need to call sa_assert on the
      returned variable as the callpath should allow coverity to infer the
      possible return values.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=997367
      
      Thanks to Alex Jia for tracking down the issue. This issue is introduced
      by commit 0fc89098.
      47b9127e
    • E
      maint: fix typo for 'switch' · c53b9c3e
      Eric Blake 提交于
      * src/util/virnetdevvportprofile.c: Fix typo.
      * src/conf/domain_conf.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c53b9c3e
  12. 13 8月, 2013 8 次提交
  13. 10 8月, 2013 1 次提交
  14. 09 8月, 2013 1 次提交
    • E
      build: more workarounds for if_bridge.h · 70024dc9
      Eric Blake 提交于
      This is a second attempt at fixing the problem first attempted
      in commit 2df8d991; basically undoing the fact that it was
      reverted in commit 43cee32f, plus fixing two more issues: the
      code in configure.ac has to EXACTLY match virnetdevbridge.c
      with regards to declaring in6 types before using if_bridge.h,
      and the fact that RHEL 5 has even more conflicts:
      
      In file included from util/virnetdevbridge.c:49:
      /usr/include/linux/in6.h:47: error: conflicting types for 'in6addr_any'
      /usr/include/netinet/in.h:206: error: previous declaration of 'in6addr_any' was here
      /usr/include/linux/in6.h:49: error: conflicting types for 'in6addr_loopback'
      /usr/include/netinet/in.h:207: error: previous declaration of 'in6addr_loopback' was here
      
      The rest of this commit message borrows from the original try
      of 2df8d991:
      
      A fresh checkout on a RHEL 6 machine with these packages:
      kernel-headers-2.6.32-405.el6.x86_64
      glibc-2.12-1.128.el6.x86_64
      failed to configure with this message:
      checking for linux/if_bridge.h... no
      configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
      
      Digging in config.log, we see that the problem is identical to
      what we fixed earlier in commit d12c2811:
      
      configure:98831: checking for linux/if_bridge.h
      configure:98853: gcc -std=gnu99 -c -g -O2  conftest.c >&5
      In file included from /usr/include/linux/if_bridge.h:17,
                       from conftest.c:559:
      /usr/include/linux/in6.h:31: error: redefinition of 'struct in6_addr'
      /usr/include/linux/in6.h:48: error: redefinition of 'struct sockaddr_in6'
      /usr/include/linux/in6.h:56: error: redefinition of 'struct ipv6_mreq'
      configure:98860: $? = 1
      
      I had not hit it earlier because I was using incremental builds,
      where config.cache had shielded me from the kernel-headers breakage.
      
      * configure.ac (if_bridge.h): Avoid conflicting type definitions.
      * src/util/virnetdevbridge.c (includes): Also sanitize for RHEL 5.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      70024dc9
  15. 08 8月, 2013 1 次提交
    • E
      maint: avoid C99 loop declaration · ed7e7c7d
      Eric Blake 提交于
      Commit 3d0e3c1a reintroduced a problem previously squelched in
      commit 7e5aa78d.  Add a syntax check this time around.
      
      util/virutil.c: In function 'virGetGroupList':
      util/virutil.c:1015: error: 'for' loop initial declaration used outside C99 mode
      
      * cfg.mk (sc_prohibit_loop_var_decl): New rule.
      * src/util/virutil.c (virGetGroupList): Fix offender.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ed7e7c7d
  16. 07 8月, 2013 1 次提交
    • G
      virGetGroupList: always include the primary group · 3d0e3c1a
      Guido Günther 提交于
      The change from initgroups to virGetGroupList/setgroups in
      cab36cfe71ba83b71e536ba5c98e596f02b697b0 dropped the primary group from
      processes group list iff the passed in group to virGetGroupList differs
      from the user's primary group.
      
      So always include the primary group to bring back the old behaviour.
      
      Debian has the kvm group as primary group but uses
      libvirt-qemu:libvirt-qemu as user:group to run the kvm process so
      without this change the /dev/kvm is inaccessible.
      3d0e3c1a
  17. 02 8月, 2013 1 次提交
  18. 01 8月, 2013 5 次提交
  19. 31 7月, 2013 1 次提交