1. 08 8月, 2013 1 次提交
  2. 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
  3. 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
  4. 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
  5. 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
  6. 31 7月, 2013 15 次提交
  7. 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
  8. 29 7月, 2013 1 次提交
  9. 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
  10. 25 7月, 2013 4 次提交
    • 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