1. 04 7月, 2014 2 次提交
    • 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
    • E
      blockjob: allow omitted arguments to QMP block-commit · 47549d5a
      Eric Blake 提交于
      We are about to turn on support for active block commit.  Although
      qemu 2.0 was the first version to mostly support it, that version
      mis-handles 0-length files, and doesn't have anything available for
      easy probing.  But qemu 2.1 fixed bugs, and made life simpler by
      letting the 'top' argument be optional.  Unless someone begs for
      active commit with qemu 2.0, for now we are just going to enable
      it only by probing for qemu 2.1 behavior (anyone backporting active
      commit can also backport the optional argument behavior).  This
      requires qemu.git commit 7676e2c597000eff3a7233b40cca768b358f9bc9.
      
      Although all our actual uses of block-commit supply arguments for
      both base and top, we can omit both arguments and use a bogus
      device string to trigger an interesting behavior in qemu.  All QMP
      commands first do argument validation, failing with GenericError
      if a mandatory argument is missing.  Once that passes, the code
      in the specific command gets to do further checking, and the qemu
      developers made sure that if device is the only supplied argument,
      then the block-commit code will look up the device first, with a
      failure of DeviceNotFound, before attempting any further argument
      validation (most other validations fail with GenericError).  Thus,
      the category of error class can reliably be used to decipher
      whether the top argument was optional, which in turn implies a
      working active commit.  Since we expect our bogus device string to
      trigger an error either way, the code is written to return a
      distinct return value without spamming the logs.
      
      * src/qemu/qemu_monitor.h (qemuMonitorSupportsActiveCommit): New
      prototype.
      * src/qemu/qemu_monitor.c (qemuMonitorSupportsActiveCommit):
      Implement it.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockCommit):
      Allow NULL for top and base, for probing purposes.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockCommit):
      Likewise, implementing the probe.
      * tests/qemumonitorjsontest.c (mymain): Enable...
      (testQemuMonitorJSONqemuMonitorSupportsActiveCommit): ...a new test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      47549d5a
  2. 03 7月, 2014 6 次提交
    • M
      tests: Avoid double linking some libraries · fb8bc6be
      Michal Privoznik 提交于
      The problem is, since 614581f3 domaincapstest is linked with
      $(LDADDS) by default. Then, since 94e3f23e the test may be
      conditionally linked with $(qemu_LDADDS) which already contains
      $(LDADDS). And some linkers doesn't cope with this nicely:
      
        CCLD     domaincapstest
      ../src/libvirt_probes.o:(.probes+0x0): multiple definition of `libvirt_event_poll_add_handle_semaphore'
      ../src/libvirt_probes.o:(.probes+0x0): first defined here
      ../src/libvirt_probes.o:(.probes+0x2): multiple definition of `libvirt_event_poll_update_handle_semaphore'
      ../src/libvirt_probes.o:(.probes+0x2): first defined here
      ../src/libvirt_probes.o:(.probes+0x4): multiple definition of `libvirt_event_poll_remove_handle_semaphore'
      ../src/libvirt_probes.o:(.probes+0x4): first defined here
      ../src/libvirt_probes.o:(.probes+0x6): multiple definition of `libvirt_event_poll_dispatch_handle_semaphore'
      ../src/libvirt_probes.o:(.probes+0x6): first defined here
      
      And so on.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      fb8bc6be
    • M
      qemu: Implement virConnectGetDomainCapabilities · 94e3f23e
      Michal Privoznik 提交于
      So far only information on disks and host devices are exposed in the
      capabilities XML. Well, at least something. Even a new test is
      introduced. The qemu capabilities are stolen from already existing
      qemucapabilities test. There's one tricky point though. Functions that
      checks host's KVM and VFIO capabilities, are impossible to mock
      currently. So in the test, we are setting the capabilities by hand.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      94e3f23e
    • M
      tests: Move qemu caps XML parsing into shared unit · 3ecb9e76
      Michal Privoznik 提交于
      Later on, we the qemu capabilities XML parsing code may come handy so
      instead of duplicating the code make the already existing one shared.
      By the same time, make the function accept file name instead of XML
      document stored already in memory.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3ecb9e76
    • M
      Introduce domain_capabilities · 614581f3
      Michal Privoznik 提交于
      This new module holds and formats capabilities for emulator. If you
      are about to create a new domain, you may want to know what is the
      host or hypervisor capable of. To make sure we don't regress on the
      XML, the formatting is not something left for each driver to
      implement, rather there's general format function.
      
      The domain capabilities is a lockable object (even though the locking
      is not necessary yet) which uses reference counter.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      614581f3
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
    • J
      Report errors in virCapabilitiesFormatXML · 28b9be24
      Ján Tomko 提交于
      So far, we only report an error if formatting the siblings bitmap
      in NUMA topology fails.
      
      Be consistent and always report error in virCapabilitiesFormatXML.
      28b9be24
  3. 02 7月, 2014 1 次提交
  4. 01 7月, 2014 2 次提交
    • M
      vboxsnapshotxmltest: Don't write to a file in abs_srcdir · 7315189e
      Michal Privoznik 提交于
      In the test, the snapshot XML is written into a file that's located
      under:
      
        abs_srcdir/vboxsnapshotxmldata/testResult.vbox
      
      However, the abs_srcdir doesn't have to be necessarily writable. It
      should have been abs_builddir instead. Moreover, the label in the func
      creating the file is called 'fail' while it fulfils the duty of
      'cleanup' label.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      7315189e
    • M
      securityselinuxlabeltest: Don't create dummy file in the srcdir · e5f5805f
      Michal Privoznik 提交于
      At the very beginning of the test we check if the underlying
      filesystem supports extended attributes as they are used to store fake
      SELinux labels. In order to check that, a dummy file is created and
      semi-random attribute is set. However, the file is created under:
      
        abs_srcdir "/securityselinuxlabeldata/testxattr"
      
      which has two problems: abs_srcdir is not required to be writable, so
      it should have been abs_builddir. The second one is - there's no
      "securityselinuxlabeldata" folder under abs_builddir. The problem was
      introduced in caf164f1.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e5f5805f
  5. 27 6月, 2014 2 次提交
  6. 26 6月, 2014 3 次提交
  7. 25 6月, 2014 9 次提交
  8. 24 6月, 2014 3 次提交
  9. 23 6月, 2014 3 次提交
    • L
      qemu: parse -device virtio-balloon · ef016226
      Laine Stump 提交于
      There are no options to parse here other than the name of the device,
      and all three possible device names have the same prefix
      ("virtio-balloon" with "-ccw", "-pci", or "-device" appended), so the
      code is fairly simple. It has been implemented such that it will be
      easier to add handling for other -device entries that aren't otherwise
      recognized - just add another "else if (STRPREFIX(opts, ....)" clause.
      
      qemuParseCommandLineString() previously would always add a <memballoon
      model='virtio'/> to every result (the comments erroneously say that it
      is adding a <memballoon model='none'/>) This has been changed to add
      model='none', and 84 test case xml's updated accordingly (so that
      qemuxml2argvtest won't fail).
      
      Now that the memballoon device is properly parsed, we can safely add a
      test for properly ignoring -nodefconfig and -nodefaults. Rather than
      adding an entire new test case for this (and memballoon), we just
      randomly pick the clock-utc test and modify it slightly to fulfill the
      purpose.
      ef016226
    • P
      tests: Fix syntax-check after cdd11151 · 42d75b44
      Peter Krempa 提交于
      makefile_conditionals
      tests/Makefile.am:293:endif
      maint.mk: match "if FOO" with "endif FOO" in Makefiles
      make: *** [sc_makefile_conditionals] Error 1
      42d75b44
    • P
      test: Disable storage test when FS backend isn't compiled in · cdd11151
      Peter Krempa 提交于
      'virstoragetest' accesses backing chains of files on local storage with
      the help of the storage driver. Disable the test on builds without the
      storage driver as the test is crashing otherwise.
      
      Reported by: Roman Bogorodskiy
      cdd11151
  10. 20 6月, 2014 5 次提交
    • M
      virNodeParseSocket: Take ARM into account · f4dc812c
      Michal Privoznik 提交于
      The virNodeParseSocket() function tries to get socked ID from
      'topology/physical_package_id' file. However, on some architectures
      the file contains the -1 constant which makes in turn libvirt think
      the info extraction was unsuccessful. If that's the case, we need to
      overwrite the obtained integer with zero like we are doing for other
      architectures.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f4dc812c
    • M
      nodeinfotest: Print error if cpuinfo file can't be opened · 1ad78434
      Michal Privoznik 提交于
      Currently, we are opening the cpuinfo file via fopen() which if fails
      doesn't print any error message. We should do that instead.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1ad78434
    • M
      nodeinfo: Introduce @arch to linuxNodeInfoCPUPopulate · e8083575
      Michal Privoznik 提交于
      So far, we are doing compile time decisions on which architecture is
      used. However, for testing purposes it's much easier if we pass host
      architecture as parameter and then let the function decide which code
      snippet for extracting host CPU info will be used.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e8083575
    • L
      interface: clean up virInterfaceDefDevFormat · 0b33d7c9
      Laine Stump 提交于
      This modifies the formatting function of virInterface to be a proper
      mirror of the parse function, including the addition of a
      "parentIfType" arg so that we can decide whether or not it is
      appropriate to emit the elements that are only in toplevel interfaces,
      as well as the <link> element (which isn't allowed for bridge
      interfaces).
      
      Since the restructuring of the code necessarily changes the order of
      some of the elements, some test case data had to be updated.
      0b33d7c9
    • L
      interface: report link state for bonds and vlans too · 69db5f92
      Laine Stump 提交于
      The interface state for bonds and vlans does seem to reflect the state
      of the underlying physical devices, at least in some cases, so it
      makes sense to allow reporting it (netcf now does).
      
      The link state/speed for bridge devices is meaningless though, so we
      don't even look for it.
      69db5f92
  11. 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
  12. 18 6月, 2014 1 次提交
  13. 17 6月, 2014 2 次提交
    • P
      uuid: Fix coverity warning of unchecked return value · 810eea71
      Peter Krempa 提交于
      Coverity checks for patterns of handling return values of functions.
      Some recent addition must have tripped a threshold where coverity now
      complains that we usually check the return value of virUUIDGenerate but
      don't do it in one place. Add a check to make coverity happy.
      810eea71
    • E
      blockjob: don't remove older-style mirror XML · b50e1049
      Eric Blake 提交于
      Commit 7c6fc394 introduced a regression in the XML produced for older
      clients.  The argument at the time was that clients shouldn't be
      depending on output-only data for something that is only going to
      be triggered for a transient guest; but John Ferlan reported that
      the automated testsuite was such a client.  It's better to be safe
      than sorry by guaranteeing back-compat cruft.  Note that later
      patches will be using <mirror> for active block commit, but there
      we don't have to worry about back-compat.
      
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Restore old
      style output when necessary.
      * docs/schemas/domaincommon.rng: Validate back-compat style.
      * docs/formatdomain.html.in: Update the documentation.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
      Update tests.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b50e1049