1. 06 8月, 2013 2 次提交
    • 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
  2. 02 8月, 2013 6 次提交
    • P
      qemumonitortestutils: Don't skip va_end() on error path · 8f95d5d8
      Peter Krempa 提交于
      When allocation of memory failed the error path didn't call va_end()
      causing a coverity failure.
      
      Reported by John Ferlan.
      8f95d5d8
    • P
      qemuagenttest: Check invalid response in shutdown test · ae9ef97b
      Peter Krempa 提交于
      The shutdown test utilizes waiting for condition to exit the test. This
      addition will return an error for the shutdown command to see if the
      condition waiting code will not hang.
      ae9ef97b
    • P
      qemuagenttest: Fix checking of shutdown mode · baebb341
      Peter Krempa 提交于
      Coverity complained about unused variable that contains the shutdown
      mode. The original intention was to check it against the requested mode.
      
      Also the fixed check revealed a mistake in the expected shutdown mode.
      
      Reported by John Ferlan.
      baebb341
    • J
      valgrind: Adjust filter for _dl_allocate_tls · 6e69166e
      John Ferlan 提交于
      More tests are now using the path - adjust the filter to include any
      path from a test through pthread_create to _dl_allocate_tls
      6e69166e
    • J
      tests: Coverity found new NULL_RETURNS · 3b4b1214
      John Ferlan 提交于
      Coverity reported the existing missing check of the return value and
      subsequent use from a call to virJSONValueFromString() in testJSONAddRemove().
      3b4b1214
    • J
      build: fix qemuagenttest build with -O0 in fedora 19. · a320730a
      Jincheng Miao 提交于
      When building libvirt with -O0 flag in fedora 19, it will fail to
      generate qemuagenttest, a link error occurs like:
      
      ./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function `qemuMonitorTestFree':
      libvirt/tests/qemumonitortestutils.c:346: undefined reference to `qemuMonitorClose'
      ./.libs/libqemumonitortestutils.a(qemumonitortestutils.o): In function `qemuMonitorTestNew':
      libvirt/tests/qemumonitortestutils.c:870: undefined reference to `qemuMonitorOpen'
      collect2: error: ld returned 1 exit status
      
      Fix it by listing libraries in the correct order to avoid lazy linkage.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a320730a
  3. 01 8月, 2013 2 次提交
    • D
      Add support for systemd cgroup mount · aedd46e7
      Daniel P. Berrange 提交于
      Systemd uses a named cgroup mount for tracking processes. Add
      it as another type of controller, albeit one which we have to
      special case in a number of places. In particular we must
      never create/delete directories there, nor add tasks. Essentially
      the systemd mount is to be considered read-only for libvirt.
      
      With this change both the virCgroupDetectPlacement and
      virCgroupCopyPlacement methods must be invoked. The copy
      placement method will copy setup for resource controllers
      only. The detect placement method will probe for any
      named controllers, or resource controllers not already
      setup.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      aedd46e7
    • D
      Add APIs for formatting systemd slice/scope names · 4574b475
      Daniel P. Berrange 提交于
      There are some interesting escaping rules to consider when dealing
      with systemd slice/scope names. Thus it is helpful to have APIs
      for formatting names
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4574b475
  4. 31 7月, 2013 15 次提交
  5. 30 7月, 2013 5 次提交
    • J
      tests: Put a mock library at the start of LD_PRELOAD · df166a61
      Jiri Denemark 提交于
      This fixes vircgrouptest when run in a sandbox which already overrides
      open() and others.
      df166a61
    • E
      build: fix shunloadtest breakage · 87c0eab4
      Eric Blake 提交于
      Commit 93ec384b was tested on mingw, but broke the build on Linux:
      
        CCLD     shunloadtest
      shunloadtest.o: In function `main':
      /home/eblake/libvirt/tests/shunloadtest.c:106: undefined reference to `virFilePrintf'
      ...
      ssh.o: In function `main':
      /home/eblake/libvirt/tests/ssh.c:43: undefined reference to `virFilePrintf'
      /home/eblake/libvirt/tests/ssh.c:49: undefined reference to `virFilePrintf'
      
      * tests/testutils.h (fprintf): Provide escape hatch.
      * tests/shunloadtest.c: Use it.
      * tests/ssh.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      87c0eab4
    • E
      tests: consistently use virFilePrintf · 93ec384b
      Eric Blake 提交于
      Commit a2619962 introduced virFilePrintf to work around the fact
      that gnulib doesn't (yet) provide guarantees about fprintf() vs.
      %z, which in turn causes all sorts of mingw compilation errors:
      
      ../../tests/testutils.c: In function 'virtTestResult':
      ../../tests/testutils.c:101:9: error: unknown conversion type character 'z' in format [-Werror=format=]
               fprintf(stderr, "%3zu) %-60s ", testCounter, name);
               ^
      
      Rather than s/fprintf/virFilePrintf/ (and reformatting loads of
      lines) across multiple files, it's easier to just hack the entire
      testsuite to take advantage of our helper function.
      
      * tests/testutils.c: s/fprintf/virFilePrintf/ for mingw.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      93ec384b
    • E
      build: skip systemd mock on non-Linux · 524f52c3
      Eric Blake 提交于
      A cross-compile to mingw failed:
      
        CC       virsystemdmock_la-virsystemdmock.lo
      ../../tests/virsystemdmock.c:29:6: error: 'dbus_connection_set_change_sigpipe' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
       void dbus_connection_set_change_sigpipe(dbus_bool_t will_modify_sigpipe ATTRIBUTE_UNUSED)
            ^
      
      But when you think about it, systemd is Linux-only, and even our
      use of LD_PRELOAD to provide mock syscalls is Linux-only.
      
      * tests/virsystemdmock.c: Avoid compilation outside Linux.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      524f52c3
    • D
      Fix dbus message reading code on big endian hosts · 9ed3e6c1
      Daniel P. Berrange 提交于
      The way we were casting small (<32bit) integers was broken
      on big endian hosts, causing stack smashing. This was detected
      in the test suite either by test failures due to incorrect
      results, or by libc/gcc abort'ing with its stack canary
      triggered.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      9ed3e6c1
  6. 29 7月, 2013 1 次提交
  7. 26 7月, 2013 1 次提交
    • J
      Resolve Coverity complaint in storagevolxml2argvtest · 99d3a60b
      Ján Tomko 提交于
      Ignore NULL pool in testSetVolumeType to silence Coverity,
      even though we only call it with NULL pool when vol is also NULL.
      
      (13) Event var_deref_model:	Passing null pointer "inputpool" to
      function "testSetVolumeType(virStorageVolDefPtr, virStoragePoolDefPtr)",
      which dereferences it. [details]
      Also see events: [assign_zero]
      
      95    testSetVolumeType(inputvol, inputpool);
      99d3a60b
  8. 25 7月, 2013 6 次提交
    • G
      virdbustest: Don't pass number of arguments as long long · 6b79a472
      Guido Günther 提交于
      since sizeof(int) != sizeof(long long) on 32bit archs.
      
      This unbreaks virdbustest which otherwise fails like:
      
       (gdb) bt
       #0  __strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:50
       #1  0x405907d2 in ?? () from /lib/i386-linux-gnu/libdbus-1.so.3
       #2  0x4057c140 in ?? () from /lib/i386-linux-gnu/libdbus-1.so.3
       #3  0x4057e7ec in dbus_message_iter_append_basic () from /lib/i386-linux-gnu/libdbus-1.so.3
       #4  0x400742ec in virDBusMessageIterEncode (args=0xbfd4b8f0 "k\321\004\b.", types=0x804d260 "",
           rootiter=0xbfd4b844) at util/virdbus.c:560
       #5  virDBusMessageEncodeArgs (msg=msg@entry=0x893c278, types=types@entry=0x804d25c "sais",
           args=args@entry=0xbfd4b8d8 "r\320\004\b\003") at util/virdbus.c:921
       #6  0x40075917 in virDBusMessageEncode (msg=0x893c278, types=0x804d25c "sais") at util/virdbus.c:959
       #7  0x0804a4a1 in testMessageArray (args=0x0) at virdbustest.c:195
       #8  0x0804c404 in virtTestRun (title=title@entry=0x804cfcb "Test message array ",
           nloops=nloops@entry=1, body=body@entry=0x804a3f0 <testMessageArray>, data=data@entry=0x0)
           at testutils.c:168
       #9  0x08049346 in mymain () at virdbustest.c:384
       #10 0x0804cb2e in virtTestMain (argc=argc@entry=1, argv=argv@entry=0xbfd4bb24,
           func=func@entry=0x80492c0 <mymain>) at testutils.c:764
       #11 0x080491af in main (argc=1, argv=0xbfd4bb24) at virdbustest.c:393
      6b79a472
    • J
      Add inputpool to storagevolxml2argvtest · 601d4652
      Ján Tomko 提交于
      This allows testing the command line for cloning file-based
      volumes into logical volumes and vice versa.
      601d4652
    • J
      Move volume XMLs out of storagevolxml2argvdata · 3a75fca2
      Ján Tomko 提交于
      Reuse the XML files in storagevolxml2xmlin.
      
      (This requires changing a few backing files to /dev/null,
      since virStorageBackendCreateQemuImgCmd checks for its
      presence)
      3a75fca2
    • J
      Move pool XML out of storagevolxml2argvdata · 82377882
      Ján Tomko 提交于
      Reuse the pool definition from storagepoolxml2xmlin.
      82377882
    • J
      Use separate macros for failure/success in vol-to-argv test · 7064eee9
      Ján Tomko 提交于
      Reindent them to put the input volume on a separate line.
      7064eee9
    • J
      tests: PCI controller checks · e4f0a55e
      Ján Tomko 提交于
      Check if PCI bridges with duplicate indexes are rejected.
      PCI root controllers with non-zero indexes or addresses should
      also be rejected.
      e4f0a55e
  9. 24 7月, 2013 2 次提交
    • L
      qemu: set/validate slot/connection type when assigning slots for PCI devices · 3ceb4c7d
      Laine Stump 提交于
      Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports
      all share the same namespace, they are all defined as controllers of
      type='pci' in libvirt (but with a differing model attribute). Each of
      these controllers has a certain connection type upstream, allows
      certain connection types downstream, and each can either allow a
      single downstream connection at slot 0, or connections from slot 1 -
      31.
      
      Right now, we only support the pci-root and pci-bridge devices, both
      of which only allow PCI devices to connect, and both which have usable
      slots 1 - 31. In preparation for adding other types of controllers
      that have different capabilities, this patch 1) adds info to the
      qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets
      those capabilities appropriately for pci-root and pci-bridge devices,
      and 3) validates that the controller being connected to is the proper
      type when allocating slots or validating that a user-selected slot is
      appropriate for a device..
      
      Having this infrastructure in place will make it much easier to add
      support for the other PCI controller types.
      
      While it would be possible to do all the necessary checking by just
      storing the controller model in the qemyuDomainPCIAddressBus, it
      greatly simplifies all the validation code to also keep a "flags",
      "minSlot" and "maxSlot" for each - that way we can just check those
      attributes rather than requiring a nearly identical switch statement
      everywhere we need to validate compatibility.
      
      You may notice many places where the flags are seemingly hard-coded to
      
        QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI
      
      This is currently the correct value for all PCI devices, and in the
      future will be the default, with small bits of code added to change to
      the flags for the few devices which are the exceptions to this rule.
      
      Finally, there are a few places with "FIXME" comments. Note that these
      aren't indicating places that are broken according to the currently
      supported devices, they are places that will need fixing when support
      for new PCI controller models is added.
      
      To assure that there was no regression in the auto-allocation of PCI
      addresses or auto-creation of integrated pci-root, ide, and usb
      controllers, a new test case (pci-bridge-many-disks) has been added to
      both the qemuxml2argv and qemuxml2xml tests. This new test defines a
      domain with several dozen virtio disks but no pci-root or
      pci-bridges. The .args file of the new test case was created using
      libvirt sources from before this patch, and the test still passes
      after this patch has been applied.
      3ceb4c7d
    • L
      qemu: only check for PIIX3-specific device addrs on pc-* machinetypes · fcbfd584
      Laine Stump 提交于
      The implicit IDE, USB, and video controllers provided by the PIIX3
      chipset in the pc-* machinetypes are not present on other
      machinetypes, so we shouldn't be doing the special checking for
      them. This patch places those validation checks into a separate
      function that is only called for machine types that have a PIIX3 chip
      (which happens to be the i440fx-based pc-* machine types).
      
      One qemuxml2argv test data file had to be changed - the
      pseries-usb-multi test had included a piix3-usb-uhci device, which was
      being placed at a specific address, and also had slot 2 auto reserved
      for a video device, but the pseries virtual machine doesn't actually
      have a PIIX3 chip, so even if there was a piix3-usb-uhci driver for
      it, the device wouldn't need to reside at slot 1 function 2. I just
      changed the .argv file to have the generic slot info for the two
      devices that results when the special PIIX3 code isn't executed.
      fcbfd584