1. 01 3月, 2016 1 次提交
    • M
      qemu: Shorten per-domain directory names · a89f05ba
      Martin Kletzander 提交于
      Per-domain directories were introduced in order to be able to
      completely separate security labels for each domain (commit
      f1f68ca3).  However when the domain
      name is long (let's say a ridiculous 110 characters), we cannot
      connect to the monitor socket because on length of UNIX socket address
      is limited.  In order to get around this, let's shorten it in similar
      fashion and in order to avoid conflicts, throw in an ID there as well.
      Also save that into the status XML and load the old status XMLs
      properly (to clean up after older domains).  That way we can change it
      in the future.
      
      The shortening can be seen in qemuxml2argv tests, for example in the
      hugepages-pages2 case.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      a89f05ba
  2. 26 2月, 2016 4 次提交
  3. 25 2月, 2016 2 次提交
    • M
      vircgroupmock: Mock access("/sys/devices/system/cpu/present") · 50129dcc
      Michal Privoznik 提交于
      There's been a report on the upstream list [1] describing we
      access /sys/devices/system/cpu/present directly on the host from
      within our test suite. This may end up in unpredictable results
      as no all linux systems are required to have that file. Mock
      access to the file.
      
      libvirt.git/tests $ ../run strace vircgrouptest
      ...
      access("/sys/devices/system/cpu/present", F_OK) = 0
      ...
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      50129dcc
    • E
      build: accomodate selinux 2.5 header API change · 5ea3a690
      Eric Blake 提交于
      Yet again, selinux has been adding const-correctness; this change
      is ABI-compatible, but breaks API, which affects us when we try to
      override things in our testsuite:
      
      ../../tests/securityselinuxhelper.c:307:24: error: conflicting types for 'selabel_open'
       struct selabel_handle *selabel_open(unsigned int backend,
                              ^~~~~~~~~~~~
      In file included from ../../tests/securityselinuxhelper.c:32:0:
      /usr/include/selinux/label.h:73:24: note: previous declaration of 'selabel_open' was here
      
      The problem is a new 'const' prior to the second parameter.
      
      Fix it the same way we did in commit 292d3f2d: check for the new
      const at configure time.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5ea3a690
  4. 23 2月, 2016 4 次提交
    • A
      tests: Fix typo oaque -> opaque · 73fc4651
      Andrea Bolognani 提交于
      No functional changes.
      73fc4651
    • J
      xenconfig: support xl<->xml conversion of rbd disk devices · 6604a3dd
      Jim Fehlig 提交于
      The target= setting in xl disk configuration can be used to encode
      meta info that is meaningful to a backend. Leverage this fact to
      support qdisk network disk types such as rbd. E.g. <disk> config
      such as
      
         <disk type='network' device='disk'>
           <driver name='qemu' type='raw'/>
           <source protocol='rbd' name='pool/image'>
             <host name='mon1.example.org' port='6321'/>
             <host name='mon2.example.org' port='6322'/>
             <host name='mon3.example.org' port='6322'/>
           </source>
           <target dev='hdb' bus='ide'/>
           <address type='drive' controller='0' bus='0' target='0' unit='1'/>
         </disk>
      
      can be converted to the following xl config (and vice versa)
      
        disk = [ "format=raw,vdev=hdb,access=rw,backendtype=qdisk,
                  target=rbd:pool/image:auth_supported=none:mon_host=mon1.example.org\\:6321\\;mon2.example.org\\:6322\\;mon3.example.org\\:6322"
               ]
      
      Note that in xl disk config, a literal backslash in target= must
      be escaped with a backslash. Conversion of <auth> config is not
      handled in this patch, but can be done in a follow-up patch.
      
      Also add a test for the conversions.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      6604a3dd
    • J
      xenconfig: produce key=value disk config syntax in xl formatter · a44f1f85
      Jim Fehlig 提交于
      The most formal form of xl disk configuration uses key=value
      syntax to define each configuration item, e.g.
      
      format=raw, vdev=xvda, access=rw, backendtype=phy, target=disksrc
      
      Change the xl disk formatter to produce this syntax, which allows
      target= to contain meta info needed to setup a network-based
      disksrc (e.g. rbd, nbd, iscsi). For details on xl disk config
      format, see  $xen-src/docs/misc/xl-disk-configuration.txt
      
      Update the disk config in the tests to use the formal syntax.
      But add tests to ensure disks specified with the positional
      parameter syntax are correctly converted to <disk> XML.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      a44f1f85
    • J
      xenconfig: replace text 'xm' with 'xl' in xlconfigtest · 8910ceaf
      Jim Fehlig 提交于
      While at it, improve a few comments. No functional change.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      8910ceaf
  5. 22 2月, 2016 1 次提交
  6. 19 2月, 2016 3 次提交
    • C
      qemu: parse: drop redundant AddImplicitControllers · e6ad2b69
      Cole Robinson 提交于
      PostParse handles it for us now.
      
      This causes some test suite churn; qemu's custom PostParse could is
      now invoked before the generic AddImplicitControllers, so PCI
      controllers end up sequentially in the XML before the generically
      added IDE controllers. So it's just some XML reordering
      e6ad2b69
    • C
      domain: add implicit controllers from post parse · 4066c734
      Cole Robinson 提交于
      Seems like the natural fit, since we are already adding other XML bits
      in the PostParse routine.
      
      Previously AddImplicitControllers was only called at the end of XML
      parsing, meaning code that builds a DomainDef by hand had to manually
      call it. Now those PostParse callers get it for free.
      
      There's some test churn here; xen xm and sexpr test suite bits weren't
      calling this before, but now they are, so you'll see new IDE controllers.
      I don't think this will cause problems in practice, since the code already
      needs to handle these implicit controllers like in the case when a user
      defines their own XML.
      4066c734
    • A
      test: qemuxml2argv: Drop QEMU_CAPS_DEVICE uses · b6c40bd5
      Andrea Bolognani 提交于
      Since commit 51045df0, the QEMU_CAPS_DEVICE capability is enabled
      automatically and shouldn't be passed as an argument to DO_TEST();
      however, commit 998a936c accidentally introduced few such uses.
      b6c40bd5
  7. 18 2月, 2016 6 次提交
    • C
      tests: Remove unused virtTestClearLineRegex · ad859090
      Cole Robinson 提交于
      This was only used for test 'xml blanking', which has now all
      been removed, and isn't an ideal paradigm anyways since it
      inhibits easy XML regeneration.
      ad859090
    • C
      tests: lxcconf2xml: Drop XML blanking · 1064fb33
      Cole Robinson 提交于
      Hardcode a UUID like we did for qemuargv2xml, so we can use standard
      comparison helpers, which gives us VIR_TEST_REGENERATE_OUTPUT support
      1064fb33
    • C
      tests: qemuargv2xml: Drop memory XML blanking · 2fc011fe
      Cole Robinson 提交于
      The memory XML blanking is only there to avoid the unit= churn that
      was added by default a long time ago.
      
      Drop the blanking, switch over to using the standard comparison
      helpers, and regenerate the output with VIR_TEST_REGENERATE_OUTPUT.
      2fc011fe
    • C
      tests: qemuargv2xml: hardcode disk auth usage · 73ed1d74
      Cole Robinson 提交于
      If a qemuargv has iscsi or ceph secrets on the command line, we will
      convert that to XML like:
      
        <auth username='myname'>
          <secret type='iscsi'/>
        </auth>
      
      This is not valid XML, as either a UUID or usage must be specified in
      the secret block. It's not clear though how the argv2xml code can do
      anything correct here, since XML like this requires a libvirt secret
      object to have already been defined.
      
      The current test suite handles this by blanking out any <secret> block
      in the XML. This avoids domainschematest failures.
      
      Instead of blanking, let's hardcode a usage= name. This lets us test
      the other bits of generated <secret> XML, and is a step towards wiring
      up VIR_TEST_REGENERATE_OUTPUT
      73ed1d74
    • C
      tests: qemuargv2xml: Remove UUID randomness · b25027ba
      Cole Robinson 提交于
      Overwrite any randomly generated UUID to use a hardcoded value, so
      we don't need to blank it when comparing XML.
      b25027ba
    • C
      tests: qemuargv2xml: Remove unneeded XML blanking · 7973c0ef
      Cole Robinson 提交于
      None of the test cases depend on dropping these XML bits
      7973c0ef
  8. 17 2月, 2016 4 次提交
    • E
      virnetdaemon: Store servers in a hash table · 252610f7
      Erik Skultety 提交于
      Since the daemon can manage and add (at fresh start) multiple servers,
      we also should be able to add them from a JSON state file in case of a
      daemon restart, so post exec restart support for multiple servers is also
      provided. Patch also updates virnetdaemontest accordingly.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      252610f7
    • E
      util: Refactor virHashForEach so it returns as soon as an iterator fails · 353de572
      Erik Skultety 提交于
      The method will now return 0 on success and -1 on error, rather than number of
      items which it iterated over before it returned back to the caller. Since the
      only place where we actually check the number of elements iterated is in
      virhashtest, return value of 0 and -1 can be a pretty accurate hint that it
      iterated over all the items. However, if we really want to know the number of
      items iterated over (like virhashtest does), a counter has to be provided
      through opaque data to each iterator call. This patch adjusts return value of
      virHashForEach, refactors the body, so it returns as soon as one of the
      iterators fail and adjusts virhashtest to reflect these changes.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      353de572
    • E
      util: Add a return value to void hash iterators · cc48d3a1
      Erik Skultety 提交于
      Our existing virHashForEach method iterates through all items disregarding the
      fact, that some of the iterators might have actually failed. Errors are usually
      dispatched through an error element in opaque data which then causes the
      original caller of virHashForEach to return -1. In that case, virHashForEach
      could return as soon as one of the iterators fail. This patch changes the
      iterator return type and adjusts all of its instances accordingly, so the
      actual refactor of virHashForEach method can be dealt with later.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      cc48d3a1
    • J
      qemu: Move qemuAssign*Alias* API's into their own module · de71e0e5
      John Ferlan 提交于
      Create a new module qemu_alias.c to handle the qemuAssign*Alias* APIs
      and the qemuDomainDeviceAliasIndex
      de71e0e5
  9. 16 2月, 2016 3 次提交
    • A
      tests: Add more GIC test cases · 998a936c
      Andrea Bolognani 提交于
      Test all kinds of scenarios, including guests asking for GIC but
      failing to specify a version, guests specifying an invalid version
      and guests trying to use GIC with non-virt or even non-ARM machines.
      998a936c
    • A
      tests: Reorganize and simplify GIC test cases · 161a3418
      Andrea Bolognani 提交于
      Unify the naming to prepare for new test cases that will be added
      later on.
      
      Convert a couple of output XML files for the qemuxml2xml test to
      symlinks while at it, since they were identical to the corresponding
      input XML files anyways.
      
      Moreover, since we're only interested in testing GIC support here,
      simplify XML files by getting rid of the unrelevant bits.
      161a3418
    • A
      qemu: Always enable GIC on ARM virt machines · bd236950
      Andrea Bolognani 提交于
      GIC is always available to ARM virt machines, and the domain XML should
      reflect this fact.
      bd236950
  10. 12 2月, 2016 4 次提交
    • M
      virportallocatortest: Run on linux only · 26946f67
      Michal Privoznik 提交于
      After the rework of mocking of our tests there's the
      virportallocator test failing to link on mingw. Well, it's the
      mocking library actually:
      
      ../gnulib/lib/.libs/libgnu.a(bind.o): In function `rpl_bind':
      /home/jenkins/libvirt-mingw/build32/gnulib/lib/../../../gnulib/lib/bind.c:33: multiple definition of `rpl_bind'
      .libs/virportallocatormock_la-virportallocatormock.o:/home/jenkins/libvirt-mingw/build32/tests/../../tests/virportallocatormock.c:79: first defined here
      
      I've no idea why this matters to mingw and does not to others.
      Nevertheless, if we make the test linux only the problem goes
      away.
      
      Apparently, our test for RTLD_NEXT is not sufficient because
      mingw32 defines it. Lets put aside for a while fact that it has
      the same value as RTLD_DEFAULT which by description has different
      meaning, shall we?
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      26946f67
    • A
      tests: Rename virmockdbus -> virdbusmock for consistency · 92ec2e5e
      Andrea Bolognani 提交于
      All mock libraries were called vir*mock except for this one; now
      the naming is consistent across the board.
      92ec2e5e
    • A
      tests: Don't use "lib" prefix for mock libraries · f6d6d21f
      Andrea Bolognani 提交于
      virportallocatormock was the only one using it, and has been
      changed accordingly.
      f6d6d21f
    • A
      tests: Split off the mock part of the port allocator test · caf8d479
      Andrea Bolognani 提交于
      Instead of compiling either the mock or the non-mock part of the
      file based on a compiler flag, split the mock part off to its
      own file.
      caf8d479
  11. 11 2月, 2016 6 次提交
    • A
      tests: Link mock libraries against gnulib and gnulib only · 1ed0bdd8
      Andrea Bolognani 提交于
      Mock libraries should not be linked against libvirt, but some of
      them did - fix that.
      
      On the other hand, not linking against gnulib can cause build
      failures on mingw, so define a new $(MOCKLIBS_LIBS) variable and
      use it everywhere.
      1ed0bdd8
    • A
      tests: Use plain close() in mock code · a03cbfe0
      Andrea Bolognani 提交于
      The virportallocatortest.c file is compiled both as a test case
      and as a mock library; in the latter case, it can't use
      VIR_FORCE_CLOSE() because mock libraries are not linked against
      libvirt.
      
      Replace VIR_FORCE_CLOSE() with plain close() to solve the issue.
      a03cbfe0
    • M
      dbus: Don't unref NULL messages · 862298a2
      Michal Privoznik 提交于
      Apparently we are not the only ones with dumb free functions
      because dbus_message_unref() does not accept NULL either. But if
      I were to vote, this one is even more evil. Instead of returning
      an error just like we do it immediately dereference any pointer
      passed and thus crash you app. Well done DBus!
      
        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 0x7f878ebda700 (LWP 31264)]
        0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        (gdb) bt
        #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
        #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
        #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
        #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
        #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
        (gdb) frame 2
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        228         dbus_message_unref(reply);
        (gdb) p reply
        $1 = (DBusMessage *) 0x0
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      862298a2
    • J
      qemu: Split the command parsing routines into own module · d860b2f5
      John Ferlan 提交于
      Extract out the qemuParseCommandLine{String|Pid} into their own
      separate module - taking with it all the various static functions.
      
      Causes a ripple effect with a few other modules to include the
      new qemu_parse_command.h.
      
      Narrowed down the list of #include's in the split out module to
      those that are necessary for build.
      d860b2f5
    • A
      Revert "tests: Don't link mock libraries against libvirt and gnulib" · 51c70705
      Andrea Bolognani 提交于
      This reverts commit 6aa90452.
      
      Turns out that not linking against libvirt and gnulib is okay for
      regular Linux (and FreeBSD) builds, but makes mingw very unhappy.
      
        .../virnetserverclientmock_la-virnetserverclientmock.o:
          In function `virNetSocketGetSELinuxContext':
          .../virnetserverclientmock.c:61: undefined reference to `rpl_strdup'
        .../libvirportallocatormock_la-virportallocatortest.o:
          In function `init_syms':
          .../virportallocatortest.c:61: undefined reference to `virFileClose'
      51c70705
    • A
      tests: Don't link mock libraries against libvirt and gnulib · 6aa90452
      Andrea Bolognani 提交于
      Mock libraries are used with LD_PRELOAD from test binaries that
      are already linked against those libraries, so they will be able
      to resolve the symbols anyway.
      6aa90452
  12. 10 2月, 2016 2 次提交
    • C
      tests: qemu: More aarch64 virtio and pci tests · 5a1ccaeb
      Cole Robinson 提交于
      Clarify the point of some of the test cases by renaming them. Add more
      xml2xml tests.
      5a1ccaeb
    • C
      tests: qemuxml2xml: assign device addresses · c1c4d0d5
      Cole Robinson 提交于
      We use the PreFormat callback for this. Many test cases need to be extended
      to pass in proper qemuCaps flags so AssignAddresses doesn't throw errors.
      
      One test case (pcie-root-port-too-many) is dropped, since it was meant
      only for checking an error condition in qemuxml2argv, and one we add in
      AssignAddresses it errors here too.
      
      Long term I think AssignAddresses should be handled in qemu's PostParse
      callback, but that's not entirely straightforward. Handling it here
      means we can get the test suite churn over with.
      c1c4d0d5