Commit Graph

593 Commits

Author SHA1 Message Date
Jiri Denemark
69b7552154 qemu: Fix detection of drive readonly option
So far, readonly=on option is used when qemu supports -device. However,
there are qemu versions which support readonly option with -drive
although they don't have support for -device.
2010-10-26 10:31:50 +02:00
Eric Blake
1005f3c14a maint: ignore new test executable
* tests/.gitignore: Sort, and add sockettest.
2010-10-25 14:56:24 -06:00
Jiri Denemark
199f46672a tests: Silence qemuxml2argv test 2010-10-22 21:09:24 +02:00
Daniel P. Berrange
9afa006082 Add test suite for virSocket APIs
Add a test suite for check parsing, formatting, range calculation
and netmask checking APIs in virSocketAddr.

* tests/sockettest.c, tests/Makefile.am: Add new test case
2010-10-22 11:59:37 +01:00
Jiri Denemark
f05b0e46eb Fix make check on RHEL-5
The test for <vcpu> element is unrelated to vnc so the easiest fix is to
remove related configuration.
2010-10-20 16:14:18 +02:00
Matthias Bolte
e751911929 Don't let daemon-conf test fail when auditing is disabled 2010-10-20 14:01:03 +02:00
John Morrissey
c08c7b0143 Add process= support for 'qemu-kvm -name'
This sets the process name to the same value as the Windows title,
but since the name is limited to 16 chars only this is kept as a
configuration option and turned off by default
* src/qemu/qemu.conf src/qemu/qemu_conf.[ch]: hceck for support in the
  QEmu help output, add the option in qemu conf file and augment
  qemudBuildCommandLine to add it if switched on
* src/qemu/libvirtd_qemu.aug src/qemu/test_libvirtd_qemu.aug: augment
  the augeas lenses accordingly
* tests/qemuhelptest.c: cope with the extra flag being detected now
2010-10-20 10:30:30 +02:00
Daniel P. Berrange
ba5c9afffa Fix statstest when driver modules are enabled
The statstest is xen specific. Instead of filling the code with
a huge number of #ifdef WITH_XEN, just make its entire compilation
conditional in the Makefile.am. Also ensure it links to the Xen
driver so that it builds when driver modules are enabled

* tests/Makefile.am: Make statstest xen conditional. Link to
  xen driver
* tests/Makefile.am: Remove all conditionals
2010-10-19 17:31:30 +01:00
Eric Blake
0fab10e5ed vcpu: improve vcpu support in xen command line
This patch series focuses on xendConfigVersion 2 (xm_internal) and 3
(xend_internal), but leaves out changes for xenapi drivers.

See this link for more details about vcpu_avail for xm usage.
http://lists.xensource.com/archives/html/xen-devel/2009-11/msg01061.html

This relies on the fact that def->maxvcpus can be at most 32 with xen.

* src/xen/xend_internal.c (xenDaemonParseSxpr)
(sexpr_to_xend_domain_info, xenDaemonFormatSxpr): Use vcpu_avail
when current vcpus is less than maximum.
* src/xen/xm_internal.c (xenXMDomainConfigParse)
(xenXMDomainConfigFormat): Likewise.
* tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr: New file.
* tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr: Likewise.
* tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml: Likewise.
* tests/xmconfigdata/test-paravirt-vcpu.cfg: Likewise.
* tests/xmconfigdata/test-paravirt-vcpu.xml: Likewise.
* tests/xml2sexprtest.c (mymain): New test.
* tests/sexpr2xmltest.c (mymain): Likewise.
* tests/xmconfigtest.c (mymain): Likewise.
2010-10-19 10:06:45 -06:00
Eric Blake
d67c189e80 vcpu: improve vcpu support in qemu command line
* src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
between vcpus and maxvcpus, for new enough qemu.
* tests/qemuargv2xmltest.c (mymain): Add new test.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2xmltest.c (mymain): Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
2010-10-19 10:06:33 -06:00
Eric Blake
a74f4e4464 vcpu: add current attribute to <vcpu> element
Syntax agreed on in
https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html

<domain ...>
  <vcpu current='x'>y</vcpu>
...

can now be used to specify 1 <= x <= y current vcpus, in relation
to the boot-time max of y vcpus.  If current is omitted, then
current and max are assumed to be the same value.

* docs/schemas/domain.rng: Add new attribute.
* docs/formatdomain.html.in: Document it.
* tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
domainschematest.
* tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
2010-10-19 09:58:18 -06:00
Matthias Bolte
1c61648961 esx: Handle non-UTF-8 encoded VMX files
ESX(i) uses UTF-8, but a Windows based GSX server writes
Windows-1252 encoded VMX files.

Add a test case to ensure that libxml2 provides Windows-1252
to UTF-8 conversion.
2010-10-19 16:29:12 +02:00
Eric Blake
a559166c75 virsh: add tests for recent cli improvements
* tests/virshtest.c (mymain): Add tests of command parsing and
echo command.
2010-10-15 14:25:39 -06:00
Matthias Bolte
b1933e9e6a esx: Explictly declare VMX file content as UTF-8 2010-10-15 17:51:28 +02:00
Matthias Bolte
2dd86bbe5a esx: Handle name escaping properly
VMware uses a mix of percent-, pipe- and base64-encoding in
different combinations in different places.

Add a testcase for this.
2010-10-14 22:43:16 +02:00
Jiri Denemark
a4d9d98fb0 tests: Honor LIBVIRT_{DEBUG,LOG_*} variables 2010-10-14 09:36:54 +02:00
Jiri Denemark
d3ad0ee0af tests: Do not override LIBVIRT_DEBUG variable 2010-10-14 09:36:54 +02:00
Stefan Berger
677b7cf9b2 test: silence nwfilter test
This patch silences the nwfilter test case.
2010-10-13 20:11:25 -04:00
Eric Blake
94eb11f67a tests: fix spurious test failure
Failure introduced in commit 3a092f389.

