1. 14 1月, 2012 4 次提交
    • M
      tests: Add qemuxml2argv tests for PPC64 pseries machine · 4b942fe8
      Michael Ellerman 提交于
      Add four tests of the XML -> argv handling for the PPC64 pseries machine.
      
      The first is just a basic test of a bare bones machine.
      
      The three others test various aspects of the spapr-vio address handling.
      
      It seems that currently we can't include network devices, doing so leads
      to a segfault because the network driverState is not initialised. Working
      around that leads us to the problem that the 'default' network doesn't
      exist. So for now just leave network devices out.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      4b942fe8
    • M
      tests: Teach qemuxml2argvtest about spapr-vio addresses · 69dde2e6
      Michael Ellerman 提交于
      We can't call qemuCapsExtractVersionInfo() from test code, because it
      expects to be able to call the emulator, and for testing we have fake
      emulators that can't be executed. For that reason qemuxml2argvtest.c
      doesn't call qemuDomainAssignPCIAddresses(), instead it open codes its
      own version.
      
      That means we can't call qemuDomainAssignAddresses() from the test code,
      instead we need to manually call qemuDomainAssignSpaprVioAddresses().
      
      Also add logic to cope with qemuDomainAssignSpaprVioAddresses() failing,
      so that we can write a test that checks for a known failure in there.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      69dde2e6
    • P
      qemu: add virtio-scsi controller model · c9abfadf
      Paolo Bonzini 提交于
      Adding a new model for virtio-scsi roughly follows the same scheme
      as the previous patch.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c9abfadf
    • P
      qemu: add ibmvscsi controller model · 7b345b69
      Paolo Bonzini 提交于
      KVM will be able to use a PCI SCSI controller even on POWER.  Let
      the user specify the vSCSI controller by other means than a default.
      
      After this patch, the QEMU driver will actually look at the model
      and reject anything but auto, lsilogic and ibmvscsi.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7b345b69
  2. 13 1月, 2012 2 次提交
    • O
      qemu: Support copy on read for disk · 5edfcaae
      Osier Yang 提交于
      The new introduced optional attribute "copy_on_read</code> controls
      whether to copy read backing file into the image file. The value can
      be either "on" or "off". Copy-on-read avoids accessing the same backing
      file sectors repeatedly and is useful when the backing file is over a
      slow network. By default copy-on-read is off.
      5edfcaae
    • E
      build: fix virsh reformat fallout · d98a3d4a
      Eric Blake 提交于
      Commit 69f0b446 failed to update the expected test output.
      
      * tests/virshtest.c (testCompareListDefault)
      (testCompareListCustom): Adjust to recent code change.
      d98a3d4a
  3. 12 1月, 2012 3 次提交
  4. 11 1月, 2012 1 次提交
  5. 09 1月, 2012 1 次提交
    • L
      qemu: add new disk device='lun' for bus='virtio' & type='block' · 177db087
      Laine Stump 提交于
      In the past, generic SCSI commands issued from a guest to a virtio
      disk were always passed through to the underlying disk by qemu, and
      the kernel would also pass them on.
      
      As a result of CVE-2011-4127 (see:
      http://seclists.org/oss-sec/2011/q4/536), qemu now honors its
      scsi=on|off device option for virtio-blk-pci (which enables/disables
      passthrough of generic SCSI commands), and the kernel will only allow
      the commands for physical devices (not for partitions or logical
      volumes). The default behavior of qemu is still to allow sending
      generic SCSI commands to physical disks that are presented to a guest
      as virtio-blk-pci devices, but libvirt prefers to disable those
      commands in the standard virtio block devices, enabling it only when
      specifically requested (hopefully indicating that the requester
      understands what they're asking for). For this purpose, a new libvirt
      disk device type (device='lun') has been created.
      
      device='lun' is identical to the default device='disk', except that:
      
      1) It is only allowed if bus='virtio', type='block', and the qemu
         version is "new enough" to support it ("new enough" == qemu 0.11 or
         better), otherwise the domain will fail to start and a
         CONFIG_UNSUPPORTED error will be logged).
      
      2) The option "scsi=on" will be added to the -device arg to allow
         SG_IO commands (if device !='lun', "scsi=off" will be added to the
         -device arg so that SG_IO commands are specifically forbidden).
      
      Guests which continue to use disk device='disk' (the default) will no
      longer be able to use SG_IO commands on the disk; those that have
      their disk device changed to device='lun' will still be able to use SG_IO
      commands.
      
      *docs/formatdomain.html.in - document the new device attribute value.
      *docs/schemas/domaincommon.rng - allow it in the RNG
      *tests/* - update the args of several existing tests to add scsi=off, and
       add one new test that will test scsi=on.
      *src/conf/domain_conf.c - update domain XML parser and formatter
      
      *src/qemu/qemu_(command|driver|hotplug).c - treat
       VIR_DOMAIN_DISK_DEVICE_LUN *almost* identically to
       VIR_DOMAIN_DISK_DEVICE_DISK, except as indicated above.
      
      Note that no support for this new device value was added to any
      hypervisor drivers other than qemu, because it's unclear what it might
      mean (if anything) to those drivers.
      177db087
  6. 07 1月, 2012 1 次提交
    • E
      tests: avoid test failure on rawhide gnutls · 74ff5750
      Eric Blake 提交于
      I hit a VERY weird testsuite failure on rawhide, which included
      _binary_ output to stderr, followed by a hang waiting for me
      to type something! (Here, using ^@ for NUL):
      
      $ ./commandtest
      TEST: commandtest
            WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      .WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      .WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      WARNING: gnome-keyring:: couldn't send data: Bad file descriptor
      .8^@^@^@8^@^@^@^A^@^@^@^Bay^A^@^@^@)PRIVATE-GNOME-KEYRING-PKCS11-PROTOCOL-V-1
      
      I finally traced it to the fact that gnome-keyring, called via
      gnutls_global_init which is turn called by virNetTLSInit, opens
      an internal fd that it expects to communicate to via a
      pthread_atfork handler (never mind that it violates POSIX by
      using non-async-signal-safe functions in that handler:
      https://bugzilla.redhat.com/show_bug.cgi?id=772320).
      
      Our problem stems from the fact that we pulled the rug out from
      under the library's expectations by closing an fd that it had
      just opened.  While we aren't responsible for fixing the bugs
      in that pthread_atfork handler, we can at least avoid the bugs
      by not closing the fd in the first place.
      
      * tests/commandtest.c (mymain): Avoid closing fds that were opened
      by virInitialize.
      74ff5750
  7. 02 1月, 2012 1 次提交
    • M
      Implement DNS SRV record into the bridge driver · 973af236
      Michal Novotny 提交于
      Hi,
      this is the fifth version of my SRV record for DNSMasq patch rebased
      for the current codebase to the bridge driver and libvirt XML file to
      include support for the SRV records in the DNS. The syntax is based on
      DNSMasq man page and tests for both xml2xml and xml2argv were added as
      well. There are some things written a better way in comparison with
      version 4, mainly there's no hack in tests/networkxml2argvtest.c and
      also the xPath context is changed to use a simpler query using the
      virXPathInt() function relative to the current node.
      
      Also, the patch is also fixing the networkxml2argv test to pass both
      checks, i.e. both unit tests and also syntax check.
      
      Please review,
      Michal
      Signed-off-by: NMichal Novotny <minovotn@redhat.com>
      973af236
  8. 30 12月, 2011 3 次提交
    • E
      seclabel: allow a seclabel override on a disk src · b4343293
      Eric Blake 提交于
      Implement the parsing and formatting of the XML addition of
      the previous commit.  The new XML doesn't affect qemu command
      line, so we can now test round-trip XML->memory->XML handling.
      
      I chose to reuse the existing structure, even though per-device
      override doesn't use all of those fields, rather than create a
      new structure, in order to reuse more code.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Add seclabel member.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Free it.
      (virSecurityLabelDefFree): New function.
      (virDomainDiskDefFormat): Print it.
      (virSecurityLabelDefFormat): Reduce output if model not present.
      (virDomainDiskDefParseXML): Alter signature, and parse seclabel.
      (virSecurityLabelDefParseXML): Split...
      (virSecurityLabelDefParseXMLHelper): ...into new helper.
      (virDomainDeviceDefParse, virDomainDefParseXML): Update callers.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.args:
      New file.
      * tests/qemuxml2xmltest.c (mymain): Enhance test.
      * tests/qemuxml2argvtest.c (mymain): Likewise.
      b4343293
    • E
      seclabel: extend XML to allow per-disk label overrides · 6cb4acce
      Eric Blake 提交于
      When doing security relabeling, there are cases where a per-file
      override might be appropriate.  For example, with a static label
      and relabeling, it might be appropriate to skip relabeling on a
      particular disk, where the backing file lives on NFS that lacks
      the ability to track labeling.  Or with dynamic labeling, it might
      be appropriate to use a custom (non-dynamic) label for a disk
      specifically intended to be shared across domains.
      
      The new XML resembles the top-level <seclabel>, but with fewer
      options (basically relabel='no', or <label>text</label>):
      
      <domain ...>
        ...
        <devices>
          <disk type='file' device='disk'>
            <source file='/path/to/image1'>
              <seclabel relabel='no'/> <!-- override for just this disk -->
            </source>
            ...
          </disk>
          <disk type='file' device='disk'>
            <source file='/path/to/image1'>
              <seclabel relabel='yes'> <!-- override for just this disk -->
                <label>system_u:object_r:shared_content_t:s0</label>
              </seclabel>
            </source>
            ...
          </disk>
          ...
        </devices>
        <seclabel type='dynamic' model='selinux'>
          <baselabel>text</baselabel> <!-- used for all devices without override -->
        </seclabel>
      </domain>
      
      This patch only introduces the XML and documentation; future patches
      will actually parse and make use of it.  The intent is that we can
      further extend things as needed, adding a per-device <seclabel> in
      more places (such as the source of a console device), and possibly
      allowing a <baselabel> instead of <label> for labeling where we want
      to reuse the cNNN,cNNN pair of a dynamically labeled domain but a
      different base label.
      
      First suggested by Daniel P. Berrange here:
      https://www.redhat.com/archives/libvir-list/2011-December/msg00258.html
      
      * docs/schemas/domaincommon.rng (devSeclabel): New define.
      (disk): Use it.
      * docs/formatdomain.html.in (elementsDisks, seclabel): Document
      the new XML.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml:
      New test, to validate RNG.
      6cb4acce
    • E
      schema: rewrite seclabel rng to match code · 116d6af9
      Eric Blake 提交于
      The RNG for <seclabel> was too strict - if it was present, then it
      had to have sub-elements, even if those didn't make sense for the
      given attributes.  Also, we didn't have any tests of <seclabel>
      parsing or XML output.
      
      In this patch, I added more parsing tests than output tests (since
      the output populates and/or reorders fields not present in certain
      inputs).  Making the RNG reliable is a precursor to using <seclabel>
      variants in more places in the XML in later patches.
      
      See also:
      http://berrange.com/posts/2011/09/29/two-small-improvements-to-svirt-guest-configuration-flexibility-with-kvmlibvirt/
      
      * docs/schemas/domaincommon.rng (seclabel): Tighten rules.
      * tests/qemuxml2argvtest.c (mymain): New tests.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*.*: New files.
      116d6af9
  9. 23 12月, 2011 1 次提交
    • E
      tests: fix schema checks sorting · dc099b83
      Eric Blake 提交于
      Commit 6fdbce12 attempted to sort the list of tests, but failed
      (without quotes, echo merges all the tests into a single line,
      so there was nothing to sort).
      
      * tests/schematestutils.sh: Fix thinko in previous patch.
      dc099b83
  10. 22 12月, 2011 1 次提交
  11. 21 12月, 2011 3 次提交
    • E
      tests: run schema checks in sorted order · 6fdbce12
      Eric Blake 提交于
      Having a test that depends on file system timestamps and/or inode
      allocation order gives non-deterministic output.
      
      * tests/schematestutils.sh: Run test in deterministic order.
      6fdbce12
    • M
      tests: Add fake PPC64 emulator for QEMU testing · bbae92f8
      Michael Ellerman 提交于
      Create a fake PPC64 QEMU so that we can run PPC64 QEMU tests when we
      don't have a real version of the emulator available.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      bbae92f8
    • M
      qemu: Add a capability flag for -no-acpi · 5abbe04d
      Michael Ellerman 提交于
      Currently non-x86 guests must have <acpi/> defined in <features> to
      prevent libvirt from running qemu with -no-acpi. Although it works, it
      is a hack.
      
      Instead add a capability flag which indicates whether qemu understands
      the -no-acpi option. Use it to control whether libvirt emits -no-acpi.
      
      Current versions of qemu always display -no-acpi in their help output,
      so this patch has no effect. However the development version of qemu
      has been modified such that -no-acpi is only displayed when it is
      actually supported.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      5abbe04d
  12. 13 12月, 2011 1 次提交
    • A
      tests: plug memory leak on linuxTestNodeInfo · 98b942c6
      Alex Jia 提交于
      Detected by valgrind. Leak introduced in commit 82ff25e1.
      
      * tests/nodeinfotest.c: avoid memory leak on nodeinfo test case.
      
      * how to reproduce?
        % cd tests && valgrind -v --leak-check=full ./nodeinfotest
      
      * actual valgrind result:
      
      ==22147== 65 bytes in 1 blocks are definitely lost in loss record 14 of 29
      ==22147==    at 0x4A0610F: realloc (vg_replace_malloc.c:525)
      ==22147==    by 0x330D6FED94: __vasprintf_chk (in /lib64/libc-2.12.so)
      ==22147==    by 0x426697: virVasprintf (stdio2.h:199)
      ==22147==    by 0x426757: virAsprintf (util.c:1695)
      ==22147==    by 0x41585F: linuxTestNodeInfo (nodeinfotest.c:108)
      ==22147==    by 0x416B21: virtTestRun (testutils.c:141)
      ==22147==    by 0x4157EA: mymain (nodeinfotest.c:140)
      ==22147==    by 0x416217: virtTestMain (testutils.c:696)
      ==22147==    by 0x330D61ECDC: (below main) (in /lib64/libc-2.12.so)
      ==22147==
      ==22147== LEAK SUMMARY:
      ==22147==    definitely lost: 65 bytes in 1 blocks
      ==22147==    indirectly lost: 0 bytes in 0 blocks
      ==22147==      possibly lost: 0 bytes in 0 blocks
      ==22147==    still reachable: 126,126 bytes in 1,341 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      98b942c6
  13. 10 12月, 2011 1 次提交
    • L
      test: replace deprecated "fedora-13" machine with "pc-0.13" · 7204a9fd
      Laine Stump 提交于
      One of the xml tests in the test suite was created using a
      now-deprecated qemu machine type ("fedora-13", which was only ever
      valid for Fedora builds of qemu). Although strictly speaking it's not
      necessary to replace it with an actual supported qemu machine type
      (since the xml in question is never actually sent to qemu), this patch
      changes it to the actually-supported "pc-0.13" just for general
      tidiness. (Also, on some Fedora builds which contain a special patch
      to rid the world of "fedora-13", having it mentioned in the test suite
      will cause make check to fail.)
      7204a9fd
  14. 08 12月, 2011 1 次提交
  15. 05 12月, 2011 1 次提交
  16. 04 12月, 2011 1 次提交
    • E
      command: handle empty buffer argument correctly · 2b045d39
      Eric Blake 提交于
      virBufferContentAndReset (intentionally) returns NULL for a buffer
      with no content, but it is feasible to invoke a command with an
      explicit empty string.
      
      * src/util/command.c (virCommandAddEnvBuffer): Reject empty string.
      (virCommandAddArgBuffer): Allow explicit empty argument.
      * tests/commandtest.c (test9): Test it.
      * tests/commanddata/test9.log: Adjust.
      2b045d39
  17. 02 12月, 2011 3 次提交
    • E
      build: update to latest gnulib · 059d746d
      Eric Blake 提交于
      * .gnulib: Update to latest, for improved 'make syntax-check' and
      compiler warnings.
      * m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS):
      Re-silence -Wformat-nonliteral.
      * cfg.mk (_test_script_regex): Recognize our test scripts.
      * gnulib/local/lib/*.diff: Drop, now that gnulib has this.
      * tests/virsh-optparse: Fix use of compare.
      * tests/virsh-schedinfo: Likewise.
      059d746d
    • E
      build: properly skip tests · da8061ee
      Eric Blake 提交于
      I got this failure on FreeBSD:
      
      shunloadtest.c: In function 'main':
      shunloadtest.c:150: error: 'EXIT_AM_SKIP' undeclared (first use in this function)
      
      but inspection showed several other problems, all fixed here.
      
      * tests/domainsnapshotxml2xmltest.c [!WITH_QEMU]: Ensure
      EXIT_AM_SKIP is defined.
      * tests/esxutilstest.c [!WITH_ESX]: Likewise.
      * tests/openvzutilstest.c [!WITH_OPENVZ]: Likewise.
      * tests/qemuargv2xmltest.c [!WITH_QEMU]: Likewise.
      * tests/qemuhelptest.c [!WITH_QEMU]: Likewise.
      * tests/qemuxml2argvtest.c [!WITH_QEMU]: Likewise.
      * tests/qemuxml2xmltest.c [!WITH_QEMU]: Likewise.
      * tests/qemuxmlnstest.c [!WITH_QEMU]: Likewise.
      * tests/shunloadtest.c [!linux]: Likewise.
      * tests/vmx2xmltest.c [!WITH_VMX]: Likewise.
      * tests/xml2vmxtest.c [!WITH_VMX]: Likewise.
      da8061ee
    • D
      Avoid crash in shunloadtest · 24d97928
      Daniel P. Berrange 提交于
      For unknown reasons, the shunloadtest will crash on Fedora 16
      inside dlopen()
      
       (gdb) bt
       #0  0x00000000000050e6 in ?? ()
       #1  0x00007ff61a77b9d5 in floor () from /lib64/libm.so.6
       #2  0x00007ff61e522963 in _dl_relocate_object () from /lib64/ld-linux-x86-64.so.2
       #3  0x00007ff61e5297e6 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
       #4  0x00007ff61e525006 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
       #5  0x00007ff61e52917a in _dl_open () from /lib64/ld-linux-x86-64.so.2
       #6  0x00007ff61e0f6f26 in dlopen_doit () from /lib64/libdl.so.2
       #7  0x00007ff61e525006 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
       #8  0x00007ff61e0f752f in _dlerror_run () from /lib64/libdl.so.2
       #9  0x00007ff61e0f6fc1 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
       #10 0x0000000000400a15 in main (argc=<optimized out>, argv=<optimized out>) at shunloadtest.c:105
      
      Changing from RTLD_NOW to RTLD_LAZY avoids this problem,
      but quite possibly does not fix the root cause.
      
      * shunloadtest.c: s/NOW/LAZY/
      24d97928
  18. 01 12月, 2011 1 次提交
  19. 30 11月, 2011 4 次提交
    • D
      Add internal APIs for dealing with time · 3ec12898
      Daniel P. Berrange 提交于
      The logging APIs need to be able to generate formatted timestamps
      using only async signal safe functions. This rules out using
      gmtime/localtime/malloc/gettimeday(!) and much more.
      
      Introduce a new internal API which is async signal safe.
      
        virTimeMillisNowRaw replacement for gettimeofday. Uses clock_gettime
                            where available, otherwise falls back to the unsafe
                            gettimeofday
      
        virTimeFieldsNowRaw  replacements for gmtime(), convert a timestamp
        virTimeFieldsThenRaw into a broken out set of fields. No localtime()
                             replacement is provided, because converting to
                             local time is not practical with only async signal
                             safe APIs.
      
        virTimeStringNowRaw  replacements for strftime() which print a timestamp
        virTimeStringThenRaw into a string, using a pre-determined format, with
                             a fixed size buffer (VIR_TIME_STRING_BUFLEN)
      
      For each of these there is also a version without the Raw postfix
      which raises a full libvirt error. These versions are not async
      signal safe
      
      * src/Makefile.am, src/util/virtime.c, src/util/virtime.h: New files
      * src/libvirt_private.syms: New APis
      * configure.ac: Check for clock_gettime in -lrt
      * tests/virtimetest.c, tests/Makefile.am: Test new APIs
      3ec12898
    • D
      Add suspend info to Xen, LXC and UML hypervisor capabilities · 9ae0b834
      Daniel P. Berrange 提交于
      * src/lxc/lxc_conf.c, src/uml/uml_conf.c,
        src/xen/xen_hypervisor.c: Initialize suspend capabilities
      * tests/xencapsdata/*xml: Add empty powermgmt capabilities
      9ae0b834
    • H
      blkiotune: add qemu support for blkiotune.device_weight · 93ab5859
      Hu Tao 提交于
      Implement setting/getting per-device blkio weights in qemu,
      using the cgroups blkio.weight_device tunable.
      93ab5859
    • H
      blkiotune: add interface for blkiotune.device_weight · 6ac81c8e
      Hu Tao 提交于
      This adds per-device weights to <blkiotune>.  Note that the
      cgroups implementation only supports weights per block device,
      and not per-file within the device; hence this option must be
      global to the domain definition rather than tied to individual
      <devices>/<disk> entries:
      
      <domain ...>
        <blkiotune>
          <device>
            <path>/path/to/block</path>
            <weight>1000</weight>
          </device>
        </blkiotune>
      ..
      
      This patch also adds a parameter --device-weights to virsh command
      blkiotune for setting/getting blkiotune.weight_device for any
      hypervisor that supports it.  All <device> entries under
      <blkiotune> are concatenated into a single string attribute under
      virDomain{Get,Set}BlkioParameters, named "device_weight".
      Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6ac81c8e
  20. 23 11月, 2011 1 次提交
  21. 19 11月, 2011 5 次提交