1. 08 1月, 2014 3 次提交
    • T
      Read PCI class from sysfs class file instead of config space. · 9a3d7a47
      Thadeu Lima de Souza Cascardo 提交于
      When determining if a device is behind a PCI bridge, the PCI device
      class is checked by reading the config space. However, there are some
      devices which have the wrong class on the config space, but the class is
      initialized by Linux correctly as a PCI BRIDGE. This class can be read
      by the sysfs file '/sys/bus/pci/devices/xxxx:xx:xx.x/class'.
      
      One example of such bridge is IBM PCI Bridge 1014:03b9, which is
      identified as a Host Bridge when reading the config space.
      Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
      9a3d7a47
    • E
      event: fix typo in previous patch · a18b8aad
      Eric Blake 提交于
      Bah, serves me right for merging patches without one last
      compile test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a18b8aad
    • E
      event: don't let old-style events clobber per-domain events · 4221d64f
      Eric Blake 提交于
      Right now, the older virConnectDomainEventRegister (takes a
      function pointer, returns 0 on success) and the newer
      virConnectDomainEventRegisterID (takes an eventID, returns a
      callbackID) share the underlying implementation (the older
      API ends up consuming a callbackID for eventID 0 under the
      hood).  We implemented that by a lot of copy and pasted
      code between object_event.c and domain_event.c, according to
      whether we are dealing with a function pointer or an eventID.
      However, our copy and paste is not symmetric.  Consider this
      sequence:
      
      id1 = virConnectDomainEventRegisterAny(conn, dom,
         VIR_DOMAIN_EVENT_ID_LIFECYCLE,
         VIR_DOMAIN_EVENT_CALLBACK(callback), NULL, NULL);
      virConnectDomainEventRegister(conn, callback, NULL, NULL);
      virConnectDomainEventDeregister(conn, callback);
      virConnectDomainEventDeregsiterAny(conn, id1);
      
      the first three calls would succeed, but the third call ended
      up nuking the id1 callbackID (the per-domain new-style handler),
      then the fourth call failed with an error about an unknown
      callbackID, leaving us with the global handler (old-style) still
      live and receiving events.  It required another old-style
      deregister to clean up the mess.  Root cause was that
      virDomainEventCallbackList{Remove,MarkDelete} were only
      checking for function pointer match, rather than also checking
      for whether the registration was global.
      
      Rather than playing with the guts of object_event ourselves
      in domain_event, it is nicer to add a mapping function for the
      internal callback id, then share common code for event removal.
      For now, the function-to-id mapping is used only internally;
      I thought about whether a new public API to let a user learn
      the callback would be useful, but decided exposing this to the
      user is probably a disservice, since we already publicly
      document that they should avoid the old style, and since this
      patch already demonstrates that older libvirt versions have
      weird behavior when mixing old and new styles.
      
      And like all good bug fix patches, I enhanced the testsuite,
      validating that the changes in tests/ expose the failure
      without the rest of the patch.
      
      * src/conf/object_event.c (virObjectEventCallbackLookup)
      (virObjectEventStateCallbackID): New functions.
      (virObjectEventCallbackLookup): Use helper function.
      * src/conf/object_event_private.h (virObjectEventStateCallbackID):
      Declare new function.
      * src/conf/domain_event.c (virDomainEventStateRegister)
      (virDomainEventStateDeregister): Let common code handle the
      complexity.
      (virDomainEventCallbackListRemove)
      (virDomainEventCallbackListMarkDelete)
      (virDomainEventCallbackListAdd): Drop unused functions.
      * tests/objecteventtest.c (testDomainCreateXMLMixed): New test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4221d64f
  2. 07 1月, 2014 3 次提交
    • E
      event: share state driver between test:///default connections · fc967c3e
      Eric Blake 提交于
      Prior to this patch, every test:/// URI has its own event manager,
      which means that registering for an event can only ever receive
      events from the connection where it issued the API that triggered
      the event.  But the whole idea of events is to be able to learn
      about something where an API call did NOT trigger the action.
      
      In order to actually test asynchronous events, I wanted to be able
      to tie multiple test connections to the same state.  Use of a file
      in a test URI is still per-connection state, but now parallel
      connections to test:///default (from the same binary, of course)
      now share common state and can affect one another.
      
      The updated testsuite fails without the rest of this patch.
      Valgrind didn't report any leaks.
      
      * src/test/test_driver.c (testConnectOpen): Move per-connection
      state initialization...
      (testOpenFromFile): ...here.
      (defaultConn, defaultConnections, defaultLock, testOnceInit): New
      shared state.
      (testOpenDefault): Only initialize on first connection.
      (testConnectClose): Don't clobber state if still shared.
      * tests/objecteventtest.c (testDomainStartStopEvent): Enhance to
      cover this.
      (timeout, mymain): Ensure test fails rather than blocks.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fc967c3e
    • E
      event: make deregister return value match docs · 31b5bad9
      Eric Blake 提交于
      Ever since their introduction (commit 1509b802 in v0.5.0 for
      virConnectDomainEventRegister, commit 44457238 in v0.8.0 for
      virConnectDomainEventDeregisterAny), the event deregistration
      functions have been documented as returning 0 on success;
      likewise for older registration (only the newer RegisterAny
      must return a non-zero callbackID).  And now that we are
      adding virConnectNetworkEventDeregisterAny for v1.2.1, it
      should have the same semantics.
      
      Fortunately, all of the stateful drivers have been obeying
      the docs and returning 0, thanks to the way the remote_driver
      tracks things (in fact, the RPC wire protocol is unable to
      send a return value for DomainEventRegisterAny, at least not
      without adding a new RPC number).  Well, except for vbox,
      which was always failing deregistration, due to failure to
      set the return value to anything besides its initial -1.
      
      But for local drivers, such as test:///default, we've been
      returning non-zero numbers; worse, the non-zero numbers have
      differed over time.  For example, in Fedora 12 (libvirt 0.8.2),
      calling Register twice would return 0 and 1 [the callbackID
      generated under the hood]; while in Fedora 20 (libvirt 1.1.3),
      it returns 1 and 2 [the number of callbacks registered for
      that event type].  Since we have changed the behavior over
      time, and since it differs by local vs. remote, we can safely
      argue that no one could have been reasonably relying on any
      particular behavior, so we might as well obey the docs, as well
      as prepare callers that might deal with older clients to not be
      surprised if the docs are not strictly followed.
      
      For consistency, this patch fixes the code for all drivers,
      even though it only makes an impact for vbox and for local
      drivers.  By fixing all drivers, future copy and paste from
      a remote driver to a local driver is less likely to
      reintroduce the bug.
      
      Finally, update the testsuite to gain some coverage of the
      issue for local drivers, including the first test of old-style
      domain event registration via function pointer instead of
      event id.
      
      * src/libvirt.c (virConnectDomainEventRegister)
      (virConnectDomainEventDeregister)
      (virConnectDomainEventDeregisterAny): Clarify docs.
      * src/libxl/libxl_driver.c (libxlConnectDomainEventRegister)
      (libxlConnectDomainEventDeregister)
      (libxlConnectDomainEventDeregisterAny): Match documentation.
      * src/lxc/lxc_driver.c (lxcConnectDomainEventRegister)
      (lxcConnectDomainEventDeregister)
      (lxcConnectDomainEventDeregisterAny): Likewise.
      * src/test/test_driver.c (testConnectDomainEventRegister)
      (testConnectDomainEventDeregister)
      (testConnectDomainEventDeregisterAny)
      (testConnectNetworkEventDeregisterAny): Likewise.
      * src/uml/uml_driver.c (umlConnectDomainEventRegister)
      (umlConnectDomainEventDeregister)
      (umlConnectDomainEventDeregisterAny): Likewise.
      * src/vbox/vbox_tmpl.c (vboxConnectDomainEventRegister)
      (vboxConnectDomainEventDeregister)
      (vboxConnectDomainEventDeregisterAny): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectDomainEventRegister)
      (xenUnifiedConnectDomainEventDeregister)
      (xenUnifiedConnectDomainEventDeregisterAny): Likewise.
      * src/network/bridge_driver.c
      (networkConnectNetworkEventDeregisterAny): Likewise.
      * tests/objecteventtest.c (testDomainCreateXMLOld): New test.
      (mymain): Run it.
      (testDomainCreateXML): Check return values.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      31b5bad9
    • P
      AArch64: Porting of armv7l conditons to run qemu for aarch64. · 27e32e0f
      Pranavkumar Sawargaonkar 提交于
      AArch64 qemu has similar behavior as armv7l, like use of mmio etc.
      This patch adds similar bypass checks what we have for armv7l to aarch64.
      E.g. we are enabling mmio transport for Nicdev.
      Making addDefaultUSB and addDefaultMemballoon to false etc.
      
      V3:
      - Adding missing domain rng schema for aarcg64 and test case in
        testutilsqemu.c which was causing test suite failure
        while running make check.
      
      V2:
      - Added testcase to qemuxml2argvtest as suggested
        during review comments of V1.
      
      V1:
      - Initial patch.
      Signed-off-by: NAnup Patel <anup.patel@linaro.org>
      Signed-off-by: NPranavkumar Sawargaonkar <pranavkumar@linaro.org>
      27e32e0f
  3. 06 1月, 2014 1 次提交
    • J
      Fix explicit usage of default video PCI slots · ec128e69
      Ján Tomko 提交于
      Do not leave the PCI address of the primary video card set
      to the legacy default (0000:00:02.0) if we're doing two-pass
      allocation.
      
      Since QEMU 1.6 (QEMU_CAPS_VIDEO_PRIMARY) we allow the primary
      video card to be on other slots than 0000:00:02.0 (as we use
      -device instead of -vga).
      
      However we fail to assign it an address if:
      * another device explicitly uses 0000:00:02.0 and
      * the primary video device has no address specified
      
      On the first pass, we have set the address to default, then checked
      if it's available, leaving it set even if it wasn't. This address
      got picked up by the second pass, resulting in a conflict:
      
      XML error: Attempted double use of PCI slot 0000:00:02.0
      (may need "multifunction='on'" for device on function 0)
      
      Also fix the test that was supposed to catch this.
      ec128e69
  4. 02 1月, 2014 4 次提交
  5. 24 12月, 2013 1 次提交
  6. 19 12月, 2013 1 次提交
    • C
      Fix crash in virsystemdtest with dbus 1.7.6 · 5e397d9c
      Cédric Bosdonnat 提交于
      D-bus introduced some changes in its locking code. Overriding the init
      function skips the new locking init and thus crashes later in libvirt
      test. Removing the function makes the test pass again.
      5e397d9c
  7. 18 12月, 2013 1 次提交
    • E
      qemu: ask for -enable-fips when FIPS is required · a21cfb0f
      Eric Blake 提交于
      On a system that is enforcing FIPS, most libraries honor the
      current mode by default.  Qemu, on the other hand, refused to
      honor FIPS mode unless you add the '-enable-fips' command
      line option; worse, this option is not discoverable via QMP,
      and is only present on binaries built for Linux.  So, if we
      detect FIPS mode, then we unconditionally ask for FIPS; either
      qemu is new enough to have the option and then correctly
      cripple insecure VNC passwords, or it is so old that we are
      correctly avoiding a FIPS violation by preventing qemu from
      starting.  Meanwhile, if we don't detect FIPS mode, then
      omitting the argument is safe whether the qemu has the option
      (but it would do nothing because FIPS is disabled) or whether
      qemu lacks the option (including in the case where we are not
      running on Linux).
      
      The testsuite was a bit interesting: we don't want our test
      to depend on whether it is being run in FIPS mode, so I had
      to tweak things to set the capability bit outside of our
      normal interaction with capability parsing.
      
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1035474
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_ENABLE_FIPS): New bit.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Conditionally
      set capability according to detection of FIPS mode.
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Use it.
      * tests/qemucapabilitiestest.c (testQemuCaps): Conditionally set
      capability to test expected output.
      * tests/qemucapabilitiesdata/caps_1.2.2-1.caps: Update list.
      * tests/qemucapabilitiesdata/caps_1.6.0-1.caps: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a21cfb0f
  8. 13 12月, 2013 2 次提交
  9. 11 12月, 2013 1 次提交
  10. 10 12月, 2013 3 次提交
  11. 06 12月, 2013 1 次提交
  12. 05 12月, 2013 5 次提交
  13. 03 12月, 2013 2 次提交
    • L
      tests: add forgotten boot-strict test files · 9f6f2fa4
      Laine Stump 提交于
      These *should* have been pushed in commit
      96fddee3.
      9f6f2fa4
    • L
      qemu: add "-boot strict" to commandline whenever possible · 96fddee3
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=888635
      
      (which was already closed as CANTFIX because the qemu "-boot strict"
      commandline option wasn't available at the time).
      
      Problem: you couldn't have a domain that used PXE to boot, but also
      had an un-bootable disk device *even if that disk wasn't listed in the
      boot order*, because if PXE timed out (e.g. due to the bridge
      forwarding delay), the BIOS would move on to the next target, which
      would be the unbootable disk device (again - even though it wasn't
      given a boot order), and get stuck at a "BOOT DISK FAILURE, PRESS ANY
      KEY" message until a user intervened.
      
      The solution available since sometime around QEMU 1.5, is to add
      "-boot strict=on" to *every* qemu command. When this is done, if any
      devices have a boot order specified, then QEMU will *only* attempt to
      boot from those devices that have an explicit boot order, ignoring the
      rest.
      96fddee3
  14. 02 12月, 2013 4 次提交
  15. 28 11月, 2013 5 次提交
    • D
      Fix bug in identifying sub-mounts · 84fd470d
      Daniel P. Berrange 提交于
      The code for extracting sub-mounts would just do a STRPREFIX
      check on the mount. This was flawed because if there were
      the following mounts
      
       /etc/aliases
       /etc/aliases.db
      
      and '/etc/aliases' was asked for, it would return both even
      though the latter isn't a sub-mount.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      84fd470d
    • D
      Pull lxcContainerGetSubtree out into shared virfile module · d45b833d
      Daniel P. Berrange 提交于
      Move the code for lxcContainerGetSubtree into the virfile
      module creating 2 new functions
      
        int virFileGetMountSubtree(const char *mtabpath,
                                   const char *prefix,
                                   char ***mountsret,
                                   size_t *nmountsret);
        int virFileGetMountReverseSubtree(const char *mtabpath,
                                          const char *prefix,
                                          char ***mountsret,
                                          size_t *nmountsret);
      
      Add a new virfiletest.c test case to validate the new code.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d45b833d
    • D
      Introduce standard methods for sorting strings with qsort · c60a2713
      Daniel P. Berrange 提交于
      Add virStringSortCompare and virStringSortRevCompare as
      standard functions to use with qsort.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c60a2713
    • E
      tests: fix virpcitest with read-only srcdir · e821de2c
      Eric Blake 提交于
      'make distcheck' has been broken since commit 21685c95; basically,
      it emulates the case of a read-only $(srcdir) (such as building
      from a tarball exploded onto a CD-ROM), but we were creating our
      fake pci device as a symlink into $(srcdir) and failing when that
      requires opening the config file for writing:
      
       3) testVirPCIDeviceReset                                             ... libvirt:  error : Failed to open config space file '/sys/bus/pci/devices/0000:00:01.0/config': Permission denied
      
      Fix it by copying rather than symlinking.
      
      * tests/virpcimock.c (make_file): Add parameter to allow binary
      creation; adjust all callers.
      (pci_device_new_from_stub): Copy rather than symlink.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e821de2c
    • E
      tests: guarantee abs_srcdir in all C tests · 0aa873d7
      Eric Blake 提交于
      While trying to debug a failure of virpcitest during 'make distcheck',
      I noticed that with a VPATH build, 'cd tests; ./virpcitest' fails for
      an entirely different reason.  To reproduce the distcheck failure, I
      had to run 'cd tests; abs_srcdir=/path/to/src ./virpcitest'.  But we
      document in HACKING that all of our tests are supposed to be runnable
      without requiring extra environment variables.
      
      The solution: hardcode the location of srcdir into the just-built
      binaries, rather than requiring make to prepopulate environment
      variables.  With this, './virpcitest' passes even in a VPATH build
      (provided that $(srcdir) is writable; a followup patch will fix the
      conditions required by 'make distcheck').  [Note: the makefile must
      still pass on directory variables to the test environment of shell
      scripts, since those aren't compiled.  So while this solves the case
      of a compiled test, it still requires environment variables to pass
      a VPATH build of any shell script test case that relies on srcdir.]
      
      * tests/Makefile.am (AM_CFLAGS): Define abs_srcdir in all compiled
      tests.
      * tests/testutils.h (abs_srcdir): Quit declaring.
      * tests/testutils.c (virtTestMain): Rely on define rather than
      environment variable.
      * tests/virpcimock.c (pci_device_new_from_stub): Rely on define.
      * tests/cputest.c (mymain): Adjust abs_top_srcdir default.
      * tests/qemuxml2argvtest.c (mymain): Likewise.
      * tests/qemuxmlnstest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0aa873d7
  16. 26 11月, 2013 3 次提交
    • E
      storage: improve directory support in gluster pool · 1458b2e9
      Eric Blake 提交于
      Take advantage of the previous patch's addition of 'netdir' as
      a distinct volume type, to expose rather than silently skip
      directories embedded in a gluster pool.  Also serves as an XML
      validation for the previous patch.
      
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Don't skip directories.
      * tests/storagevolxml2xmltest.c (mymain): Add test.
      * tests/storagevolxml2xmlin/vol-gluster-dir.xml: New file.
      * tests/storagevolxml2xmlout/vol-gluster-dir.xml: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1458b2e9
    • E
      storage: document gluster pool · ed5fa7f3
      Eric Blake 提交于
      Add support for a new <pool type='gluster'>, similar to
      RBD and Sheepdog.  Terminology wise, a gluster volume
      forms a libvirt storage pool, within the gluster volume,
      individual files are treated as libvirt storage volumes.
      
      * docs/schemas/storagepool.rng (poolgluster): New pool type.
      * docs/formatstorage.html.in: Document gluster.
      * docs/storage.html.in: Likewise, and contrast it with netfs.
      * tests/storagepoolxml2xmlin/pool-gluster.xml: New test.
      * tests/storagepoolxml2xmlout/pool-gluster.xml: Likewise.
      * tests/storagepoolxml2xmltest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ed5fa7f3
    • E
      storage: expose volume meta-type in XML · 1b5c8d4c
      Eric Blake 提交于
      I got annoyed at having to use both 'virsh vol-list $pool --details'
      AND 'virsh vol-dumpxml $vol $pool' to learn if I had populated
      the volume correctly.  Since two-thirds of the data present in
      virStorageVolGetInfo() already appears in virStorageVolGetXMLDesc(),
      this just adds the remaining piece of information, as:
      
      <volume type='...'>
        ...
      </volume>
      
      * docs/formatstorage.html.in: Document new <volume type=...>.
      * docs/schemas/storagevol.rng (vol): Add it to RelaxNG.
      * src/conf/storage_conf.h (virStorageVolTypeToString): Declare.
      * src/conf/storage_conf.c (virStorageVolTargetDefFormat): Output
      the metatype.
      (virStorageVolDefParseXML): Parse it, for unit tests.
      * tests/storagevolxml2xmlout/vol-*.xml: Update tests to match.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1b5c8d4c