* tests/xml2sexprdata/xml2sexpr-boot-grub.sexpr: Fix typo.
2010-10-13 11:33:10 -06:00
Daniel P. Berrange
f98a6cd6ae Enable support for nested SVM
This enables support for nested SVM using the regular CPU
model/features block. If the CPU model or features include
'svm', then the '-enable-nesting' flag will be added to the
QEMU command line. Latest out of tree patches for nested
'vmx', no longer require the '-enable-nesting' flag. They
instead just look at the cpu features. Several of the models
already include svm support, but QEMU was just masking out
the svm bit silently. So this will enable SVM on such
models

* src/qemu/qemu_conf.h: flag for -enable-nesting
* src/qemu/qemu_conf.c: Use -enable-nesting if VMX or SVM are in
  the CPUID
* src/cpu/cpu.h, src/cpu/cpu.c: API to check for a named feature
* src/cpu/cpu_x86.c: x86 impl of feature check
* src/libvirt_private.syms: Add cpuHasFeature
* src/qemuhelptest.c: Add nesting flag where required
2010-10-13 16:45:31 +01:00
Daniel P. Berrange
80aa766067 Improve error reporting in test suites
Before running each test case clear the thread local error
indicator. After running each test case, dispatch any error
that was reported

* tests/testutils.c: Fix error reporting in test suites
2010-10-13 16:45:31 +01:00
Daniel P. Berrange
3a092f3899 Fix Xen SEXPR generation to properly quote strings containing ()
* src/xen/sexpr.c: Ensure () are escaped in sexpr2string
* tests/sexpr2xmldata/sexpr2xml-boot-grub.sexpr,
  tests/sexpr2xmldata/sexpr2xml-boot-grub.xml,
  tests/xml2sexprdata/xml2sexpr-boot-grub.sexpr,
  tests/xml2sexprdata/xml2sexpr-boot-grub.xml: Data files to
  check escaping
* tests/sexpr2xmltest.c, tests/xml2sexprtest.c: Add boot-grub
  escaping test case
2010-10-13 16:42:48 +01:00
Daniel P. Berrange
a5c646a770 Implement support for virtio plan9fs filesystem passthrough in QEMU
Make use of the existing <filesystem> element to support plan9fs
filesystem passthrough in the QEMU driver

    <filesystem type='mount'>
      <source dir='/export/to/guest'/>
      <target dir='/import/from/host'/>
    </filesystem>

NB, the target is not actually a directory, it is merely a arbitrary
string tag that is exported to the guest as a hint for where to mount
it.
2010-10-13 12:04:50 +01:00
Nikunj A. Dadhania
d390fce413 XML parsing for memory tunables
Adding parsing code for memory tunables in the domain xml file
also change the internal define structures used for domain memory
informations
Adds a new specific test
2010-10-12 19:26:09 +02:00
Stefan Berger
5c6405a058 nwfilter: Add test case for testing the state attribute
This patch adds a test case for testing the XML parser's and instantiator's
support of the state attribute. The other test case tests existing
capabilities. Both test cases will be used in TCK again.
2010-10-07 06:43:35 -04:00
Matthias Bolte
02e11b8353 esx: Add support for virtual serial device network backing
Since version 4.1 ESX(i) can expose virtual serial devices over TCP.

Add support in the VMX handling code for this, add test cases to cover
it and add links to some documentation.

ESX supports two additional protocols: TELNETS and TLS. Add them to
the list of serial-over-TCP protocols.
2010-10-01 23:38:23 +02:00
Jamie Strandboge
091075a32b virt-aa-helper-test cleanups
Don't cat | sed, just sed.  Suggested by Eric Blake.
2010-09-30 15:01:36 -06:00
Jamie Strandboge
593e0072eb implement usb and pci hot attach in AppArmor driver
Description: Implement AppArmorSetSecurityHostdevLabel() and
AppArmorRestoreSecurityHostdevLabel() for hostdev and pcidev attach.

virt-aa-helper also has to be adjusted because *FileIterate() is used for pci
and usb devices and the corresponding XML for hot attached hostdev and pcidev
is not in the XML passed to virt-aa-helper. The new '-F filename' option is
added to append a rule to the profile as opposed to the existing '-f
filename', which rewrites the libvirt-<uuid>.files file anew. This new '-F'
option will append a rule to an existing libvirt-<uuid>.files if it exists,
otherwise it acts the same as '-f'.

load_profile() and reload_profile() have been adjusted to add an 'append'
argument, which when true will use '-F' instead of '-f' when executing
virt-aa-helper.

All existing calls to load_profile() and reload_profile() have been adjusted
to use the old behavior (ie append==false) except AppArmorSetSavedStateLabel()
where it made sense to use the new behavior.

This patch also adds tests for '-F'.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/640993
2010-09-30 14:54:56 -06:00
Stefan Berger
f095424600 nwfilter: Add a test case for testing the comment attribute
This patch adds a test case for testing the XML parser's and instantiator's
support of the comment attribute.
2010-09-30 16:09:04 -04:00
Jamie Strandboge
2e5e614e6b app-armor: add 'rw' for appropriate devices
Description: Check for VIR_DOMAIN_CHR_TYPE in serial ports and add 'rw' for
defined serial ports, parallel ports and channels

Bug-Ubuntu: LP: #578527, LP: #609055
2010-09-23 11:22:44 -06:00
Jamie Strandboge
874ad5f94a add extra tests to virt-aa-helper-test for new '-p' option 2010-09-23 11:16:24 -06:00
Matthias Bolte
0f9c246028 esx: Allow '-' in VMX entry names
Add a test for this.

