1. 16 11月, 2014 3 次提交
    • J
      qemu: Don't try to parse -help for new QEMU · c2dd9c69
      Jiri Denemark 提交于
      Since QEMU 1.2.0, we switched to QMP probing instead of parsing -help
      (and other commands, such as -cpu ?) output. However, if QMP probing
      failed, we still tried starting QEMU with various options and parsing
      the output, which was guaranteed to fail because the output changed.
      Let's just refuse parsing -help for QEMU >= 1.2.0.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1160318Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      (cherry picked from commit ae3e29e6)
      
      Conflicts:
      	tests/qemuhelptest.c
      c2dd9c69
    • M
      qemu: make sure capability probing process can start · 963d0bb5
      Martin Kletzander 提交于
      When daemon is killed right in the middle of probing a qemu binary for
      its capabilities, the qemu process is left running.  Next time the
      daemon is starting, it cannot start the probing qemu process because the
      one that's already running does have the pidfile flock()'d.
      Reported-by: NWang Yufei <james.wangyufei@huawei.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      (cherry picked from commit 0ed1b55b)
      963d0bb5
    • E
      qemu: better error message when block job can't succeed · ecfdfb15
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1140981 reports that
      the qemu-kvm shipped as part of RHEL 7.0 intentionally[1] cripples
      block jobs by removing the 'block-stream' QMP command, while still
      leaving 'block-job-cancel' as an unusable no-op.  Meanwhile, we
      already had existing code that checked whether block jobs were
      completely missing (such as qemu 0.15), old style (cancel is
      synchronous, and all commands spelled with '_'), or new style
      (cancel is asynchronous, and all commands spelled with '-'), and
      used that three-way probe to give decent error messages.  At the
      time that code was added, all existing qemu versions fell in one
      of three buckets, and the code was using the presence of
      'block-job-cancel' as the witness of which of the three buckets.
      But now that RHEL qemu has shipped with intentionally crippled
      'block-stream', we have a fourth bucket, which results in ugly
      error messages when trying 'virsh blockpull':
      
       error: Requested operation is not valid: Command 'block-stream' is not found
      
      In reality, the fourth bucket should be treated the same as the
      first bucket (no block job support); we can do that by realizing
      that no existing build of qemu has working block-stream while
      lacking block-job-cancel, so it is easiest to change our witness
      to the command that starts a job rather than ends one.  We still
      act correctly regarding command spelling and whether cancel is
      asynchronous.  And on crippled RHEL builds, we now get the desired:
      
       error: unsupported configuration: block jobs not supported with this qemu binary
      
      [1] The intentional cripple is limited to qemu-kvm of RHEL; when using
      qemu-kvm-rhev of RHEV, block job functionality is supported.  Don't ask
      me to explain the "why" behind it all - I'm just dealing with fallout
      from someone else's decision.
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_BLOCKJOB_SYNC): Tweak comment.
      * src/qemu/qemu_capabilities.c (virQEMUCapsCommands): Look for stream
      rather than cancel when determining the flavor of block jobs supported.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 00331bfb)
      ecfdfb15
  2. 27 9月, 2014 1 次提交
  3. 23 9月, 2014 1 次提交
  4. 19 9月, 2014 1 次提交
  5. 18 9月, 2014 1 次提交
    • R
      Fix build in qemu_capabilities · 3b3947ea
      Roman Bogorodskiy 提交于
      Commit f05b6a91 added virQEMUDriverConfigPtr argument to the
      virQEMUCapsFillDomainCaps function and it uses forward declaration
      of virQEMUDriverConfig and virQEMUDriverConfigPtr that casues clang
      build to fail:
      
      gmake[3]: Entering directory `/usr/home/novel/code/libvirt/src'
        CC       qemu/libvirt_driver_qemu_impl_la-qemu_capabilities.lo
      In file included from qemu/qemu_capabilities.c:43:
      In file included from qemu/qemu_hostdev.h:27:
      qemu/qemu_conf.h:63:37: error: redefinition of typedef 'virQEMUDriverConfig'
      is a C11 feature [-Werror,-Wtypedef-redefinition]
      typedef struct _virQEMUDriverConfig virQEMUDriverConfig;
                                          ^
      qemu/qemu_capabilities.h:328:37: note: previous definition is here
      typedef struct _virQEMUDriverConfig virQEMUDriverConfig;
                                          ^
      
      Fix that by passing loader and nloader config attributes directly
      instead of passing complete config.
      3b3947ea
  6. 17 9月, 2014 3 次提交
  7. 12 9月, 2014 1 次提交
    • J
      qemu: Resolve Coverity FORWARD_NULL · 78fbc79d
      John Ferlan 提交于
      If we end up at the cleanup lable before we've VIR_EXPAND_N the list,
      then calling virQEMUCapsFreeStringList() with a NULL proplist could
      theoretically deref proplist if nproplist was set. Coverity doesn't
      seem to acknowledge the relationship between proplist and nproplist
      assuming in virQEMUCapsFreeStringList that nproplist could be at
      least 1 and thus have a null deref.  It only seems to follow the
      NULL proplist.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      78fbc79d
  8. 11 9月, 2014 1 次提交
  9. 04 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in qemu · 44e30277
      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 commit focuses on the qemu driver.
      
      * src/qemu/qemu_command.c (qemuParseISCSIString)
      (qemuParseCommandLineDisk, qemuParseCommandLine)
      (qemuBuildSmpArgStr, qemuBuildCommandLine)
      (qemuParseCommandLineDisk, qemuParseCommandLineSmp): Correct use
      of {}.
      * src/qemu/qemu_capabilities.c (virQEMUCapsProbeCPUModels):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainCoreDumpWithFormat)
      (qemuDomainRestoreFlags, qemuDomainGetInfo)
      (qemuDomainMergeBlkioDevice): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextCreateSnapshot)
      (qemuMonitorTextLoadSnapshot, qemuMonitorTextDeleteSnapshot):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessStop): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      44e30277
  10. 29 8月, 2014 1 次提交
    • J
      qemu: Add support for iothreads · 72edaae7
      John Ferlan 提交于
      Add a new capability to ensure the iothreads feature exists for the qemu
      emulator being run - requires the "query-iothreads" QMP command. Using the
      domain XML add correspoding command argument in order to generate the
      threads. The iothreads will use a name space "iothread#" where, the
      future patch to add support for using an iothread to a disk definition to
      merely define which of the available threads to use.
      
      Add tests to ensure the xml/argv processing is correct.  Note that no
      change was made to qemuargv2xmltest.c as processing the -object element
      would require knowing more than just iothreads.
      72edaae7
  11. 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
  12. 25 8月, 2014 1 次提交
  13. 20 8月, 2014 1 次提交
  14. 08 8月, 2014 1 次提交
  15. 29 7月, 2014 1 次提交
  16. 17 7月, 2014 4 次提交
  17. 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
  18. 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
  19. 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
  20. 03 7月, 2014 5 次提交
  21. 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
  22. 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
  23. 27 5月, 2014 1 次提交
  24. 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
  25. 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
  26. 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