1. 26 8月, 2013 1 次提交
  2. 24 8月, 2013 1 次提交
  3. 23 8月, 2013 1 次提交
  4. 22 8月, 2013 3 次提交
  5. 21 8月, 2013 4 次提交
    • C
      tests: fix building without xattr support · d7c4e003
      Claudio Bley 提交于
      Only compile securityselinuxhelper.c if xattr support was detected to
      avoid this error:
      
      securityselinuxhelper.c:34:24: fatal error: attr/xattr.h: No such file
      or directory compilation terminated.
      
      Since all SELinux tests depend upon the securityselinuxhelper library,
      these test programs are now only build when xattr support is
      available.
      d7c4e003
    • D
      Test handling of non-existent x509 certs · 4b8d387e
      Daniel P. Berrange 提交于
      In commit f905cc99 a use of
      uninitialized data was fixed based on a coverity report. It
      turns out it was possible to trigger this issue by pointing
      libvirt at non-existent certificate files, typically causing
      a crash.
      
      This adds a test case for that scenario. With the above
      commit reverted, this new test case will crash with a SEGV.
      With the fix applied, it passes, reporting a normal libvirt
      error to the caller.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4b8d387e
    • E
      selinux: enhance test to cover nfs label failure · 95577af4
      Eric Blake 提交于
      Daniel Berrange (correctly) pointed out that we should do a better
      job of testing selinux labeling fallbacks on NFS disks that lack
      labeling support.
      
      * tests/securityselinuxhelper.c (includes): Makefile already
      guaranteed xattr support.  Add additional headers.
      (init_syms): New function, borrowing from vircgroupmock.c.
      (setfilecon_raw, getfilecon_raw): Fake NFS failure.
      (statfs): Fake an NFS mount point.
      (security_getenforce, security_get_boolean_active): Don't let host
      environment affect test.
      * tests/securityselinuxlabeldata/nfs.data: New file.
      * tests/securityselinuxlabeldata/nfs.xml: New file.
      * tests/securityselinuxlabeltest.c (testSELinuxCreateDisks)
      (testSELinuxDeleteDisks): Setup and cleanup for fake NFS mount.
      (testSELinuxCheckLabels): Test handling of SELinux NFS denial.
      Fix memory leak.
      (testSELinuxLabeling): Avoid infinite loop on dirty tree.
      (mymain): Add new test.
      95577af4
    • E
      selinux: distinguish failure to label from request to avoid label · 0f082e69
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=924153
      
      Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
      an attribute relabel='no' in order to try and minimize the
      impact of shutdown delays when an NFS server disappears.  The idea
      was that if a disk is on NFS and can't be labeled in the first
      place, there is no need to attempt the (no-op) relabel on domain
      shutdown.  Unfortunately, the way this was implemented was by
      modifying the domain XML so that the optimization would survive
      libvirtd restart, but in a way that is indistinguishable from an
      explicit user setting.  Furthermore, once the setting is turned
      on, libvirt avoids attempts at labeling, even for operations like
      snapshot or blockcopy where the chain is being extended or pivoted
      onto non-NFS, where SELinux labeling is once again possible.  As
      a result, it was impossible to do a blockcopy to pivot from an
      NFS image file onto a local file.
      
      The solution is to separate the semantics of a chain that must
      not be labeled (which the user can set even on persistent domains)
      vs. the optimization of not attempting a relabel on cleanup (a
      live-only annotation), and using only the user's explicit notation
      rather than the optimization as the decision on whether to skip
      a label attempt in the first place.  When upgrading an older
      libvirtd to a newer, an NFS volume will still attempt the relabel;
      but as the avoidance of a relabel was only an optimization, this
      shouldn't cause any problems.
      
      In the ideal future, libvirt will eventually have XML describing
      EVERY file in the backing chain, with each file having a separate
      <seclabel> element.  At that point, libvirt will be able to track
      more closely which files need a relabel attempt at shutdown.  But
      until we reach that point, the single <seclabel> for the entire
      <disk> chain is treated as a hint - when a chain has only one
      file, then we know it is accurate; but if the chain has more than
      one file, we have to attempt relabel in spite of the attribute,
      in case part of the chain is local and SELinux mattered for that
      portion of the chain.
      
      * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
      member.
      * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
      Parse it, for live images only.
      (virSecurityDeviceLabelDefFormat): Output it.
      (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
      (virDomainDiskSourceDefFormat, virDomainChrDefFormat)
      (virDomainDiskDefFormat): Pass flags on through.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
      when possible.
      (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
      norelabel, if labeling fails.
      (virSecuritySELinuxSetFileconHelper): Fix indentation.
      * docs/formatdomain.html.in (seclabel): Document new xml.
      * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
      New test files.
      * tests/qemuxml2argvtest.c (mymain): Run the new tests.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0f082e69
  6. 19 8月, 2013 1 次提交
  7. 17 8月, 2013 1 次提交
  8. 16 8月, 2013 2 次提交
  9. 14 8月, 2013 1 次提交
    • L
      network: permit upstream forwarding of unqualified DNS names · 4f595ba6
      Laine Stump 提交于
      This resolves the issue that prompted the filing of
      
        https://bugzilla.redhat.com/show_bug.cgi?id=928638
      
      (although the request there is for something much larger and more
      general than this patch).
      
      commit f3868259 disabled the
      forwarding to upstream DNS servers of unresolved DNS requests for
      names that had no domain, but were just simple host names (no "."
      character anywhere in the name). While this behavior is frowned upon
      by DNS root servers (that's why it was changed in libvirt), it is
      convenient in some cases, and since dnsmasq can be configured to allow
      it, it must not be strictly forbidden.
      
      This patch restores the old behavior, but since it is usually
      undesirable, restoring it requires specification of a new option in
      the network config. Adding the attribute "forwardPlainNames='yes'" to
      the <dns> elemnt does the trick - when that attribute is added to a
      network config, any simple hostnames that can't be resolved by the
      network's dnsmasq instance will be forwarded to the DNS servers listed
      in the host's /etc/resolv.conf for an attempt at resolution (just as
      any FQDN would be forwarded).
      
      When that attribute *isn't* specified, unresolved simple names will
      *not* be forwarded to the upstream DNS server - this is the default
      behavior.
      4f595ba6
  10. 13 8月, 2013 7 次提交
    • G
      Directly link against needed libraries · f7904571
      Guido Günther 提交于
      The Linux build revealed another missing direct link target, this time
      against selinux libs:
      
          http://honk.sigxcpu.org:8001/view/libvirt/job/libvirt-build-debian-sid-amd64/9/console
      f7904571
    • M
      tests: Fix parallel runs of TLS test suites · 3be7a304
      Martin Kletzander 提交于
      I noticed this yesterday and fixed it in a different way, but ended up
      with one more problem.  It was probably the way I fixed it combined
      with one more filename changed.
      
      Anyway, why I'm saying this is that one more filename should be renamed
      in order to avoid a race (which I was unable to reproduce, though).
      
      I checked this is the last file those two tests have in common by going
      through the code and the re-checked by this "script":
      
      strace -o session.trace -e open ./virnettlssessiontest
      strace -o context.trace -e open ./virnettlscontexttest
      sort \
       <(sed -n '/^open/s/open("\([^"]*\)",.*$/\1/p' context.trace | sort -u)\
       <(sed -n '/^open/s/open("\([^"]*\)",.*$/\1/p' session.trace | sort -u)\
       | uniq -d| grep '.pem$'
      
      So it should be enough to make these tests independent of each other.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3be7a304
    • G
      Directly link against needed libraries · 6ba0b7d2
      Guido Günther 提交于
      otherwise having a strict --no-copy-dt-needed-entries fails in several
      places like:
      
          CCLD     virdbustest
          /usr/bin/ld: virdbustest-virdbustest.o: undefined reference to symbol 'dbus_message_unref'
          /lib/x86_64-linux-gnu/libdbus-1.so.3: error adding symbols: DSO missing from command line
          collect2: error: ld returned 1 exit status
      6ba0b7d2
    • P
      tests: Skip virsh-all test as expensive · ba510abf
      Peter Krempa 提交于
      Don't run the blind test of all virsh commands always. It usualy just
      wastes time.
      ba510abf
    • P
      qemuagenttest: Test timeout of agent commands · 3ff6ae5b
      Peter Krempa 提交于
      If VIR_TEST_EXPENSIVE is enabled, test timeout of agent commands. This
      test takes 6 seconds to finish.
      3ff6ae5b
    • E
      tests: add helper to determine when to skip expensive tests · 38d4bf49
      Eric Blake 提交于
      The logic set up in previous patch for exposing VIR_TEST_EXPENSIVE
      to individual tests is as follows:
      
      make check VIR_TEST_EXPENSIVE=0   => getenv("VIR_TEST_EXPENSIVE") sees "0"
      make check VIR_TEST_EXPENSIVE=1   => getenv("VIR_TEST_EXPENSIVE") sees "1"
      make check                        => getenv("VIR_TEST_EXPENSIVE") sees
      either "0" or "1", based on configure options
      cd tests; ./FOOtest               => getenv("VIR_TEST_EXPENSIVE") sees
      whatever is in your environment (usually NULL, but possibly garbage)
      
      Merely checking if VIR_TEST_EXPENSIVE is set in the environment
      does the wrong thing; likewise, it is unsafe to assume the
      variable will always contain a valid number.
      
      As such, it helps to have helper functions, instead of making each
      expensive test repeat the probe of the environment.
      
      * tests/testutils.h (virTestGetExpensive): New prototype.
      * tests/testutils.c (virTestGetExpensive): Implement it.
      * tests/test-lib.sh (very_expensive_): Rename...
      (test_expensive): ...and tweak to use VIR_TEST_EXPENSIVE.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      38d4bf49
    • E
      build: add configure option to disable gnulib tests · 70363ea9
      Eric Blake 提交于
      The gnulib testsuite is relatively stable - the only times it is
      likely to have a test change from pass to fail is on a gnulib
      submodule update or a major system change (such as moving from
      Fedora 18 to 19, or other large change to libc).  While it is an
      important test for end users on arbitrary machines (to make sure
      that the portability glue works for their machine), it mostly
      wastes time for development testing (as most developers aren't
      making any of the major changes that would cause gnulib tests
      to alter behavior).  Thus, it pays to make the tests optional
      at configure time, defaulting to off for development, on for
      tarballs, with autobuilders requesting it to be on.  It also
      helps to allow a make-time override, via VIR_TEST_EXPENSIVE=[01]
      (much the way automake sets up V=[01] for overriding the configure
      time default of how verbose to be).
      
      Automake has some pretty hard-coded magic with regards to the
      TESTS variable; I had quite a job figuring out how to keep
      'make distcheck' passing regardless of the configure option
      setting in use, while still disabling the tests at runtime
      when I did not configure them on and did not use the override
      variable.  Thankfully, we require GNU make, which lets me
      hide some information from Automake's magic handling of TESTS.
      
      * bootstrap.conf (bootstrap_epilogue): Munge gnulib test variable.
      * configure.ac (--enable-expensive-tests): Add new enable switch.
      (VIR_TEST_EXPENSIVE_DEFAULT, WITH_EXPENSIVE_TESTS): Set new
      witnesses.
      * gnulib/tests/Makefile.am (TESTS): Make tests conditional on
      configure settings and the VIR_TEST_EXPENSIVE variable.
      * tests/Makefile.am (TESTS_ENVIRONMENT): Expose VIR_TEST_EXPENSIVE
      to all tests.
      * autobuild.sh: Enable all tests during autobuilds.
      * libvirt.spec.in (%configure): Likewise.
      * mingw-libvirt.spec.in (%mingw_configure): Likewise.
      * docs/hacking.html.in: Document the option.
      * HACKING: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      70363ea9
  11. 12 8月, 2013 1 次提交
  12. 09 8月, 2013 4 次提交
    • E
      tests: test negative number through dbus · 15168f98
      Eric Blake 提交于
      Commit f1088c81 weakened a test, by not passing a value larger
      than INT_MAX through an int slot.  Make the fix in a different
      way, using an explicit negative value.  Suggested by Dan Berrange.
      
      * tests/virdbustest.c (testMessageArray): Adjust previous fix.
      (testMessageStruct): Use a negative number.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      15168f98
    • E
      tests: avoid too-large constants · f1088c81
      Eric Blake 提交于
      Compiling with gcc 4.1.2 (RHEL 5) on a 32-bit platform complains:
      
      virdbustest.c: In function 'testMessageSimple':
      virdbustest.c:61: warning: integer constant is too large for 'long' type
      virdbustest.c:62: warning: integer constant is too large for 'long' type
      virdbustest.c: In function 'testMessageArray':
      virdbustest.c:183: warning: this decimal constant is unsigned only in ISO C90
      virdbustest.c: In function 'testMessageStruct':
      virdbustest.c:239: warning: integer constant is too large for 'long' type
      virdbustest.c:240: warning: integer constant is too large for 'long' type
      
      * tests/virdbustest.c (testMessageSiple, testMessageArray)
      (testMessageStruct): Don't violate C89 constant constraints.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f1088c81
    • D
      Fix parallel runs of TLS test suites · eaa99a17
      Daniel P. Berrange 提交于
      Use a separate keyfile name for the two TLS test suites so that
      they don't clash when running tests in parallel
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      eaa99a17
    • E
      tests: work with older dbus · edfae3dc
      Eric Blake 提交于
      On RHEL 5, with dbus 1.1.2, compilation failed with:
      
      virsystemdmock.c: In function 'dbus_connection_send_with_reply_and_block':
      virsystemdmock.c:68: warning: implicit declaration of function 'dbus_message_set_serial'
      
      Fix this by instead bypassing all attempts to use a dbus serial.
      
      * tests/virsystemdmock.c (dbus_message_set_reply_serial): Add new
      override.
      (dbus_connection_send_with_reply_and_block): No longer bother with
      the serial.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      edfae3dc
  13. 08 8月, 2013 4 次提交
  14. 07 8月, 2013 1 次提交
    • L
      qemu: enable using implicit sata controller in q35 machines · 83718cfe
      Laine Stump 提交于
      q35 machines have an implicit ahci (sata) controller at 00:1F.2 which
      has no "id" associated with it. For this reason, we can't refer to it
      as "ahci0". Instead, we don't give an id on the commandline, which
      qemu interprets as "use the first ahci controller". We then need to
      specify the unit with "unit=%d" rather than adding it onto the bus
      arg.
      83718cfe
  15. 06 8月, 2013 4 次提交
    • L
      qemu: properly set/use device alias for pci controllers · 01b88127
      Laine Stump 提交于
      We had been setting the device alias in the devinceinfo for pci
      controllers to "pci%u", but then hardcoding "pci.%u" when creating the
      device address for other devices using that pci bus. This all worked
      just fine until we encountered the built-in "pcie.0" bus (the PCIe
      root complex) in Q35 machines.
      
      In order to create the correct commandline for this one case, this
      patch:
      
      1) sets the alias for PCI controllers correctly, to "pci.%u" (or
      "pcie.%u" for the pcie-root controller)
      
      2) eliminates the hardcoded "pci.%u" for pci controllers when
      generatuing device address strings, and instead uses the controller's
      alias.
      
      3) plumbs a pointer to the virDomainDef all the way down to
      qemuBuildDeviceAddressStr. This was necessary in order to make the
      aliase of the controller *used by a device* available (previously
      qemuBuildDeviceAddressStr only had the deviceinfo of the device
      itself, *not* of the controller it was connecting to). This made for a
      larger than desired diff, but at least in the future we won't have to
      do it again, since all the information we could possibly ever need for
      future enhancements is in the virDomainDef. (right?)
      
      This should be done for *all* controllers, but for now we just do it
      in the case of PCI controllers, to reduce the likelyhood of
      regression.
      01b88127
    • L
      qemu: fix handling of default/implicit devices for q35 · c27b0bb1
      Laine Stump 提交于
      This patch adds in special handling for a few devices that need to be
      treated differently for q35 domains:
      
      usb - there is no implicit/default usb controller for the q35
      machinetype. This is done because normally the default usb controller
      is added to a domain by just adding "-usb" to the qemu commandline,
      and it's assumed that this will add a single piix3 usb1 controller at
      slot 1 function 2. That's not what happens when the machinetype is
      q35, though. Instead, adding -usb to the commandline adds 3 usb
      (version 2) controllers to the domain at slot 0x1D.{1,2,7}. Rather
      than having
      
        <controller type='usb' index='0'/>
      
      translate into 3 separate devices on the PCI bus, it's cleaner to not
      automatically add a default usb device; one can always be added
      explicitly if desired. Or we may decide that on q35 machines, 3 usb
      controllers will be automatically added when none is given. But for
      this initial commit, at least we aren't locking ourselves into
      something we later won't want.
      
      video - qemu always initializes the primary video device immediately
      after any integrated devices for the machinetype. Unless instructed
      otherwise (by using "-device vga..." instead of "-vga" which libvirt
      uses in many cases to work around deficiencies and bugs in various
      qemu versions) qemu will always pick the first unused slot. In the
      case of the "pc" machinetype and its derivatives, this is always slot
      2, but on q35 machinetypes, the first free slot is slot 1 (since the
      q35's integrated peripheral devices are placed in other slots,
      e.g. slot 0x1f). In order to make the PCI address of the video device
      predictable, that slot (1 or 2, depending on machinetype) is reserved
      even when no video device has been specified.
      
      sata - a q35 machine always has a sata controller implicitly added at
      slot 0x1F, function 2. There is no way to avoid this controller, so we
      always add it. Note that the xml2xml tests for the pcie-root and q35
      cases were changed to use DO_TEST_DIFFERENT() so that we can check for
      the sata controller being automatically added. This is especially
      important because we can't check for it in the xml2argv output (it has
      no effect on that output since it's an implicit device).
      
      ide - q35 has no ide controllers.
      
      isa and smbus controllers - these two are always present in a q35 (at
      slot 0x1F functions 0 and 3) but we have no way of modelling them in
      our config. We do need to reserve those functions so that the user
      doesn't attempt to put anything else there though. (note that the "pc"
      machine type also has an ISA controller, which we also ignore).
      c27b0bb1
    • L
      qemu: add dmi-to-pci-bridge controller · 62ac6b43
      Laine Stump 提交于
      This PCI controller, named "dmi-to-pci-bridge" in the libvirt config,
      and implemented with qemu's "i82801b11-bridge" device, connects to a
      PCI Express slot (e.g. one of the slots provided by the pcie-root
      controller, aka "pcie.0" on the qemu commandline), and provides 31
      *non-hot-pluggable* PCI (*not* PCIe) slots, numbered 1-31.
      
      Any time a machine is defined which has a pcie-root controller
      (i.e. any q35-based machinetype), libvirt will automatically add a
      dmi-to-pci-bridge controller if one doesn't exist, and also add a
      pci-bridge controller. The reasoning here is that any useful domain
      will have either an immediate (startup time) or eventual (subsequent
      hot-plug) need for a standard PCI slot; since the pcie-root controller
      only provides PCIe slots, we need to connect a dmi-to-pci-bridge
      controller to it in order to get a non-hot-plug PCI slot that we can
      then use to connect a pci-bridge - the slots provided by the
      pci-bridge will be both standard PCI and hot-pluggable.
      
      Since pci-bridge devices themselves can not be hot-plugged into a
      running system (although you can hot-plug other devices into a
      pci-bridge's slots), any new pci-bridge controller that is added can
      (and will) be plugged into the dmi-to-pci-bridge as long as it has
      empty slots available.
      
      This patch is also changing the qemuxml2xml-pcie test from a "DO_TEST"
      to a "DO_DIFFERENT_TEST". This is so that the "before" xml can omit
      the automatically added dmi-to-pci-bridge and pci-bridge devices, and
      the "after" xml can include it - this way we are testing if libvirt is
      properly adding these devices.
      62ac6b43
    • L
      qemu: add pcie-root controller · 48a3f48a
      Laine Stump 提交于
      This controller is implicit on q35 machinetypes. It provides 31 PCIe
      (*not* PCI) slots as controller 0.
      
      Currently there are no devices that can connect to pcie-root, and no
      implicit pci controller on a q35 machine, so q35 is still
      unusable. For a usable q35 system, we need to add a
      "dmi-to-pci-bridge" pci controller, which can connect to pcie-root,
      and provides standard pci slots that can be used to connect other
      devices.
      48a3f48a
  16. 02 8月, 2013 4 次提交