Reported by Frank Dirks.
2010-09-23 10:37:10 +02:00
Eric Blake
9e3525df86 tests: silence qemuargv2xmltest noise
Before this patch, the testsuite was noisy:

TEST: qemuargv2xmltest
      ........................................ 40
      ................20:41:28.046: warning : qemuParseCommandLine:6565 : unknown QEMU argument '-unknown', adding to the qemu namespace
20:41:28.046: warning : qemuParseCommandLine:6565 : unknown QEMU argument 'parameter', adding to the qemu namespace
.                        57  OK
PASS: qemuargv2xmltest

It's not a real failure (which is why the test was completing
successfully), so much as an intentional warning to the user that use
of the qemu namespace has the potential for undefined effects that
leaked through the default logging behavior.  After this patch series,
all tests can access any logged data, and this particular test can
explicitly check for the presence or absence of the warning, such that
the test output becomes:

TEST: qemuargv2xmltest
      ........................................ 40
      .................                        57  OK
PASS: qemuargv2xmltest

* tests/testutils.h (virtTestLogContentAndReset): New prototype.
* tests/testutils.c (struct virtTestLogData): New struct.
(virtTestLogOutput, virtTestLogClose, virtTestLogContentAndReset):
New functions.
(virtTestMain): Always capture log data emitted during tests.
* tests/qemuargv2xmltest.c (testCompareXMLToArgvHelper, mymain):
Use flag to mark which tests expect noisy stderr.
(testCompareXMLToArgvFiles): Add parameter to test whether stderr
was appropriately silent.
2010-09-16 10:45:33 -06:00
Eric Blake
10c592801c tests: clean up qemuargv2xmltest
Since commit 107a7bd06b, the extraFlags argument was unused.

* tests/qemuargv2xmltest.c (DO_TEST): Drop extraFlags argument.
Adjust all callers.
2010-09-16 10:45:33 -06:00
Eric Blake
249a5b35f2 build: use portable sed expressions
* src/Makefile.am (libvirt.def, libvirt_qemu.def): '\}' and '\t'
are not required by POSIX.  Use '}' and literal tab instead.
(install-data-local): Avoid sed -i.
* tests/read-bufsiz: Likewise.
Reported by Mitchell Hashimoto.
2010-09-14 08:42:10 -06:00
Jiri Denemark
50d65bef66 tests: Fix preprocessor indentation 2010-09-13 13:35:04 +02:00
Cole Robinson
18af6f4e64 buf: Fix possible infinite loop in EscapeString, VSnprintf
The current code will go into an infinite loop if the printf generated
string is >= 1000, AND exactly 1 character smaller than the amount of free
space in the buffer. When this happens, we are dropped into the loop body,
but nothing will actually change, because count == (buf->size - buf->use - 1),
and virBufferGrow returns unchanged if count < (buf->size - buf->use)

Fix this by removing the '- 1' bit from 'size'. The *nprintf functions handle
the NULL byte for us anyways, so we shouldn't need to manually accommodate
for it.

Here's a bug where we are actually hitting this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=602772

v2: Eric's improvements: while -> if (), remove extra va_list variable,
    make sure we report buffer error if snprintf fails

v3: Add tests/virbuftest which reproduces the infinite loop before this
    patch, works correctly after
2010-09-10 10:05:43 -04:00
Matthias Bolte
847689129c esx: Rework datastore path parsing and handling
Instead of splitting the path part of a datastore path into
directory and file name, keep this in one piece. An example:

  "[datastore] directory/file"

was split into this before:

  datastoreName = "datastore"
  directoryName = "directory"
  fileName = "file"

Now it's split into this:

  datastoreName = "datastore"
  directoryName = "directory"
  directoryAndFileName = "directory/file"

This simplifies code using esxUtil_ParseDatastorePath, because
directoryAndFileName is used more often than fileName. Also the
old approach expected the datastore path to reference an actual
file, but this isn't always correct, especially when listing
volumes. In that case esxUtil_ParseDatastorePath is used to parse
a path that references a directory. This fails for a vpx://
connection because the vCenter returns directory paths with a
trailing '/'. The new approach is robust against this and the
actual decision if the datastore path should reference a file or
a directory is up to the caller of esxUtil_ParseDatastorePath.

Update the tests accordingly.
2010-09-03 00:38:22 +02:00
Jim Fehlig
14515a728d Add tests for Xen's blktap2 implementation
xml2sexpr and sexpr2xml tests for blktap2
2010-08-31 09:54:24 -06:00
Matthias Bolte
4aad5fbb96 esx: Map the .vmx annotation to the domain XML description
Take care of escaping '"' and '|' (the escape character).

Add tests for this.
2010-08-30 22:22:03 +02:00
Jiri Denemark
bb6543aaa4 xen tests: Fix PV-VFB tests with RHEL-5 API
RHEL-5 Xen doesn't support the old style vnc configuration. In sexpr, we
can't really check it with rhel5-api turned on. However, for XM
configuration files it's sufficient to use cfg version 1 instead of 2.
2010-08-24 10:10:16 +02:00
Jiri Denemark
e27277ebc8 xml2sexprtest: Remove graphics from unrelated tests
This caused unnecessary make check failures when libvirt is configured
--with-rhel5-api
2010-08-24 10:10:16 +02:00
Jiri Denemark
20311a9af8 xen tests: Fix missing "type ioemu" with rhel5-api
The most common cause of errors with rhel5-api turn on was missing
"(type ioemu)" in sexpr or its equivalent in XM configuration file. This
happens because the presence of that part in sexpr (or cfg) depends on
xen version the host is running. Let's avoid it by explicitly specifying
interface model which ensures "type ioemu" will always be emitted.

This patch adds

    <model type='e1000'/>

withing the interface element in all affected xml files. And

    (model 'e1000')

