1. 17 7月, 2014 4 次提交
  2. 16 7月, 2014 4 次提交
    • E
      util: forbid freeing const pointers · a0b5ace2
      Eric Blake 提交于
      Now that we've finally fixed all the violators, it's time to
      enforce that any pointer to a const object is never freed (it
      is aliasing some other memory, where the non-const original
      should be freed instead).  Alas, the code still needs a normal
      vs. Coverity version, but at least we are still guaranteeing
      that the macro call evaluates its argument exactly once.
      
      I verified that we still get the following compiler warnings,
      which in turn halts the build thanks to -Werror on gcc (hmm,
      gcc 4.8.3's placement of the ^ for ?: type mismatch is a bit
      off, but that's not our problem):
      
          int oops1 = 0;
          VIR_FREE(oops1);
          const char *oops2 = NULL;
          VIR_FREE(oops2);
          struct blah { int dummy; } oops3;
          VIR_FREE(oops3);
      
      util/virauthconfig.c:159:35: error: pointer/integer type mismatch in conditional expression [-Werror]
           VIR_FREE(oops1);
                                         ^
      util/virauthconfig.c:161:5: error: passing argument 1 of 'virFree' discards 'const' qualifier from pointer target type [-Werror]
           VIR_FREE(oops2);
           ^
      In file included from util/virauthconfig.c:28:0:
      util/viralloc.h:79:6: note: expected 'void *' but argument is of type 'const void *'
       void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
            ^
      util/virauthconfig.c:163:35: error: type mismatch in conditional expression
           VIR_FREE(oops3);
                                         ^
      
      * src/util/viralloc.h (VIR_FREE): No longer cast away const.
      * src/xenapi/xenapi_utils.c (xenSessionFree): Work around bogus
      header.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a0b5ace2
    • C
      storagevol: add nocow to vol xml · a9fd30e6
      Chunyan Liu 提交于
      Add 'nocow' to storage volume xml so that user can have an option
      to set NOCOW flag to the newly created volume. It's useful on btrfs
      file system to enhance performance.
      
      Btrfs has low performance when hosting VM images, even more when the guest
      in those VM are also using btrfs as file system. One way to mitigate this
      bad performance is to turn off COW attributes on VM files. Generally, there
      are two ways to turn off COW on btrfs: a) by mounting fs with nodatacow,
      then all newly created files will be NOCOW. b) per file. Add the NOCOW file
      attribute. It could only be done to empty or new files.
      
      This patch tries the second way, according to 'nocow' option, it could set
      NOCOW flag per file:
      for raw file images, handle 'nocow' in libvirt code; for non-raw file images,
      pass 'nocow=on' option to qemu-img, and let qemu-img to handle that (requires
      qemu-img version >= 2.1).
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      a9fd30e6
    • R
      Implement interface stats for BSD · 61bbdbb9
      Roman Bogorodskiy 提交于
      61bbdbb9
    • R
      util: virstatslinux: make more generic · 5559a8b8
      Roman Bogorodskiy 提交于
      Rename linuxDomainInterfaceStats to virNetInterfaceStats in order
      to allow adding platform specific implementations without
      making consumer worrying about specific implementation to be used.
      
      Also, rename util/virstatslinux.c to util/virstats.c so placing
      other platform specific implementations into this file don't
      look unexpected from the file name.
      5559a8b8
  3. 14 7月, 2014 2 次提交
  4. 11 7月, 2014 2 次提交
  5. 09 7月, 2014 6 次提交
    • P
      util: storage: Fix build after 25924dec · 61e45dfb
      Peter Krempa 提交于
      The commit referenced above changed function arguments of
      virStorageFileGetMetadataFromBuf() but didn't tweak the
      ATTRIBUTE_NONNULL tied to them. This was caught by coverity as it
      actually obeys them. We disabled them for GCC and thus it didn't show
      up.
      
      Additionally in commit 3ea661de I passed
      NULL to the backingFormat argument which was also marked as nonnull. Use
      a dummy int's address when the argument isn't supplied so that the code
      doesn't need to change much.
      61e45dfb
    • P
      util: storage: Return complete parent info from virStorageFileChainLookup · 75017710
      Peter Krempa 提交于
      Instead of just returning the parent path, return the complete parent
      source structure.
      75017710
    • P
      util: storage: Make virStorageFileChainLookup more network storage aware · 09cea692
      Peter Krempa 提交于
      Add a few checks and avoid resolving relative links on networked
      storage.
      09cea692
    • M
      virEventPollDispatchHandles: Honour array boundaries · 52f50a71
      Michal Privoznik 提交于
      When dispatching events from the event loop, the array of registered
      handles is searched to see what handles happened an event on. However,
      the array is searched in weird way: the check for the array boundaries
      is at the end, so we may touch the elements after the end of the
      array:
      
      ==10434== Invalid read of size 4
      ==10434==    at 0x52D06B6: virEventPollDispatchHandles (vireventpoll.c:486)
      ==10434==    by 0x52D10E4: virEventPollRunOnce (vireventpoll.c:660)
      ==10434==    by 0x52CF207: virEventRunDefaultImpl (virevent.c:308)
      ==10434==    by 0x1639D1: virNetServerRun (virnetserver.c:1139)
      ==10434==    by 0x1220DC: main (libvirtd.c:1507)
      ==10434==  Address 0xc11ff04 is 4 bytes after a block of size 960 alloc'd
      ==10434==    at 0x4C2CA5E: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==10434==    by 0x52AD378: virReallocN (viralloc.c:245)
      ==10434==    by 0x52AD46E: virExpandN (viralloc.c:294)
      ==10434==    by 0x52AD5B1: virResizeN (viralloc.c:352)
      ==10434==    by 0x52CF2EC: virEventPollAddHandle (vireventpoll.c:116)
      ==10434==    by 0x52CEF5B: virEventAddHandle (virevent.c:78)
      ==10434==    by 0x11F69A90: nodeStateInitialize (node_device_udev.c:1797)
      ==10434==    by 0x53C3C89: virStateInitialize (libvirt.c:743)
      ==10434==    by 0x120563: daemonRunStateInit (libvirtd.c:919)
      ==10434==    by 0x5317719: virThreadHelper (virthread.c:197)
      ==10434==    by 0x8376F39: start_thread (in /lib64/libpthread-2.17.so)
      ==10434==    by 0x8A7F9FC: clone (in /lib64/libc-2.17.so)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      52f50a71
    • P
      util: XML: Avoid forward function declaration · 036dd423
      Peter Krempa 提交于
      Recursive functions apparently don't need them, but I originally thought
      they do.
      036dd423
    • P
      util: cgroup: Fix build on non-cgroup platforms · 464f7678
      Peter Krempa 提交于
      Commit a48f4451 introduced a helper
      function to convert cgroup device mode to string. The function was only
      conditionally compiled on platforms that support cgroup. This broke the
      build when attempting to export the symbol:
      
        CCLD     libvirt.la
        Cannot export virCgroupGetDevicePermsString: symbol not defined
      
      Move the function out of the ifdef, as it doesn't really depend on the
      cgroup code being present.
      464f7678
  6. 08 7月, 2014 8 次提交
  7. 04 7月, 2014 3 次提交
    • P
      util: storage: Add helper to determine whether storage is local · ea43f5f9
      Peter Krempa 提交于
      There's a lot of places where we skip doing actions based on the
      locality of given storage type. The usual pattern is to skip it if:
      
      virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_NETWORK
      
      Add a simple helper to simplify the pattern to
      virStorageSourceIsLocalStorage(src)
      ea43f5f9
    • J
      Utilize virDomainDiskAuth for domain disk · 6887af39
      John Ferlan 提交于
      Replace the inline "auth" struct in virStorageSource with a pointer
      to a virStorageAuthDefPtr and utilize between the domain_conf, qemu_conf,
      and qemu_command sources for finding the auth data for a domain disk
      6887af39
    • J
      virstorage: Introduce virStorageAuthDef · 1c36b944
      John Ferlan 提交于
      Introduce virStorageAuthDef and friends.  Future patches will merge/utilize
      their view of storage source/pool auth/secret definitions.
      
      New API's include:
          virStorageAuthDefParse:  Parse the "<auth/>" XML data for either the
                                   domain disk or storage pool returning a
                                   virStorageAuthDefPtr
          virStorageAuthDefCopy:   Copy a virStorageAuthDefPtr - to be used by
                                   the qemuTranslateDiskSourcePoolAuth when it
                                   copies storage pool auth data into domain
                                   disk auth data
          virStorageAuthDefFormat: Common output of the "<auth" in the domain
                                   disk or storage pool XML
          virStorageAuthDefFree:   Free memory associated with virStorageAuthDef
      
      Subsequent patches will utilize the new functions for the domain disk and
      storage pools.
      
      Future work in the hostdev pass through can then make use of common data
      structures and code.
      1c36b944
  8. 03 7月, 2014 4 次提交
    • J
      Remove double OOM error reporting · 5656d9bb
      Ján Tomko 提交于
      5656d9bb
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
    • J
      Introduce virBufferCheckError · 058d89b9
      Ján Tomko 提交于
      Check if the buffer is in error state and report an error if it is.
      
      This replaces the pattern:
      if (virBufferError(buf)) {
          virReportOOMError();
          goto cleanup;
      }
      with:
      
      if (virBufferCheckError(buf) < 0)
          goto cleanup;
      
      Document typical buffer usage to favor this.
      Also remove the redundant FreeAndReset - if an error has
      been set via virBufferSetError, the content is already freed.
      058d89b9
    • J
      usb: Remove redundant comment · a1228523
      Ján Tomko 提交于
      a1228523
  9. 02 7月, 2014 1 次提交
  10. 01 7月, 2014 2 次提交
    • J
      Report one error less when getting net dev speed · 1c7601f5
      Ján Tomko 提交于
      virFileReadAll already logs an error. If reading the 'speed' file
      fails with EINVAL, we log an error even though we ignore it. If it
      fails with other errors, we log two errors.
      
      Use virFileReadAllQuiet - ignore EINVAL and report just one error
      in other cases.
      
      Fixes this error on libvirtd startup:
      2014-06-30 12:47:14.583+0000: 20971: error : virFileReadAll:1297 :
      Failed to read file '/sys/class/net/wlan0/speed': Invalid argument
      1c7601f5
    • J
      Introduce virFileReadAllQuiet · f638c13e
      Ján Tomko 提交于
      Just like virFileReadAll, but returns -errno instead
      of reporting errors. Useful for ignoring some errors.
      f638c13e
  11. 26 6月, 2014 2 次提交
  12. 25 6月, 2014 2 次提交