1. 16 9月, 2014 5 次提交
    • J
      Wire up the interface backend options · b20d39a5
      Ján Tomko 提交于
      Pass the user-specified tun path down when creating tap device
      when called from the qemu driver.
      
      Also honor the vhost device path specified by user.
      b20d39a5
    • M
      virprocess: Extend list of platforms for setns wrapper · 735a15a6
      Michal Privoznik 提交于
      Currently, the setns() wrapper is supported only for x86_64 and i686
      which leaves us failing to build on other platforms like arm, aarch64
      and so on. This means, that the wrapper needs to be extended to those
      platforms and make to fail on runtime not compile time.
      
      The syscall numbers for other platforms was fetched using this
      command:
      
      kernel.git $ git grep "define.*__NR_setns" | grep -e arm -e powerpc -e s390
      arch/arm/include/uapi/asm/unistd.h:#define __NR_setns                   (__NR_SYSCALL_BASE+375)
      arch/arm64/include/asm/unistd32.h:#define __NR_setns 375
      arch/powerpc/include/uapi/asm/unistd.h:#define __NR_setns               350
      arch/s390/include/uapi/asm/unistd.h:#define __NR_setns          339
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      735a15a6
    • P
      util: storage: Fix qcow(2) header parser according to docs · 34e317cf
      Peter Krempa 提交于
      The backing store string location offset 0 determines that the file
      isn't present. The string size shouldn't be then checked:
      
      from qemu.git/docs/specs/qcow2.txt
      
      == Header ==
      
      The first cluster of a qcow2 image contains the file header:
      
      Byte  0 -  3:   magic
                      QCOW magic string ("QFI\xfb")
      
            4 -  7:   version
                      Version number (valid values are 2 and 3)
      
            8 - 15:   backing_file_offset
                      Offset into the image file at which the backing file name
                      is stored (NB: The string is not null terminated). 0 if the
                      image doesn't have a backing file.
      
           16 - 19:   backing_file_size
                      Length of the backing file name in bytes. Must not be
                      longer than 1023 bytes. Undefined if the image doesn't have
                      a backing file.         ^^^^^^^^^
      
      This patch intentionally leaves the backing file string size check in
      place in case a malformatted file would be presented to libvirt. Also
      according to the docs the string size is maximum 1023 bytes, thus this
      patch adds a check to verify that.
      
      I was also able to verify that the check was done the same way in the
      legacy qcow fromat (in qemu's code).
      34e317cf
    • J
      vircgroup: Fix broken builds without cgroups · e45f0d05
      John Ferlan 提交于
      I missed adding virCgroupNewIOThread to the !VIR_CGROUP_SUPPORTED
      
      Pushing as build breaker
      e45f0d05
    • J
      vircgroup: Introduce virCgroupNewIOThread · 3abb95ca
      John Ferlan 提交于
      Add virCgroupNewIOThread() to mimic virCgroupNewVcpu() except the naming
      scheme with use "iothread" rather than "vcpu".
      3abb95ca
  2. 15 9月, 2014 5 次提交
  3. 12 9月, 2014 4 次提交
    • J
      virfile: Resolve Coverity RESOURCE_LEAK · 8d44f924
      John Ferlan 提交于
      With the virGetGroupList() change in place - Coverity further complains
      that if we fail to virFork(), the groups will be leaked - which aha seems
      to be the case. Adjust the logic to save off the -errno, free the groups,
      and then return the value we saved
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      8d44f924
    • J
      virutil: Resolve Coverity RESOURCE_LEAK · 52e90b22
      John Ferlan 提交于
      This ends up being a very bizarre false positive. With an assist from
      eblake, the claim is that mgetgroups() could return a -1 value, but yet
      still have a groups buffer allocated, yet the example shown doesn't
      seem to prove that.
      
      Rather than fret about it, by adding a well placed sa_assert() on the
      returned *list value we can "assure" ourselves that the mgetgroups()
      failure path won't signal this condition.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      52e90b22
    • P
      util: Add function to check if a virStorageSource is "empty" · 5e3e9919
      Peter Krempa 提交于
      To express empty drive we historically use storage source with empty
      path. Unfortunately NBD disks may be declared without a path.
      
      Add a helper to wrap this logic.
      5e3e9919
    • D
      util: Allow port allocator to skip bind() check · 973173e6
      Daniel P. Berrange 提交于
      Test suites using the port allocator don't want to have different
      behaviour depending on whether a port is in use on the host. Add
      a VIR_PORT_ALLOCATOR_SKIP_BIND_CHECK which test suites can use
      to skip the bind() test. The port allocator will thus only track
      ports in use by the test suite process itself. This is fine when
      using the port allocator to generate guest configs which won't
      actually be launched
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      973173e6
  4. 11 9月, 2014 3 次提交
  5. 10 9月, 2014 3 次提交
  6. 09 9月, 2014 1 次提交
  7. 05 9月, 2014 2 次提交
    • E
      maint: use hanging curly braces · 625e04a8
      Eric Blake 提交于
      Our style overwhelmingly uses hanging braces (the open brace
      hangs at the end of the compound condition, rather than on
      its own line), with the primary exception of the top level function
      body.  Fix the few remaining outliers, before adding a syntax
      check in a later patch.
      
      * src/interface/interface_backend_netcf.c (netcfStateReload)
      (netcfInterfaceClose, netcf_to_vir_err): Correct use of { in
      compound statement.
      * src/conf/domain_conf.c (virDomainHostdevDefFormatSubsys)
      (virDomainHostdevDefFormatCaps): Likewise.
      * src/network/bridge_driver.c (networkAllocateActualDevice):
      Likewise.
      * src/util/virfile.c (virBuildPathInternal): Likewise.
      * src/util/virnetdev.c (virNetDevGetVirtualFunctions): Likewise.
      * src/util/virnetdevmacvlan.c
      (virNetDevMacVLanVPortProfileCallback): Likewise.
      * src/util/virtypedparam.c (virTypedParameterAssign): Likewise.
      * src/util/virutil.c (virGetWin32DirectoryRoot)
      (virFileWaitForDevices): Likewise.
      * src/vbox/vbox_common.c (vboxDumpNetwork): Likewise.
      * tests/seclabeltest.c (main): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      625e04a8
    • E
      maint: use consistent if-else braces in remaining spots · d194d6e7
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on all remaining problems, where there weren't
      enough issues to warrant splitting it further.
      
      * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}.
      * src/security/virt-aa-helper.c (vah_add_path, valid_path, main):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2):
      Likewise.
      * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise.
      * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise.
      * src/util/viralloc.c (virShrinkN): Likewise.
      * src/util/virbuffer.c (virBufferURIEncodeString): Likewise.
      * src/util/virdbus.c (virDBusCall): Likewise.
      * src/util/virnetdev.c (virNetDevValidateConfig): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileGetNthParent): Likewise.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceWaitForCleanup)
      (virPCIDeviceIsBehindSwitchLackingACS): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits):
      Likewise.
      * src/util/viruri.c (virURIParseParams): Likewise.
      * daemon/stream.c (daemonStreamHandleAbort): Likewise.
      * tests/testutils.c (virtTestResult): Likewise.
      * tests/cputest.c (cpuTestBaseline): Likewise.
      * tools/virsh-domain.c (cmdDomPMSuspend): Likewise.
      * tools/virsh-host.c (cmdNodeSuspend): Likewise.
      * src/esx/esx_vi_generator.py (Type.generate_typefromstring):
      Tweak generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d194d6e7
  8. 04 9月, 2014 1 次提交
  9. 03 9月, 2014 2 次提交
  10. 02 9月, 2014 1 次提交
  11. 28 8月, 2014 1 次提交
  12. 24 8月, 2014 1 次提交
  13. 22 8月, 2014 4 次提交
  14. 20 8月, 2014 2 次提交
    • M
      nodeCapsInitNUMA: Avoid @cpumap leak · f4c87a0c
      Michal Privoznik 提交于
      In case the host has 2 or more NUMA nodes, we fetch CPU map for each
      node. However, we need to free the CPU map in between loops:
      
      ==29513== 96 (72 direct, 24 indirect) bytes in 3 blocks are definitely lost in loss record 951 of 1,264
      ==29513==    at 0x4C2A700: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==29513==    by 0x52AD24B: virAlloc (viralloc.c:144)
      ==29513==    by 0x52AF0E6: virBitmapNew (virbitmap.c:78)
      ==29513==    by 0x52FB720: virNumaGetNodeCPUs (virnuma.c:294)
      ==29513==    by 0x53C700B: nodeCapsInitNUMA (nodeinfo.c:1886)
      ==29513==    by 0x11759708: vboxCapsInit (vbox_common.c:398)
      ==29513==    by 0x11759CC4: vboxConnectOpen (vbox_common.c:514)
      ==29513==    by 0x53C965F: do_open (libvirt.c:1147)
      ==29513==    by 0x53C9EBC: virConnectOpen (libvirt.c:1317)
      ==29513==    by 0x142905: remoteDispatchConnectOpen (remote.c:1215)
      ==29513==    by 0x126ADF: remoteDispatchConnectOpenHelper (remote_dispatch.h:2346)
      ==29513==    by 0x5453D21: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f4c87a0c
    • M
      cleanup spaces between parentheses and braces · 93cf8f98
      Martin Kletzander 提交于
      And add a syntax-check for '){$'.  It's not perfect, but better than
      nothing.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      93cf8f98
  15. 13 8月, 2014 1 次提交
    • E
      maint: improve syntax check for space around = · b50c8603
      Eric Blake 提交于
      Laine Stump noted on IRC that syntax check wasn't flagging his
      typo of 'i= 0'.  This fixes it.
      
      * build-aux/bracket-spacing.pl: Tighten 'space around =' rule.
      * src/storage/storage_backend.c
      (virStorageBackendCreateExecCommand): Fix offenders.
      * src/util/virnuma.c (virNumaGetDistances): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainSnapshotDeleteMetadataOnly)
      (vboxNetworkGetXMLDesc): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainLookupByName):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b50c8603
  16. 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
  17. 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