to all corresponding sexpr files with similar fix to cfg files. Such
configuration works regardless on Xen version.
2010-08-24 10:10:16 +02:00
Jiri Denemark
0eb009d273 nodeinfotest: Print libvirt error on failure
If linuxNodeInfoCPUPopulate() fails, the test would just print "FAILED"
which is not very informative. It's better to print the real error.
2010-08-24 10:10:16 +02:00
Patrick Dignan
20be699ee3 storage: add support for Vendor and Model in XML
I wrote a patch to add support for listing the Vendor and Model of a
storage pool in the storage pool XML.  This would allow vendor
extensions of specific devices.  The patch includes a test for the new
attributes as well.

Patrick Dignan
2010-08-19 15:58:43 -06:00
Matthias Bolte
7c0cbe0279 esx: Explicitly disable unused floppy devices
floppy0.present defaults to true. Therefore, it needs to be
explicitly set to false when the XML config doesn't specify the
corresponding floppy device.

Also update tests accordingly.
2010-08-14 20:16:14 +02:00
Matthias Bolte
3de8245560 esx: Split VMX code into a general and an ESX specific part
Introduce esxVMX_Context containing functions pointers to
glue both parts together in a generic way.

Move the ESX specific part to esx_driver.c.

This is a step towards making the VMX code reusable in a
potential VMware Workstation and VMware Player driver.
2010-08-11 16:17:50 +02:00
Diego Elio Pettenò
2bd24003b9 build-sys: only build the test programs during the check phase.
This avoids building the tests when testing libvirt is not the aim.
2010-08-10 07:18:44 -06:00
Philipp Hahn
ab8b2bea47 bootloader_args is named bootargs in xen-xm
According to <xen-3.4.3/tools/python/xen/xm/create.py:158>
	gopts.var('bootargs', val='NAME',
			  fn=set_value, default=None,
			  use="Arguments to pass to boot loader")
the "bootloader_args" parameter needs to be translated into "bootargs"
when using "virsh domxml-to-native xen-xm".
The reverse direction (domxml-from-native) is already okay.

This patch fixes domxml-to-native and adds two test files to catch this
problem.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2010-08-09 16:11:25 -06:00
Daniel Veillard
634ea3faae Do not use boot=on on IDE device
the followup on the boot=on problem, basically it's not needed to
specify it when booting out of IDE devices when using KVM
* src/qemu/qemu_conf.c: do not use boot=on for IDE devices
* tests/qemuxml2argvdata/qemuxml2argv*.args: this changes the output
  for 5 of the tests
2010-08-04 18:31:44 +02:00
Matthias Bolte
5254546bba esx: Make storage pool lookup by name and UUID more robust
Don't rely on summary.url anymore, because its value is different
between an esx:// and vpx:// connection. Use host.mountInfo.path
instead.

Don't fallback to lookup by UUID (actually lookup by absolute path)
in esxVI_LookupDatastoreByName when lookup by name fails. Add a
seperate function for this: esxVI_LookupDatastoreByAbsolutePath
2010-08-02 22:25:15 +02:00
Eric Blake
e7064aa6a2 build: restore operation of bit-rotted 'make cov'
'./autobuild.sh' with lcov installed discovered that our
coverage support has been bit-rotting for a while.  This
restores it back to a successful state, although I have
not yet spent any time looking through the resulting files to
look for low-hanging fruit in the unit test coverage front.

* configure.ac: Clear COMPILER_FLAGS at right place.
* Makefile.am (cov): Newer genhtml no longer likes plain -s.
* m4/compiler-flags.m4 (gl_COMPILER_FLAGS): Don't AC_SUBST
COMPILER_FLAGS; it is a shell variable for use in configure only.
* src/Makefile.am (AM_CFLAGS, AM_LDFLAGS): New variables, to make
it easier to provide global flag additions.  Use throughout, to
uniformly apply coverage flags.
* .gitignore: Globally ignore gcov output.
* daemon/.gitignore: Simplify.
* src/.gitignore: Likewise.
* tests/.gitignore: Likewise.
2010-07-29 13:41:25 -06:00
Cole Robinson
82b6d7600e qemu: virtio console support
Enable specifying a virtio console device with:

<console type='pty'>
  <target type='virtio'/>
</console>
2010-07-28 16:48:00 -04:00
Cole Robinson
6b24755235 domain conf: Track <console> target type
All <console> devices now export a <target> type attribute. QEMU defaults
to 'serial', UML defaults to 'uml, xen can be either 'serial' or 'xen'
depending on fullvirt. Understandably there is lots of test fallout.

This will be used to differentiate between a serial vs. virtio console for
QEMU.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2010-07-28 16:47:59 -04:00
Cole Robinson
b2a4a383d3 tests: Test qemuxml2xml when expected xml changes
Add tests for auto memballon, implicit IDE, SCSI, virtio channel
controllers, and console/serial back compat.

Additionally, an explicit qemuxml2argvtest for scsi disks is added.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2010-07-28 16:47:56 -04:00
Cole Robinson
4f24ca01e8 qemu: Allow setting boot menu on/off
Add a new element to the <os> block:

  <bootmenu enable="yes|no"/>

Which maps to -boot,menu=on|off on the QEMU command line.

I decided to use an explicit 'enable' attribute rather than just make the
bootmenu element boolean. This allows us to treat lack of a bootmenu element
as 'use hypervisor default'.
2010-07-27 16:38:32 -04:00
Matthias Bolte
afb85c5889 esx: Allow 'vmpvscsi' as SCSI controller model 2010-07-24 17:31:04 +02:00
Matthias Bolte
8c145200e7 secaatest: Fix compilation
Since 68719c4bdd virSecurityDriverStartup
takes and additional parameter to control disk format probing.

