1. 28 8月, 2014 3 次提交
    • J
      qemu_capabilities: Resolve Coverity RESOURCE_LEAK · 2f7ced36
      John Ferlan 提交于
      Coverity determined that on error path that 'mach' wouldn't be free'd
      Since virCapabilitiesFreeGuestMachine() isn't globally available, we'll
      insert first and then if the VIR_STRDUP's fail they it will eventually
      cause the 'mach' to be freed in the error path
      2f7ced36
    • W
      qemu_capabilities: Resolve Coverity RESOURCE_LEAK · 6781d5b5
      Wang Rui 提交于
      In function virQEMUCapsParseMachineTypesStr, VIR_STRNDUP allocates
      memory for 'name' in {do,while} loop. If 'name' isn't freed before
      'continue', its memory will be allocated again in the next loop.
      In this case the memory allocated for 'name' in privious loop is
      useless and not freed. Free it before continue this loop to fix that.
      Signed-off-by: NWang Rui <moon.wangrui@huawei.com>
      6781d5b5
    • J
      qemu_capabilities: Resolve Coverity NULL_RETURNS · cabebc0c
      John Ferlan 提交于
      Adjust the initialization of qemuCaps() to check for a NULL before
      attempting to dereference like other callers/users do.
      cabebc0c
  2. 25 8月, 2014 1 次提交
  3. 20 8月, 2014 1 次提交
  4. 08 8月, 2014 1 次提交
  5. 29 7月, 2014 1 次提交
  6. 17 7月, 2014 4 次提交
  7. 16 7月, 2014 1 次提交
    • M
      Fix const correctness · 607806f8
      Michal Privoznik 提交于
      In many places we define a variable as a 'const char *' when in fact
      we modify it just a few lines below. Or even free it. We should not do
      that.
      
      There's one exception though, in xenSessionFree() xenapi_utils.c. We
      are freeing the xen_session structure which is defined in
      xen/api/xen_common.h public header. The structure contains session_id
      which is type of 'const char *' when in fact it should have been just
      'char *'. So I'm leaving this unmodified, just noticing the fact in
      comment.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      607806f8
  8. 14 7月, 2014 1 次提交
    • E
      capabilities: use bool instead of int · 58156f39
      Eric Blake 提交于
      While preparing to add a capability for active commit, I noticed
      that the existing code was abusing int for boolean values.
      
      * src/conf/capabilities.h (_virCapsGuestFeature, _virCapsHost)
      (virCapabilitiesNew, virCapabilitiesAddGuestFeature): Improve
      types.
      * src/conf/capabilities.c (virCapabilitiesNew)
      (virCapabilitiesAddGuestFeature): Adjust signature.
      * src/bhyve/bhyve_capabilities.c (virBhyveCapsBuild): Update
      clients.
      * src/esx/esx_driver.c (esxCapsInit): Likewise.
      * src/libxl/libxl_conf.c (libxlMakeCapabilities): Likewise.
      * src/lxc/lxc_conf.c (virLXCDriverCapsInit): Likewise.
      * src/openvz/openvz_conf.c (openvzCapsInit): Likewise.
      * src/parallels/parallels_driver.c (parallelsBuildCapabilities):
      Likewise.
      * src/phyp/phyp_driver.c (phypCapsInit): Likewise.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInit)
      (virQEMUCapsInitGuestFromBinary): Likewise.
      * src/security/virt-aa-helper.c (get_definition): Likewise.
      * src/test/test_driver.c (testBuildCapabilities): Likewise.
      * src/uml/uml_conf.c (umlCapsInit): Likewise.
      * src/vbox/vbox_tmpl.c (vboxCapsInit): Likewise.
      * src/vmware/vmware_conf.c (vmwareCapsInit): Likewise.
      * src/xen/xen_hypervisor.c (xenHypervisorBuildCapabilities):
      Likewise.
      * src/xenapi/xenapi_driver.c (getCapsObject): Likewise.
      * tests/qemucaps2xmltest.c (testGetCaps): Likewise.
      * tests/testutils.c (virTestGenericCapsInit): Likewise.
      * tests/testutilslxc.c (testLXCCapsInit): Likewise.
      * tests/testutilsqemu.c (testQemuCapsInit): Likewise.
      * tests/testutilsxen.c (testXenCapsInit): Likewise.
      * tests/vircaps2xmltest.c (buildVirCapabilities): Likewise.
      * tests/vircapstest.c (buildNUMATopology): Likewise.
      * tests/vmx2xmltest.c (testCapsInit): Likewise.
      * tests/xml2vmxtest.c (testCapsInit): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      58156f39
  9. 04 7月, 2014 2 次提交
    • P
      qemu: caps: Add capability for change-backing-file command · b20fb93c
      Peter Krempa 提交于
      This command allows to change the backing file name recorded in the
      metadata of a qcow (or other) image. The capability also notifies that
      the "block-stream" and "block-commit" commands understand the
      "backing-file" attribute.
      b20fb93c
    • E
      blockjob: turn on qemu capability bit for active commit · 40ad7160
      Eric Blake 提交于
      Use the probing functionality added in the last patch to turn on
      a capability bit when active commit is present, and gate active
      commit on that capability.
      
      For my own reference: the difference between BLOCKJOB_SYNC and
      BLOCKJOB_ASYNC is whether qemu generated an event at the
      conclusion of blockpull; basically, RHEL 6.2 was the only release
      of qemu that has the sync semantics and lacks the event.  RHEL
      6.3 added blockcopy, but also picked up on the upstream style
      of qemu generating events.  As no one is likely to backport
      active commit to RHEL 6.2, it's safe for blockcommit to always
      require async blockjob support.
      
      Modifying qemucapabilitiestest is painful; the .replies files would
      be so much easier if they had comments correlating which command
      generated the given reply.  Maybe I'll fix that up later...
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_ACTIVE_COMMIT): New
      capability.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Use the new bit
      * src/qemu/qemu_capabilities.c (virQEMUCaps): Name the new bit.
      (virQEMUCapsProbeQMPCommands): Set it.
      * tests/qemucapabilitiesdata/caps_1.3.1-1.replies: Update.
      * tests/qemucapabilitiesdata/caps_1.4.2-1.replies: Likewise.
      * tests/qemucapabilitiesdata/caps_1.5.3-1.replies: Likewise.
      * tests/qemucapabilitiesdata/caps_1.6.0-1.replies: Likewise.
      * tests/qemucapabilitiesdata/caps_1.6.50-1.replies: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      40ad7160
  10. 03 7月, 2014 5 次提交
  11. 25 6月, 2014 1 次提交
    • J
      qemu: enum cleanups in "src/qemu/*" · aa990efe
      Julio Faracco 提交于
      As we are doing with the enum structures, a cleanup in "src/qemu/"
      directory was done now. All the enums that were defined in the
      header files were converted to typedefs in this directory. This
      patch includes all the adjustments to remove conflicts when you do
      this kind of change. "Enum-to-typedef"'s conversions were made in
      "src/qemu/qemu_{capabilities, domain, migration, hotplug}.h".
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      aa990efe
  12. 19 6月, 2014 1 次提交
    • M
      virCaps: expose pages info · 02129b7c
      Michal Privoznik 提交于
      There are two places where you'll find info on page sizes. The first
      one is under <cpu/> element, where all supported pages sizes are
      listed. Then the second one is under each <cell/> element which refers
      to concrete NUMA node. At this place, the size of page's pool is
      reported. So the capabilities XML looks something like this:
      
      <capabilities>
      
        <host>
          <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
          <cpu>
            <arch>x86_64</arch>
            <model>Westmere</model>
            <vendor>Intel</vendor>
            <topology sockets='1' cores='1' threads='1'/>
            ...
            <pages unit='KiB' size='4'/>
            <pages unit='KiB' size='2048'/>
            <pages unit='KiB' size='1048576'/>
          </cpu>
          ...
          <topology>
            <cells num='4'>
              <cell id='0'>
                <memory unit='KiB'>4054408</memory>
                <pages unit='KiB' size='4'>1013602</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
                </cpus>
              </cell>
              <cell id='1'>
                <memory unit='KiB'>4071072</memory>
                <pages unit='KiB' size='4'>1017768</pages>
                <pages unit='KiB' size='2048'>3</pages>
                <pages unit='KiB' size='1048576'>1</pages>
                <distances/>
                <cpus num='1'>
                  <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
                </cpus>
              </cell>
              ...
            </cells>
          </topology>
          ...
        </host>
      
        <guest/>
      
      </capabilities>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      02129b7c
  13. 27 5月, 2014 1 次提交
  14. 07 5月, 2014 1 次提交
    • J
      Add support for timestamping QEMU logs · f3be5f0c
      Ján Tomko 提交于
      QEMU commit 5e2ac51 added a boolean '-msg timestamp=[on|off]'
      option, which can enable timestamps on errors:
      $ qemu-system-x86_64 -msg timestamp=on zghhdorf
      2014-04-09T13:25:46.779484Z qemu-system-x86_64: -msg timestamp=on: could
      not open disk image zghhdorf: Could not open 'zghhdorf': No such file or
      directory
      
      Enable this timestamp if the QEMU binary supports it.
      
      Add a 'log_timestamp' option to qemu.conf for disabling this behavior.
      f3be5f0c
  15. 06 5月, 2014 1 次提交
    • L
      qemu: add host-pci-multidomain capability · 17133e37
      Laine Stump 提交于
      Quite a long time ago, (apparently between qemu 0.12 and 0.13) qemu
      quietly began supporting the optional specification of a domain in the
      host-side address of all pci passthrough commands (by simply
      prepending it to the bus:slot.function format, as
      "dddd:bb:ss.f"). Since machines with multiple PCI domains are very
      rare, this never came up in practice, so libvirt was never updated to
      support it.
      
      This patch takes the first step to supporting specification of a non-0
      domain in the host-side address of PCI devices being assigned to a
      domain, by adding a capability bit to indicate support
      "QEMU_CAPS_HOST_PCI_MULTIDOMAIN", and detect it. Since this support
      was added in a version prior to the minimum version required for
      QMP-style capabilities detection, the capability is always enabled for
      any qemu that uses QMP for capabilities detection. For older qemus,
      the only clue that a domain can be specified in the host pci address
      is the presence of the string "[seg:]" in the help string for
      -pcidevice. (Ironically, libvirt will not be modified to support
      specification of domain for -pcidevice, since any qemu new enough for
      us to care about also supports "-device pci-assign" or "-device
      vfio-pci", which are greatly preferred).
      17133e37
  16. 24 4月, 2014 1 次提交
    • D
      Fix pci bus naming for PPC · 27b2b987
      Daniel P. Berrange 提交于
      Recent discussions around naming of 'pci' vs 'pci.0' for PPC
      made me go back and look at the PPC emulator in every historical
      version of QEMU since 1.0. The results were worse than I imagined.
      This patch adds the logic required to make libvirt work with PPC
      correctly with naming variations across all versions & machine
      types.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      27b2b987
  17. 22 4月, 2014 1 次提交
  18. 18 4月, 2014 2 次提交
  19. 08 4月, 2014 3 次提交
  20. 07 4月, 2014 1 次提交
    • E
      hash: add common utility functions · 09567144
      Eric Blake 提交于
      I almost wrote a hash value free function that just called
      VIR_FREE, then realized I couldn't be the first person to
      do that.  Sure enough, it was worth factoring into a common
      helper routine.
      
      * src/util/virhash.h (virHashValueFree): New function.
      * src/util/virhash.c (virHashValueFree): Implement it.
      * src/util/virobject.h (virObjectFreeHashData): New function.
      * src/libvirt_private.syms (virhash.h, virobject.h): Export them.
      * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit): Use
      common function.
      * src/qemu/qemu_capabilities.c (virQEMUCapsCacheNew): Likewise.
      * src/qemu/qemu_command.c (qemuDomainCCWAddressSetCreate):
      Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorGetBlockInfo): Likewise.
      * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
      * src/util/virclosecallbacks.c (virCloseCallbacksNew): Likewise.
      * src/util/virkeyfile.c (virKeyFileParseGroup): Likewise.
      * tests/qemumonitorjsontest.c
      (testQemuMonitorJSONqemuMonitorJSONGetBlockInfo): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      09567144
  21. 27 3月, 2014 1 次提交
    • N
      Fix Memory Leak in virQEMUCapsInitGuestFromBinary() · faad5582
      Nehal J Wani 提交于
      While running qemucaps2xmltest, it was found that valgrind pointed out
      the following memory leaks:
      
      ==29896== 0 bytes in 1 blocks are definitely lost in loss record 1 of 65
      ==29896==    at 0x4A0577B: calloc (vg_replace_malloc.c:593)
      ==29896==    by 0x4C6B45E: virAllocN (viralloc.c:191)
      ==29896==    by 0x4232A9: virQEMUCapsGetMachineTypesCaps (qemu_capabilities.c:1999)
      ==29896==    by 0x4234E7: virQEMUCapsInitGuestFromBinary (qemu_capabilities.c:789)
      ==29896==    by 0x41F10B: testQemuCapsXML (qemucaps2xmltest.c:118)
      ==29896==    by 0x41FFD1: virtTestRun (testutils.c:201)
      ==29896==    by 0x41EE7A: mymain (qemucaps2xmltest.c:203)
      ==29896==    by 0x42074D: virtTestMain (testutils.c:789)
      ==29896==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
      ==29896==
      ==29896== 0 bytes in 1 blocks are definitely lost in loss record 2 of 65
      ==29896==    at 0x4A0577B: calloc (vg_replace_malloc.c:593)
      ==29896==    by 0x4C6B45E: virAllocN (viralloc.c:191)
      ==29896==    by 0x4232A9: virQEMUCapsGetMachineTypesCaps (qemu_capabilities.c:1999)
      ==29896==    by 0x4234E7: virQEMUCapsInitGuestFromBinary (qemu_capabilities.c:789)
      ==29896==    by 0x41F10B: testQemuCapsXML (qemucaps2xmltest.c:118)
      ==29896==    by 0x41FFD1: virtTestRun (testutils.c:201)
      ==29896==    by 0x41EEA3: mymain (qemucaps2xmltest.c:204)
      ==29896==    by 0x42074D: virtTestMain (testutils.c:789)
      ==29896==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      faad5582
  22. 26 3月, 2014 2 次提交
  23. 25 3月, 2014 1 次提交
  24. 20 3月, 2014 1 次提交
    • J
      Fix virQEMUCapsLoadCache leaks · ba354048
      Ján Tomko 提交于
      Valgrind reported leaking of maxCpus and arch strings from
      virXPathString, as well as the leak of the machineMaxCpus array.
      
      Don't use 'str' for the strings we don't want to free, to allow
      freeing of 'str' in the cleanup label and free machineMaxCpus
      in virCapsReset too.
      ba354048
  25. 18 3月, 2014 2 次提交