1. 29 7月, 2014 2 次提交
    • E
      nodedev: fix pci express memory leak · c6a4d268
      Eric Blake 提交于
      Leak introduced in commit 16ebf10f (v1.2.6), detected by valgrind:
      
      ==9816== 216 (96 direct, 120 indirect) bytes in 6 blocks are definitely lost in loss record 665 of 821
      ==9816==    at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==9816==    by 0x50836FB: virAlloc (viralloc.c:144)
      ==9816==    by 0x1DBDBE27: udevProcessPCI (node_device_udev.c:546)
      ==9816==    by 0x1DBDD79D: udevGetDeviceDetails (node_device_udev.c:1293)
      
      * src/util/virpci.h (virPCIEDeviceInfoFree): New prototype.
      * src/util/virpci.c (virPCIEDeviceInfoFree): New function.
      * src/conf/node_device_conf.c (virNodeDevCapsDefFree): Clear
      pci_express under pci case.
      (virNodeDevCapPCIDevParseXML): Avoid leak.
      * src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
      * src/libvirt_private.syms (virpci.h): Export it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c6a4d268
    • E
      nodedev: move pci express types to virpci.h · be05c141
      Eric Blake 提交于
      Finding virPCIE* code is more intuitive if located in virpci.h
      instead of node_device_conf.h.
      
      * src/conf/node_device_conf.h (virPCIELinkSpeed, virPCIELink)
      (virPCIEDeviceInfo): Move...
      * src/util/virpci.h: ...here.
      * src/conf/node_device_conf.c (virPCIELinkSpeed): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      be05c141
  2. 25 7月, 2014 1 次提交
  3. 24 7月, 2014 5 次提交
  4. 23 7月, 2014 3 次提交
    • J
      Introduce virTristateSwitch enum · 3227e17d
      Ján Tomko 提交于
      For the values "default", "on", "off"
      
      Replaces
      virDeviceAddressPCIMulti
      virDomainFeatureState
      virDomainIoEventFd
      virDomainVirtioEventIdx
      virDomainDiskCopyOnRead
      virDomainMemDump
      virDomainPCIRombarMode
      virDomainGraphicsSpicePlaybackCompression
      3227e17d
    • J
      Introduce virTristateBool enum type · bb018ce6
      Ján Tomko 提交于
      Replace all three-state (default/yes/no) enums with it:
      virDomainBIOSUseserial
      virDomainBootMenu
      virDomainPMState
      virDomainGraphicsSpiceClipboardCopypaste
      virDomainGraphicsSpiceAgentFileTransfer
      virNetworkDNSForwardPlainNames
      bb018ce6
    • C
      lxc: allow to keep or drop capabilities · 47e5b5ae
      Cédric Bosdonnat 提交于
      Added <capabilities> in the <features> section of LXC domains
      configuration. This section can contain elements named after the
      capabilities like:
      
        <mknod state="on"/>, keep CAP_MKNOD capability
        <sys_chroot state="off"/> drop CAP_SYS_CHROOT capability
      
      Users can restrict or give more capabilities than the default using
      this mechanism.
      47e5b5ae
  5. 22 7月, 2014 4 次提交
    • E
      build: fix build without numactl · 72823b44
      Eric Blake 提交于
      Under ./configure --without-numactl but with numactl-devel installed,
      the build fails with:
      
      ../../src/util/virnuma.c: In function 'virNumaNodeIsAvailable':
      ../../src/util/virnuma.c:407:5: error: implicit declaration of function 'numa_bitmask_isbitset' [-Werror=implicit-function-declaration]
           return numa_bitmask_isbitset(numa_nodes_ptr, node);
           ^
      
      and other failures, all because the configure results for particular
      functions were used without regard to whether libnuma was even being
      linked in.
      
      * src/util/virnuma.c (virNumaGetPages): Fix message typo.
      (virNumaNodeIsAvailable): Correct build when not using numactl.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      72823b44
    • R
      Fix build on non-Linux platforms · b5f57be2
      Roman Bogorodskiy 提交于
      Commit ef48a1b6 introduced virFindSCSIHostByPCI for Linux and
      a stub for other platforms that returns -1 while the function
      should return 'char *', so use 'return NULL' instead.
      
      Commit fbd91d49 introduced virReadSCSIUniqueId with the third
      argument 'int *result', however the stub for non-Linux patform
      uses 'unsigned int *result', so change it to 'int *result'.
      
      Pushed under the build breaker rule.
      b5f57be2
    • J
      scsi_host: Introduce virFindSCSIHostByPCI · ef48a1b6
      John Ferlan 提交于
      Introduce a new function to parse the provided scsi_host parent address
      and unique_id value in order to find the /sys/class/scsi_host directory
      which will allow a stable SCSI host address
      
      Add a test to scsihosttest to lookup the host# name by using the PCI address
      and unique_id value
      ef48a1b6
    • J
      virutil: Introduce virReadSCSIUniqueId · fbd91d49
      John Ferlan 提交于
      Introduce a new function to read the current scsi_host entry and return
      the value found in the 'unique_id' file.
      
      Add a 'scsihosttest' test (similar to the fchosttest, but incorporating some
      of the concepts of the mocked pci test library) in order to read the
      unique_id file like would be found in the /sys/class/scsi_host tree.
      fbd91d49
  6. 21 7月, 2014 1 次提交
    • P
      util: Check return value from virStrToLong* functions · 5df81317
      Peter Krempa 提交于
      We do so in the vast majority of places, so there's no problem of adding
      the attribute to enforce it by the complier and fix a few leftover
      places.
      
      This was originally pointed out by Coverity as a recent change triggered
      it's warning that our code checked the vast majority of returns from
      virStrToLong_ui.
      5df81317
  7. 18 7月, 2014 2 次提交
    • M
      Kill last strto{l,ll,d} scouts · 50281605
      Michal Privoznik 提交于
      There's no need to use it since we have this shiny functions
      that even checks for conversion and overflow errors.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      50281605
    • J
      storage: Disallow vol_wipe for sparse logical volumes · 8a9f7cbe
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1091866
      
      Add a new boolean 'sparse'.  This will be used by the logical backend
      storage driver to determine whether the target volume is sparse or not
      (also known by a snapshot or thin logical volume). Although setting sparse
      to true at creation could be seen as duplicitous to setting during
      virStorageBackendLogicalMakeVol() in case there are ever other code paths
      between Create and FindLVs that need to know about the volume be sparse.
      
      Use the 'sparse' in a new virStorageBackendLogicalVolWipe() to decide whether
      to attempt to wipe the logical volume or not. For now, I have found no
      means to wipe the volume without writing to it. Writing to the sparse
      volume causes it to be filled. A sparse logical volume is not completely
      writeable as there exists metadata which if overwritten will cause the
      sparse lv to go INACTIVE which means pool-refresh will not find it.
      Access to whatever lvm uses to manage data blocks is not provided by
      any API I could find.
      8a9f7cbe
  8. 17 7月, 2014 4 次提交
  9. 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
  10. 14 7月, 2014 2 次提交
  11. 11 7月, 2014 2 次提交
  12. 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
  13. 08 7月, 2014 4 次提交