Pass false as third parameter.
2010-07-24 17:15:11 +02:00
Matthias Bolte
8f86eaca49 virt-aa-helper-test: Fix failure due to the new disk format probing option
Commit 68719c4bdd added the disk format
probing option. This makes virt-aa-helper-test fail because the domain
config didn't specifiy the disk format and it didn't pass '-p 1' to
virt-aa-helper to allow disk format probing.

Specify the disk format in the domain config. Pass the '-p 1' option
to virt-aa-helper for the test case with two disks. This way this test
also covers this new option.
2010-07-24 17:15:11 +02:00
Chris Lalancette
a71be01f04 Add tests for the new Qemu namespace XML.
Thanks to DV for knocking together the Relax-NG changes
quickly for me.

Changes since v1:
 - Change the domain.rng to correspond to the new schema
 - Don't allocate caps->ns in testQemuCapsInit since it is a static table

Changes since v2:
 - Change domain.rng to add restrictions on allowed environment names

Changes since v3:
 - Remove a bogus comment in the tests

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-07-23 17:30:45 -04:00
Daniel P. Berrange
0e308c2c9f Re-arrange PCI device address assignment to match QEMU's default
To try and ensure that people upgrading from old QEMU get guests
with the same PCI device ordering, change the way we assign addrs
to match QEMU's default order. This should make Windows less
annoyed.

* src/qemu/qemu_conf.c: Follow QEMU's default PCI ordering
  logic when assigning addresses
