1. 12 8月, 2014 3 次提交
    • E
    • G
      Don't fail qemu driver intialization if we can't determine hugepage size · ee2a7c54
      Guido Günther 提交于
      Otherwise we fail like
      
        libvirt version: 1.2.7, package: 6 (root 2014-08-08-16:09:22 bogon)
        virAuditOpen:62 : Unable to initialize audit layer: Protocol not supported
        virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse /proc/meminfo
        virStateInitialize:749 : Initialization of QEMU state driver failed: internal error: Unable to parse /proc/meminfo
        daemonRunStateInit:922 : Driver state initialization failed
      
      if the data can't be determined.
      
      Reference: http://bugs.debian.org/757609
      ee2a7c54
    • G
      Include param.h in case of HAVE_BSD_CPU_AFFINITY · 712374d1
      Guido Günther 提交于
      This fixes compilation on kFreeBSD which otherwise fails like
      
        CC       util/libvirt_util_la-virprocess.lo
      In file included from /usr/include/sys/cpuset.h:35:0,
                       from util/virprocess.c:43:
      /usr/include/sys/_cpuset.h:49:43: error: 'NBBY' undeclared here (not in
      a function)
        long __bits[howmany(CPU_SETSIZE, _NCPUBITS)];
                                                 ^
      In file included from util/virprocess.c:43:0:
      /usr/include/sys/cpuset.h:215:12: error: unknown type name 'cpusetid_t'
       int cpuset(cpusetid_t *);
                  ^
      /usr/include/sys/cpuset.h:216:30: error: expected ')' before 'id_t'
       int cpuset_setid(cpuwhich_t, id_t, cpusetid_t);
                                    ^
      /usr/include/sys/cpuset.h:217:42: error: expected ')' before 'id_t'
       int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *);
                                                ^
      /usr/include/sys/cpuset.h:218:48: error: expected ')' before 'id_t'
       int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t
      *);
                                                      ^
      /usr/include/sys/cpuset.h:219:48: error: expected ')' before 'id_t'
       int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const
      cpuset_t *);
      
      And it's the correct usage as documented in
      
        http://www.freebsd.org/cgi/man.cgi?query=cpuset_setid
      
      Also change the #ifdef HAVE_BSH_CPU_AFFINITY to #if for consistency.
      712374d1
  2. 08 8月, 2014 1 次提交
    • E
      blockjob: avoid memory leak during block pivot · a595a005
      Eric Blake 提交于
      Valgrind caught a memory leak:
      
      ==2018== 9 bytes in 1 blocks are definitely lost in loss record 143 of 927
      ==2018==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==2018==    by 0x8C42369: strdup (strdup.c:42)
      ==2018==    by 0x50EACC9: virStrdup (virstring.c:676)
      ==2018==    by 0x50E79E5: virStorageSourceCopy (virstoragefile.c:1845)
      ==2018==    by 0x20A3FAA7: qemuDomainBlockCommit (qemu_driver.c:15620)
      ==2018==    by 0x51DC6B2: virDomainBlockCommit (libvirt.c:20092)
      
      I traced it to the fact that blockcopy and blockcommit end up
      reparsing a backing chain on pivot, but the chain parsing code
      doesn't gracefully handle the case where the backing file is
      already known.
      
      I'm not exactly sure when this was introduced, but suspect that the
      refactoring in commit 9944b710 and friends that moved towards probing
      in-place rather than into a temporary structure are part of the cause.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal):
      Don't leak any prior value.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a595a005
  3. 06 8月, 2014 1 次提交
    • M
      qemu: Make virFileFindHugeTLBFS fault tolerant · d26e8108
      Michal Privoznik 提交于
      Since commit be0782e1 we are parsing /proc/meminfo to find out the
      default huge page size. However, if the host we are running at does
      not support any huge pages (e.g. CONFIG_HUGETLB_PAGE is turned off),
      we will not successfully parse the meminfo file and hence the whole
      qemu driver init process fails. Moreover, the default huge page size
      is needed if and only if there's at least one hugetlbfs mount point.
      So the fix consists of moving the virFileGetDefaultHugepageSize
      function call after the first hugetlbfs mount point is found.
      
      With this fix, we fail to start with one or more hugetlbfs mounts and
      malformed meminfo file, but that's expected (how can one mount
      hugetlbfs without kernel supporting huge pages?). Workaround in that
      case is to umount all the hugetlbfs mounts.
      Reported-by: NJim Fehlig <jfehlig@suse.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      d26e8108
  4. 04 8月, 2014 1 次提交
    • J
      Don't overwrite errors from virNetDevBandwidthSet · 6dac5d06
      Ján Tomko 提交于
      Otherwise this beautiful error would be overwritten when
      the function is called with a really high rate number:
      
      2014-07-28 12:51:47.920+0000: 2304: error : virCommandWait:2399 :
      internal error: Child process (/sbin/tc class add dev vnet0 parent 1:
      classid 1:1 htb rate 4294968kbps) unexpected exit status 1: Illegal "rate"
      Usage: ... qdisc add ... htb [default N] [r2q N]
       default  minor id of class to which unclassified packets are sent {0}
       r2q      DRR quantums are computed as rate in Bps/r2q {10}
       debug    string of 16 numbers each 0-3 {0}
      
      ... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]
                            [prio P] [slot S] [pslot PS]
                            [ceil R2] [cburst B2] [mtu MTU] [quantum Q]
       rate     rate allocated to this class (class can still borrow)
       burst    max bytes burst which can be accumulated during idle period {computed}
       mpu      minimum packet size used in rate computations
       overhead per-packet size overhead used in rate computations
       linklay  adapting to a linklayer e.g. atm
       ceil     definite upper class rate (no borrows) {rate}
       cburst   burst but for ceil {computed}
       mtu      max packet size we create rate map for {1600}
       prio     priority of leaf; lowe
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1043735
      6dac5d06
  5. 03 8月, 2014 1 次提交
    • E
      build: fix build on cygwin · 478d93ad
      Eric Blake 提交于
      Cygwin has getifaddrs(), but not AF_LINK, leading to:
      
      util/virstats.c: In function 'virNetInterfaceStats':
      util/virstats.c:138:41: error: 'AF_LINK' undeclared (first use in this function)
               if (ifa->ifa_addr->sa_family != AF_LINK)
      ...
      
      * src/util/virstats.c (virNetInterfaceStats): Only use getifaddrs
      if AF_LINK is present.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      478d93ad
  6. 29 7月, 2014 4 次提交
    • M
      virbitmap: Introduce virBitmapOverlaps · 49baed2b
      Michal Privoznik 提交于
      This internal API just checks if two bitmaps intersect or not.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      49baed2b
    • M
      Introduce virFileFindHugeTLBFS · be0782e1
      Michal Privoznik 提交于
      This should iterate over mount tab and search for hugetlbfs among with
      looking for the default value of huge pages.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      be0782e1
    • 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
  7. 25 7月, 2014 1 次提交
  8. 24 7月, 2014 5 次提交
  9. 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
  10. 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
  11. 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
  12. 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
  13. 17 7月, 2014 4 次提交
  14. 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
  15. 14 7月, 2014 2 次提交
  16. 11 7月, 2014 2 次提交
  17. 09 7月, 2014 1 次提交
    • 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