1. 31 7月, 2013 2 次提交
  2. 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
  3. 29 7月, 2013 1 次提交
  4. 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
  5. 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
  6. 24 7月, 2013 5 次提交
    • 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
    • J
      valgrind.supp: Add more valgrind suppression paths · e91f14cb
      John Ferlan 提交于
      Update based on recent run/failures seen
      e91f14cb
    • D
      Remove obsolete cgroups creation apis · d64e852b
      Daniel P. Berrange 提交于
      The virCgroupNewDomainDriver and virCgroupNewDriver methods
      are obsolete now that we can auto-detect existing cgroup
      placement. Delete them to reduce code bloat.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d64e852b
    • D
      Add logic for handling systemd-machined non-existance · 666bff4f
      Daniel P. Berrange 提交于
      If systemd machine does not exist, return -2 instead of -1,
      so that applications don't need to repeat the tedious error
      checking code
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      666bff4f
  7. 23 7月, 2013 1 次提交
    • J
      conf: Introduce new XML tag "mode" for disk source · c00b2f0d
      John Ferlan 提交于
      There are two ways to use a iSCSI LUN as disk source for qemu.
      
       * The LUN's path as it shows up on host, e.g.
         /dev/disk/by-path/ip-$ip:3260-iscsi-$iqn-fc18:iscsi.iscsi0-lun-1
      
       * The libiscsi URI from the storage pool source element host attribute, e.g.
         iscsi://demo.org:6000/iqn.1992-01.com.example/1
      
      For a "volume" type disk, if the specified "pool" is of iscsi
      type, we should support to use the LUN in either of above 2 ways.
      That's why to introduce a new XML tag "mode" for the disk source
      (libvirt should support iscsi pool with libiscsi, but it's another
      new feature, which should be done later).
      
      The "mode" can be either of "host" or "direct". Use "host" to indicate
      use of the LUN with the path as it shows up on host. Use "direct" to
      indicate to use it with the source pool host URI (future patches may support
      to use network type libvirt storage too, e.g. Ceph)
      c00b2f0d
  8. 22 7月, 2013 8 次提交
    • J
      tests: Free test at the end of GetDeviceAliases JSON test · c9150d37
      Jiri Denemark 提交于
      Commit 58b147ad added a test for
      qemuMonitorGetDeviceAliases but forgot to free the test object at the
      end which causes all sort of weird errors and failures when new tests
      are added after the GetDeviceAliases.
      c9150d37
    • D
      Report full errors from virCgroupNew* · b64dabff
      Daniel P. Berrange 提交于
      Instead of returning raw errno values, report full libvirt
      errors in virCgroupNew* functions.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b64dabff
    • D
      Add API for calling systemd-machined's DBus API · dff93f8c
      Daniel P. Berrange 提交于
      To register virtual machines and containers with systemd-machined,
      and thus have cgroups auto-created, we need to talk over DBus.
      This is somewhat tedious code, so introduce a dedicated function
      to isolate the DBus call in one place.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dff93f8c
    • D
      Introduce virDBusCallMethod & virDBusMessageRead methods · 834c9c94
      Daniel P. Berrange 提交于
      Doing DBus method calls using libdbus.so is tedious in the
      extreme. systemd developers came up with a nice high level
      API for DBus method calls (sd_bus_call_method). While
      systemd doesn't use libdbus.so, their API design can easily
      be ported to libdbus.so.
      
      This patch thus introduces methods virDBusCallMethod &
      virDBusMessageRead, which are based on the code used for
      sd_bus_call_method and sd_bus_message_read. This code in
      systemd is under the LGPLv2+, so we're license compatible.
      
      This code is probably pretty unintelligible unless you are
      familiar with the DBus type system. So I added some API
      docs trying to explain how to use them, as well as test
      cases to validate that I didn't screw up the adaptation
      from the original systemd code.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      834c9c94
    • J
      cpu: Let explicit features override model features · 67dfc772
      Jiri Denemark 提交于
      Until now CPU features inherited from a specified CPU model could only
      be overridden with 'disable' policy. With this patch, any explicitly
      specified feature always overrides the same feature inherited from a CPU
      model regardless on the specified policy.
      
      The CPU in x86-exact-force-Haswell.xml would previously be incompatible
      with x86-host-SandyBridge.xml CPU even though x86-host-SandyBridge.xml
      provides all features required by x86-exact-force-Haswell.xml.
      67dfc772
    • J
      cpu: Store arch in virCPUData · 1dfa174a
      Jiri Denemark 提交于
      1dfa174a
    • J
      Replace union cpuData with virCPUData · 57d52b24
      Jiri Denemark 提交于
      57d52b24
    • V
      qemu: Shorten SCSI hostdev alias to avoid QEMU failure · 1a82e01c
      Viktor Mihajlovski 提交于
      The alias for hostdevs of type SCSI can be too long for QEMU if
      larger LUNs are encountered. Here's a real life example:
      
          <hostdev mode='subsystem' type='scsi' managed='no'>
            <source>
              <adapter name='scsi_host0'/>
              <address bus='0' target='19' unit='1088634913'/>
            </source>
            <address type='drive' controller='0' bus='0' target='0' unit='0'/>
          </hostdev>
      
      this results in a too long drive id, resulting in QEMU yelling
      
      Property 'scsi-generic.drive' can't find value 'drive-hostdev-scsi_host0-0-19-1088634913'
      
      This commit changes the alias back to the default hostdev$(index)
      scheme.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      1a82e01c
  9. 20 7月, 2013 1 次提交
  10. 19 7月, 2013 4 次提交
    • D
      Change s/i/iv/ in test code to avoid syntax-check · a81eb0b4
      Daniel P. Berrange 提交于
      The code parsing VIR_TEST_RANGE mistakenly used 'unsigned int i'
      which violated syntax-check rules
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a81eb0b4
    • D
      Allow test cases to be run selectively · ab92ae33
      Daniel P. Berrange 提交于
      When debugging a failing test with many test cases, it is useful
      to be able to skip most tests. Introducing a new environment
      variable VIR_TEST_RANGE=N-M enables execution of only the test
      cases numbered N-M inclusive, starting from 1.
      
      For example, to skip all the cgroup tests except 2
      
      $ VIR_TEST_RANGE=2-3 VIR_TEST_DEBUG=1 ./vircgrouptest
      TEST: vircgrouptest
       2) New cgroup for driver                                             ... Unexpected found LXC cgroup: 1
      libvirt: Cgroup error : Failed to create controller cpu for group: No such file or directory
      FAILED
       3) New cgroup for domain driver                                      ... Cannot find LXC cgroup: 1
      libvirt: Cgroup error : Failed to create controller cpu for group: No such file or directory
      FAILED
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ab92ae33
    • E
      maint: split long lines in Makefiles · d21d40bf
      Eric Blake 提交于
      Makefiles are another easy file to enforce line limits.
      
      Mostly straightforward; interesting tricks worth noting:
      src/Makefile.am: $(confdir) was already defined, use it in more places
      tests/Makefile.am: path_add and VG required some interesting compression
      
      * cfg.mk (sc_prohibit_long_lines): Add another test.
      * Makefile.am: Fix offenders.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d21d40bf
    • E
      tests: split long lines · 684c90bf
      Eric Blake 提交于
      Long lines are harder to read and harder to diff; in fact, if lines get
      too long (> 1000 bytes), it starts causing issues where git send-email
      refuses to send patches for the file.  I've cleaned up the tests
      directory in the past (see commits bd6c46fa, 3b750d13), but new long
      lines have been introduced in the meantime.
      
      Why 90 instead of 80? Because there were too many tests on the fringe
      edge, and I didn't want to edit that many files.
      
      Add a syntax check to prevent future long lines.
      
      * cfg.mk (sc_prohibit_long_lines): New rule.
      * tests/qemuxml2argvdata/qemuxml2argv-*.args: Split lines of any
      file with content longer than 90 columns.
      * tests/storagevolxml2argvdata/*.argv: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      684c90bf
  11. 18 7月, 2013 4 次提交
  12. 16 7月, 2013 2 次提交