* tests/*.args: Update for changed PCI addresses
2010-07-21 11:35:21 +01:00
Daniel P. Berrange
b2f1863533 Explicitly represent balloon device in XML and handle PCI address
To allow compatibility with older QEMU PCI device slot assignment
it is necessary to explicitly track the balloon device in the
XML. This introduces a new device

   <memballoon model='virtio|xen'/>

It can also have a PCI address, auto-assigned if necessary.

The memballoon will be automatically added to all Xen and QEMU
guests by default.

* docs/schemas/domain.rng: Add <memballoon> element
* src/conf/domain_conf.c, src/conf/domain_conf.h: parsing
  and formatting for memballoon device. Always add a memory
  balloon device to Xen/QEMU if none exists in XML
* src/libvirt_private.syms: Export memballoon model APIs
* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Honour the
  PCI device address in memory balloon device
* tests/*: Update to test new functionality
2010-07-21 11:33:11 +01:00
Daniel P. Berrange
68719c4bdd Disable all disk probing in QEMU driver & add config option to re-enable
Disk format probing is now disabled by default. A new config
option in /etc/qemu/qemu.conf will re-enable it for existing
deployments where this causes trouble
2010-07-19 18:25:13 +01:00
Jiri Denemark
af53714f47 cpu: Add support for CPU vendor
By specifying <vendor> element in CPU requirements a guest can be
restricted to run only on CPUs by a given vendor. Host CPU vendor is
also specified in capabilities XML.

The vendor is checked when migrating a guest but it's not forced, i.e.,
guests configured without <vendor> element can be freely migrated.
2010-07-07 17:26:00 +02:00
Daniel P. Berrange
39f8af3880 Fix test case failure due to missing -nodefconfig
The previous change which split -nodefconfig probing off
from -device broke the test case because it missed adding
the QEMUD_CMD_FLAG_NODEFCONFIG to the test

* src/util/bridge.c: Set QEMUD_CMD_FLAG_NODEFCONFIG for all
  configs with QEMUD_CMD_FLAG_DEVICE set
2010-06-25 14:40:24 +01:00
Matthias Bolte
d72d92565b esx: Add support for the controller element
Also don't abuse the disk driver name to specify the SCSI controller
model anymore:

  <driver name='buslogic'/>

Use the newly added model attribute of the controller element for this:

  <controller type='scsi' index='0' model='buslogic'/>

The disk driver name approach is deprecated now, but still works for
backward compatibility reasons.

Update the documentation and tests accordingly.

Fix usage of the words controller and id in the VMX handling code. Use
controller, bus and unit properly.
2010-06-24 14:56:04 +02:00
Daniel P. Berrange
f310b25341 Add '-nodefconfig' command line arg to QEMU
We already use the '-nodefaults' command line arg with QEMU to stop
it adding any default devices to guests. Unfortunately, QEMU will
load global config files from /etc/qemu that may also add default
devices. These aren't blocked by '-nodefaults', so we need to also
add the '-nodefconfig' arg to prevent that.

Unfortunately these global config files are also used to define
custom CPU models. So in blocking global hardware device addition
we also block definitions of new CPU models. Libvirt doesn't know
about these custom CPU models though, so it would never make use
of them anyway. Thus blocking them via -nodefconfig isn't a show
stopping problem. We would need to expand libvirt's own CPU model
XML database to support these instead.

* src/qemu/qemu_conf.c: Add '-nodefconfig' if available
* tests/qemuxml2argvdata/: Add '-nodefconfig' to all data files which
  have '-nodefaults' present
2010-06-23 14:08:05 +01:00
Stefan Berger
51d3fb0276 nwfilter: add XML attribute to control iptables state match
This patch adds an optional XML attribute to a nwfilter rule to give the user control over whether the rule is supposed to be using the iptables state match or not. A rule may now look like shown in the XML below with the statematch attribute either having value '0' or 'false' (case-insensitive).

[...]
<rule action='accept' direction='in' statematch='false'>
<tcp srcmacaddr='1:2:3:4:5:6'
           srcipaddr='10.1.2.3' srcipmask='32'
           dscp='33'
           srcportstart='20' srcportend='21'
           dstportstart='100' dstportend='1111'/>
</rule>
[...]

I am also extending the nwfilter schema and add this attribute to a test case.
2010-06-17 14:12:34 -04:00
Justin Clift
c2160b137d virsh: ensure persistence and autostart are shown for dominfo and pool-info
This patch adds the persistence status (yes/no) to the output of the virsh
dominfo and pool-info commands.  This patch also adds the autostart status
to the output of the virsh pool-info command.

Red Hat BZ for this:

  https://bugzilla.redhat.com/show_bug.cgi?id=603696
2010-06-17 11:57:54 -06:00
Matthias Bolte
02d57c2bce esx: Update case insensitive .vmx tests
Commit b9efc7dc3b made virFileHasSuffix
case insensitive. Honor this in the tests by switching vmdk to VMDK.
2010-06-16 23:06:12 +02:00
Eric Blake
fb8552f83a maint: simplify some ignore files
* .hgignore: Delete, no longer used.
* examples/python/.gitignore: Delete, covered globally.
* include/.gitignore: Likewise.
* python/tests/.gitignore: Likewise.
* docs/schemas/.gitignore: Likewise.
* tests/xml2sexprdata/.gitignore: Likewise.
* tests/sexpr2xmldata/.gitignore: Likewise.
* tests/confdata/.gitignore: Likewise.
* tests/xencapsdata/.gitignore: Likewise.
* tests/xmconfigdata/.gitignore: Likewise.
* tests/xml2sexprdata/.gitignore: Likewise.
2010-06-15 07:31:10 -06:00
David Allan
77da2487ea Add multiIQN tests
* Fix broken rng schema
* Add test input & output files
2010-06-08 13:14:26 -04:00
Daniel P. Berrange
9cb08020e1 Fix test breakage from virtio serial changes
The virtio serial changes broke the test suite because they forgot
to add the new address attribute to the domain XML schema. The
xml2xml test also broke because the XML no longer roundtrips. This
is due to testing of auto-addition of <controller> elements. Split
that test case off into a separate XML file to avoid breakage

* docs/schemas/domain.rng: Allow port number for virtio serial addresses
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Revert to
  a simple config to avoid breaking xml2xml test
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.xml,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-auto.args: Add
  complex test case for auto-controller addition for xml2argv test
* tests/qemuxml2argvtest.c: Add channel-virtio-auto test
2010-06-08 16:31:50 +01:00
Daniel P. Berrange
f4f91e7b24 Fix auto-adding of virtio serial controllers
The domain parsing code would auto-add a virtio serial controller
if it saw any virtio serial channel defined. Unfortunately it
always added a controller with index=0, even if the channel address
specified an index != 0. It only added one controller, even if
multiple controllers were referenced by channels. Finally, it let
the ports+vectors parameters initialize to zero instead of -1, which
prevented the controllers accepting any ports.

* src/conf/domain_conf.c: Initialize ports+vectors when adding
  virtio serial controllers. Add all neccessary virtio serial
  controllers, instead of hardcoding controller 0
* qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
  qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Expand to
  test controller auto-add behaviour
2010-06-08 15:08:21 +01:00
Daniel P. Berrange
2e56cfa7d2 Include port number with virtio serial devices
To ensure that the device addressing scheme is stable across
hotplug/unplug, all virtio serial channels needs to have an
associated port number in their address. This is then specified
to QEMU using the nr=NNN parameter

* src/conf/domain_conf.c, src/conf/domain_conf.h: Parsing
  for port number in vioserial address types.
* src/qemu/qemu_conf.c: Set 'nr=NNN' parameter with virtio
  serial port number
* tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args,
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: Expand
  data set to ensure coverage of port addressing
2010-06-08 15:08:15 +01:00
Cole Robinson
953809dbe4 xen: Fix chardev listen sexpr formatting
'listen' isn't a valid qemu-dm option, as reported a long time ago here:

https://bugzilla.redhat.com/show_bug.cgi?id=492958

Matches the near identical logic in qemu_conf.c

v2: When parsing sexpr, only match on ",server", rather than
    full ',server,nowait'.
2010-05-27 14:26:05 -04:00
Jim Meyering
572c6cc10a tests: avoid new failure of the daemon-conf test
* tests/daemon-conf: Accommodate the fact that out template,
daemon/libvirtd.conf now contains an invalid host_uuid.
Convert it to a valid one before the final libvirtd-running
test that must terminate normally.
2010-05-25 15:53:19 -06:00
Stefan Berger
a8f75d2c7d vepa: parsing for 802.1Qb{g|h} XML
This patch parses the following two XML descriptions, one for
802.1Qbg and one for 802.1Qbh, and stores the data internally.
The actual triggering of the switch setup protocol has not been
implemented here but the relevant code to do that should go into
the functions associatePortProfileId() and disassociatePortProfileId().

   <interface type='direct'>
      <source dev='eth0.100' mode='vepa'/>
      <model type='virtio'/>
      <virtualport type='802.1Qbg'>
        <parameters managerid='12' typeid='0x123456' typeidversion='1'
         instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
      </virtualport>
      <filterref filter='clean-traffic'/>
    </interface>

    <interface type='direct'>
      <source dev='eth0.100' mode='vepa'/>
      <model type='virtio'/>
      <virtualport type='802.1Qbh'>
        <parameters profileid='my_profile'/>
      </virtualport>
    </interface>

I'd suggest to use this patch as a base for triggering the setup
protocol with the 802.1Qb{g|h} switch.

Several rounds of changes were made to this patch. The
following is a list of these changes.
- Renamed structure virVirtualPortProfileDef to virVirtualPortProfileParams
  as per Daniel Berrange's request
- Addressing Daniel Berrange's comments:
 - removing macvtap.h's dependency on domain_conf.h by
   moving the virVirtualPortProfileDef structure into macvtap.h
   and not passing virtDomainNetDefPtr to any functions in
   macvtap.c
- Addressed most of Chris Wright's comments:
  - indicating error in case virtualport XML node cannot be parsed
    properly
  - parsing hex and decimal numbers using virStrToLong_ui() with
    parameter '0' for base
  - tgifname (target interface name) variable wasn't necessary
    to pass to openMacvtapTap function anymore
- assigning the virtual port data structure to the virDomainNetDef
  only if it was previously parsed
- make sure that the error code returned by openMacvtapTap() is a negative n
  in case the associatePortProfileId() function failed.
- renaming vsi in the XML to virtualport
- replace all occurrences of vsi in the source as well
- removing mode and MAC address parameters from the functions that
  will communicate with the hareware diretctly or indirectly
- moving the associate and disassociate functions to the end of the
  file for subsequent patches to easier make them generally available
  for export
- passing the macvtap interface name rather than the link device since
  this otherwise gives funny side effects when using netlink messages
  where IFLA_IFNAME and IFLA_ADDRESS are specified and the link dev
  all of a sudden gets the MAC address of the macvtap interface.
- Removing rc = -1 error indications in the case of 802.1Qbg|h setup in case
  we wanted to use hook scripts for the setup and so the setup doesn't fail
  here.
- if instance ID UUID is not supplied it will automatically be generated
  - adapted schema to make instance ID UUID optional
  - added test case
- parser and XML generator have been separated into their own
  functions so they can be re-used elsewhere (passthrough case
  for example)
- Adapted XML parser and generator support the above shown type
  (802.1Qbg, 802.1Qbh).
- Adapted schema to above XML
- Adapted test XML to above XML
- Passing through the VM's UUID which seems to be necessary for
  802.1Qbh -- sorry no host UUID
- adding virtual function ID to association function, in case it's
  necessary to use (for SR-IOV)
2010-05-25 17:37:00 -04:00
Cole Robinson
a7fb2258ca storage: Sanitize pool target paths
Spurious / in a pool target path makes life difficult for apps using the
GetVolByPath, and doing other path based comparisons with pools. This
has caused a few issues for virt-manager users:

https://bugzilla.redhat.com/show_bug.cgi?id=494005
https://bugzilla.redhat.com/show_bug.cgi?id=593565

Add a new util API which removes spurious /, virFileSanitizePath. Sanitize
target paths when parsing pool XML, and for paths passed to GetVolByPath.

v2: Leading // must be preserved, properly sanitize path=/, sanitize
    away /./ -> /

v3: Properly handle starting ./ and ending /.

v4: Drop all '.' handling, just sanitize / for now.
2010-05-25 12:30:44 -04:00
Daniel P. Berrange
60881161ea Expose a host UUID in the capabilities XML
Allow for a host UUID in the capabilities XML. Local drivers
will initialize this from the SMBIOS data. If a sanity check
shows SMBIOS uuid is invalid, allow an override from the
libvirtd.conf configuration file

* daemon/libvirtd.c, daemon/libvirtd.conf: Support a host_uuid
  configuration option
* docs/schemas/capability.rng: Add optional host uuid field
* src/conf/capabilities.c, src/conf/capabilities.h: Include
  host UUID in XML
* src/libvirt_private.syms: Export new uuid.h functions
* src/lxc/lxc_conf.c, src/qemu/qemu_driver.c,
  src/uml/uml_conf.c: Set host UUID in capabilities
* src/util/uuid.c, src/util/uuid.h: Support for host UUIDs
* src/node_device/node_device_udev.c: Use the host UUID functions
* tests/confdata/libvirtd.conf, tests/confdata/libvirtd.out: Add
  new host_uuid config option to test
2010-05-25 17:09:18 +01:00
Matthias Bolte
9c563e76e8 build: Distribute the whole tests/qemuhelpdata directory
Instead of distributing the individual files.

Now it's less error prone and consistent with the rest of
the data directories in the tests directory.
2010-05-21 20:08:57 +02:00
Chris Lalancette
54971d9170 Domain snapshot RNG and tests.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-05-20 13:50:03 -04:00
Eric Blake
92036c2edf build: distribute missing file
Commit f30ccb2458 was incomplete.

* .gitignore: Ignore intermediate directory during failed 'make
distcheck'.
* tests/Makefile.am (qemuhelpdata): Distribute new file.
2010-05-19 16:28:49 -06:00
Jim Meyering
6ab131bae2 tests: do not ignore virInitialize failure
* tests/nodeinfotest.c (mymain): Do not ignore virInitialize failure.
Most other callers of virInitialize test for failure.
2010-05-18 19:23:32 +02:00
Jim Meyering
43beb82eca linuxNodeInfoCPUPopulate: avoid used-uninitialized via a test
* tests/nodeinfotest.c (linuxTestCompareFiles): Don't use
nodeinfo->member uninitialized.  linuxNodeInfoCPUPopulate requires
that some of its nodeinfo members (including threads) be initialized
upon input.  The nodeinfotest.c program lacked the initialization,
while the only other use (nodeGetInfo) did perform it.
It's not trivial to move the initialization into the function,
since nodeGetInfo sets at least one member after clearing the
buffer but before calling linuxNodeInfoCPUPopulate.
2010-05-18 19:23:32 +02:00
Eric Blake
f30ccb2458 qemu_conf: fix flag value
(gdb) p/x QEMUD_CMD_FLAG_VNET_HOST
$7 = 0xffffffff80000000

Oops - that meant we were incorrectly setting QEMU_CMD_FLAG_RTC_TD_HACK
for qemu-kvm-0.12.3 (and probably botching a few other settings as well).

Fixes Red Hat BZ#592070

* src/qemu/qemu_conf.h (QEMUD_CMD_FLAG_VNET_HOST): Avoid sign
extension.
* tests/qemuhelpdata/qemu-kvm-0.12.3: New file.
* tests/qemuhelptest.c (mymain): Add another case.
2010-05-17 16:28:02 -06:00
Cole Robinson
df5944ff02 tests: Skip daemon-conf test if dir exceeds UNIX_PATH_MAX
The max path length for unix sockets is pretty small (108, see man 7 unix).
If 'make check' is run from a directory that exceeds this, one of the tests
will fail, and in such a way that requires manually editting the test to
determine why.

There are certainly other ways to handle this, but I've chosen just to skip
the offending test if we will exceed the length limitation.

v2: Drop bashism, use test infrastructure to warn and skip
2010-05-17 15:01:59 -04:00
Jim Meyering
c2c4abb43b tests: use GPLv2+, not GPLv3
* tests/cpuset: Change from GPLv3 to GPLv2+
* tests/read-bufsiz: Likewise.
* tests/read-non-seekable: Likewise.
* tests/start: Likewise.
* tests/undefine: Likewise.
* tests/vcpupin: Likewise.
* tests/virsh-all: Likewise.
* tests/virsh-schedinfo: Likewise.
* tests/virsh-synopsis: Likewise.
2010-05-12 08:41:10 +02:00
Jim Meyering
e915962a04 tests: correct PATH in new test, for when running manually
* tests/virsh-schedinfo: This test sets PATH internally, just in
case you're running it manually.  Normally, the PATH setting from
tests/Makefile.am's TESTS_ENVIRONMENT is sufficient.  Prepend the
correct directory, and take advantage of the PATH setting in one
more case.
2010-05-11 18:01:11 +02:00
Jim Meyering
c5be8bcb8f tests: adjust copyrights on scripts: s/FSF/Red Hat/
* tests/cpuset: Change copyright holder from FSF to Red Hat, Inc.
* tests/read-bufsiz: Likewise.
* tests/read-non-seekable: Likewise.
* tests/start: Likewise.
* tests/undefine: Likewise.
* tests/vcpupin: Likewise.
* tests/virsh-all: Likewise.
* tests/virsh-synopsis: Likewise.
2010-05-11 16:43:07 +02:00
Jim Meyering
9a641564fb virsh: schedinfo --set invalid=value would simply ignore the option
For example, virsh -c test:///default schedinfo 1 --set P=k would
mistakenly exit successfully, giving no indication that it had failed
to set the scheduling parameter "P".
* tools/virsh.c (cmdSchedinfo): Diagnose an invalid --set j=k option,
rather than silently ignoring it.
* tests/virsh-schedinfo: New test for the above.
* tests/Makefile.am (test_scripts): Add it.
Reported by Jintao Yang in http://bugzilla.redhat.com/586632
2010-05-11 16:37:15 +02:00
Stefan Berger
aea68ce906 nwfilter: add support for RAPR protocol
This patch adds support for the RARP protocol. This may be needed due to
qemu sending out a RARP packet (at least that's what it seems to want to
do even though the protocol id is wrong) when migration finishes and
we'd need a rule to let the packets pass.

Unfortunately my installation of ebtables does not understand -p RARP
and also seems to otherwise depend on strings in /etc/ethertype
translated to protocol identifiers. Therefore I need to pass -p 0x8035
for RARP. To generally get rid of the dependency of that file I switch
all so far supported protocols to use their protocol identifier in the
-p parameter rather than the string.

I am also extending the schema and added a test case.

changes from v1 to v2:
- added test case into patch
2010-04-27 07:26:12 -04:00
David Allan
1b9347b5f1 Fix indentation for storage conf XML
* virStorageEncryptionFormat is called from both
  virDomainDiskDefFormat and virStorageVolTargetDefFormat.  The proper
  indentation in the generated XML depends on the caller.  My earlier
  patch to fix the incorrect indentation for the domain XML broke the
  indentation for the storage XML.  This patch adopts Laine's
  suggestion of requring the caller of virStorageEncryptionFormat to
  provide an unsigned int with the number of spaces the output should
  be indented.  The patch modifies both callers to provide the
  additional argument.

* Add a regression test for the domain XML

* src/conf/domain_conf.c src/conf/storage_conf.c
  src/conf/storage_encryption_conf.c src/conf/storage_encryption_conf.h:
  change the indentation code
* tests/qemuxml2xmltest.c
  tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.args
  tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml: add a regression test
2010-04-27 12:01:32 +02:00
Stefan Berger
5c7c755f50 nwfilter: enable hex number inputs in filter XML
With this patch I want to enable hex number inputs in the filter XML. A
number that was entered as hex is also printed as hex unless a string
representing the meaning can be found.

I am also extending the schema and adding a test case. A problem with
the DSCP value is fixed on the way as well.

Changes from V1 to V2:

- using asHex boolean in all printf type of functions to select the
output format in hex or decimal format
2010-04-26 13:50:40 -04:00
Stefan Berger
9db01465e5 nwfilter: extend schema + add testcase w/ connlimit-above
I am extending the schema with the recently added connlimit-above
attribute and adding a test case for it to the test suite.
2010-04-23 11:42:39 -04:00
Eric Blake
2788f4d1d4 testutilsqemu: avoid uninitialized variable
* tests/testutilsqemu.c (testQemuCapsInit): Initialize variables.
2010-04-22 09:00:30 -06:00
Jiri Denemark
b34e082079 Fake host CPU for qemu tests 2010-04-22 10:21:05 +02:00
Matthias Bolte
1d8099f4b6 esx: Fix virtualHW.version generation
The supported virtualHW.version doesn't depend on the API version,
but on the product version.
2010-04-21 00:37:46 +02:00
Matthias Bolte
c6375aa796 esx: Add support for the VMXNET 2 (Enhanced) NIC model
Add a test case and document it.
2010-04-20 20:58:24 +02:00
Eric Blake
5e06ef743a virt-aa-helper-test: avoid non-portable echo -n
* tests/virt-aa-helper-test (testme): Use printf instead.
2010-04-14 11:17:18 -06:00