Commit Graph

530 Commits

Author SHA1 Message Date
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