Commit Graph

64 Commits

Author SHA1 Message Date
Daniel P. Berrange
eee6eb666c Remove test case average timing
The test case average timing code has not been used by any test
case ever. Delete it to remove complexity.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-10-08 12:39:30 +01:00
Michal Privoznik
dc6f2dadac Introduce OOM reporting to virAsprintf
Actually, I'm turning this function into a macro as filename,
function name and line number needs to be passed. The new
function virAsprintfInternal is introduced with the extended set
of arguments.
2013-07-10 11:07:31 +02:00
Michal Privoznik
7c9a2d88cd virutil: Move string related functions to virstring.c
The source code base needs to be adapted as well. Some files
include virutil.h just for the string related functions (here,
the include is substituted to match the new file), some include
virutil.h without any need (here, the include is removed), and
some require both.
2013-05-02 16:56:55 +02:00
Peter Krempa
482e5f159c virCaps: get rid of defaultConsoleTargetType callback
This patch refactors various places to allow removing of the
defaultConsoleTargetType callback from the virCaps structure.

A new console character device target type is introduced -
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was
specified in the XML. This type is at the end converted to the standard
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are
different from this default have to be processed separately in the
device post parse callback.
2013-04-04 22:42:39 +02:00
Peter Krempa
ad0d10b2b1 conf callback: Rearrange function parameters
Move the xmlopt and caps arguments to the end of the argument list.
2013-04-04 22:41:19 +02:00
Peter Krempa
e84b19316a maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption
This patch is the result of running:

for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
  sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
done

and a few manual tweaks.
2013-04-04 22:18:56 +02:00
Peter Krempa
27cf98e2d1 virCaps: conf: start splitting out irrelevat data
The virCaps structure gathered a ton of irrelevant data over time that.
The original reason is that it was propagated to the XML parser
functions.

This patch aims to create a new data structure virDomainXMLConf that
will contain immutable data that are used by the XML parser. This will
allow two things we need:

1) Get rid of the stuff from virCaps

2) Allow us to add callbacks to check and add driver specific stuff
after domain XML is parsed.

This first attempt removes pointers to private data allocation functions
to this new structure and update all callers and function that require
them.
2013-03-13 09:27:14 +01:00
Daniel P. Berrange
fed92f08db Turn virCapabilities into a virObject
To enable virCapabilities instances to be reference counted,
turn it into a virObject. All cases of virCapabilitiesFree
turn into virObjectUnref

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-02-08 11:34:26 +00:00
Martin Kletzander
9943276fd2 Cleanup for a return statement in source files
Return statements with parameter enclosed in parentheses were modified
and parentheses were removed. The whole change was scripted, here is how:

List of files was obtained using this command:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
grep -e '\.[ch]$' -e '\.py$'

Found files were modified with this command:
sed -i -e                                                                 \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'

Then checked for nonsense.

The whole command looks like this:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e                            \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
2012-03-26 14:45:22 -06:00
Eric Blake
8fe454ce90 build: expand rule to cover testsuite
The bulk of this patch was done with:

sed -i 's/\(\bfree *(/VIR_FREE(/g' tests/*.c

followed by fixing the few compile errors that resulted.

* cfg.mk (exclude_file_name_regexp--sc_prohibit_raw_allocation):
Remove tests from exemption.
* tests/testutils.h: Add common header.
* tests/commandhelper.c: Fix offenders.
* tests/cputest.c: Likewise.
* tests/domainsnapshotxml2xmltest.c: Likewise.
* tests/interfacexml2xmltest.c: Likewise.
* tests/networkxml2argvtest.c: Likewise.
* tests/networkxml2xmltest.c: Likewise.
* tests/nodedevxml2xmltest.c: Likewise.
* tests/nodeinfotest.c: Likewise.
* tests/nwfilterxml2xmltest.c: Likewise.
* tests/qemuargv2xmltest.c: Likewise.
* tests/qemuxml2argvtest.c: Likewise.
* tests/qemuxml2xmltest.c: Likewise.
* tests/qemuxmlnstest.c: Likewise.
* tests/qparamtest.c: Likewise.
* tests/sexpr2xmltest.c: Likewise.
* tests/storagepoolxml2xmltest.c: Likewise.
* tests/storagevolxml2xmltest.c: Likewise.
* tests/testutils.c: Likewise.
* tests/virshtest.c: Likewise.
* tests/xencapstest.c: Likewise.
* tests/xmconfigtest.c: Likewise.
* tests/xml2sexprtest.c: Likewise.
2012-02-03 10:41:46 -07:00
Matthias Bolte
aa14709a47 Add domain type checking
The drivers were accepting domain configs without checking if those
were actually meant for them. For example the LXC driver happily
accepts configs with type QEMU.

Add a check for the expected domain types to the virDomainDefParse*
functions.
2011-07-11 19:38:51 +02:00
Jim Fehlig
eb3143154e Do not drop kernel cmdline for xen pv domains
Kernel cmdline args can be passed to xen pv domains even when a
bootloader is specified.  The current config-to-sxpr mapping
ignores cmdline when bootloader is present.

Since the xend sub-driver is used with many xen toolstack versions,
this patch takes conservative approach of adding an else block to
existing !def->os.bootloader, and only appends sxpr if def->os.cmdline
is non-NULL.

V2: Fix existing testcase broken by this patch and add new testcases
2011-07-11 09:11:15 -06:00
Paolo Bonzini
e547e44cb0 xen: parse and generate hpet item in sxpr
Recent versions of Xen disable the virtual HPET by default.  This is
usually more precise because tick policies are not implemented for
the HPET in Xen.  However, there may be several reasons to control
the HPET manually: 1) to test the emulation; 2) because distros may
provide the knob while leaving the default to "enabled" for compatibility
reasons.

This patch provides support for the hpet item in both sexpr and xm
formats, and translates it to a <timer> element.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-05-10 16:16:55 -06:00
Matthias Bolte
9ba4eb3c08 tests: Lower stack usage below 4096 bytes
Make virtTestLoadFile allocate the buffer to read the file into.

Fix logic error in virtTestLoadFile, stop reading on the first empty line.

Use virFileReadLimFD in virtTestCaptureProgramOutput to avoid manual
buffer handling.
2011-04-30 19:59:52 +02:00
Eric Blake
20986e58aa tests: simplify common setup
A few of the tests were missing basic sanity checks, while most
of them were doing copy-and-paste initialization (in fact, some
of them pasted the argc > 1 check more than once!).  It's much
nicer to do things in one common place, and minimizes the size of
the next patch that fixes getcwd usage.

* tests/testutils.h (EXIT_AM_HARDFAIL): New define.
(progname, abs_srcdir): Define for all tests.
(VIRT_TEST_MAIN): Change callback signature.
* tests/testutils.c (virtTestMain): Do more common init.
* tests/commandtest.c (mymain): Simplify.
* tests/cputest.c (mymain): Likewise.
* tests/esxutilstest.c (mymain): Likewise.
* tests/eventtest.c (mymain): Likewise.
* tests/hashtest.c (mymain): Likewise.
* tests/networkxml2xmltest.c (mymain): Likewise.
* tests/nodedevxml2xmltest.c (myname): Likewise.
* tests/nodeinfotest.c (mymain): Likewise.
* tests/nwfilterxml2xmltest.c (mymain): Likewise.
* tests/qemuargv2xmltest.c (mymain): Likewise.
* tests/qemuhelptest.c (mymain): Likewise.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2xmltest.c (mymain): Likewise.
* tests/qparamtest.c (mymain): Likewise.
* tests/sexpr2xmltest.c (mymain): Likewise.
* tests/sockettest.c (mymain): Likewise.
* tests/statstest.c (mymain): Likewise.
* tests/storagepoolxml2xmltest.c (mymain): Likewise.
* tests/storagevolxml2xmltest.c (mymain): Likewise.
* tests/virbuftest.c (mymain): Likewise.
* tests/virshtest.c (mymain): Likewise.
* tests/vmx2xmltest.c (mymain): Likewise.
* tests/xencapstest.c (mymain): Likewise.
* tests/xmconfigtest.c (mymain): Likewise.
* tests/xml2sexprtest.c (mymain): Likewise.
* tests/xml2vmxtest.c (mymain): Likewise.
2011-04-29 10:21:20 -06:00
Michal Novotny
3ee7cf6c9b Add support for multiple serial ports into the Xen driver
this is the patch to add support for multiple serial ports to the
libvirt Xen driver. It support both old style (serial = "pty") and
new style (serial = [ "/dev/ttyS0", "/dev/ttyS1" ]) definition and
tests for xml2sexpr, sexpr2xml and xmconfig have been added as well.

Written and tested on RHEL-5 Xen dom0 and working as designed but
the Xen version have to have patch for RHBZ #614004 but this patch
is for upstream version of libvirt.

Also, this patch is addressing issue described in RHBZ #670789.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2011-02-25 11:33:27 -07:00
Markus Groß
3e53c7f954 Renamed functions in xenxs 2011-02-21 11:15:08 -07:00
Markus Groß
2f2a88b998 Moved SEXPR formatting functions to xenxs 2011-02-21 11:07:43 -07:00
Cole Robinson
3afe5d402b xend: Escape reserved sexpr characters
If we don't escape ' or \ xend can't parse the generated sexpr. This
might over apply the EscapeSexpr routine, but it shouldn't hurt.
2010-11-22 16:43:29 -05: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
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
Jim Fehlig
14515a728d Add tests for Xen's blktap2 implementation
xml2sexpr and sexpr2xml tests for blktap2
2010-08-31 09:54:24 -06: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
Daniel P. Berrange
65842bf669 Remove virConnectPtr from all domain XML parsing/formatting APIs 2010-02-10 11:49:23 +00:00
Jiri Denemark
81ea6e4d9f Tests for interface type/model configuration
add a set of tests for Xen interface type and model configurations
2009-12-04 17:01:34 +01:00
Daniel P. Berrange
f7a107f73e Move xen driver code into src/xen/ directory
* src/Makefile.am, src/proxy_internal.c, src/proxy_internal.h
  src/sexpr.c, src/sexpr.h, src/xen_unified.c, src/xen_unified.h,
  src/xen_internal.c, src/xen_internal.h, src/xen_inotify.c,
  src/xen_inotify.h, src/xend_internal.c, src/xend_internal.h,
  src/xm_internal.c, src/xm_internal.h, src/xs_internal.c,
  src/xs_internal.h: Move to src/xen/ directory
* proxy/Makefile.am, proxy/libvirt_proxy.c, src/Makefile.am,
  src/libvirt.c, tests/sexpr2xmltest.c, tests/statstest.c,
  tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c:
  Adapt to changed xen location
* src/stats_linux.h, src/stats_linux.c: Remove xen specific block
  stats APIs
* src/qemu_driver.c, src/uml_driver.c: Add missing sys/un.h include
  uncovered after change to stats_linux.h
* src/xen/block_stats.h, src/xen/block_stats.c: Add xen specific
  block stats APIs
2009-09-21 14:41:42 +01:00
Jim Meyering
07613d2020 remove all trailing blank lines
by running this command:
git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
This is in preparation for a more strict make syntax-check
rule that will detect trailing blank lines.
2009-07-16 15:06:42 +02:00
Daniel P. Berrange
e4073623a6 Support PCI passthrough for Xen 2009-04-03 12:38:52 +00:00
Daniel P. Berrange
b02c0455d1 Fix localtime handling for newer XenD 2009-04-01 10:36:52 +00:00
Daniel P. Berrange
e4c65831e3 Misc fixes uncovered by OOM testing 2009-04-01 10:31:01 +00:00
John Levon
e80f10064e parse IP address for bridge interfaces 2009-01-23 01:48:47 +00:00
Guido Günther
d6bd288da2 add missing flags argument 2009-01-08 19:52:15 +00:00
Daniel P. Berrange
cfb0dca6ec Fix test suite build when Xen driver is disabled 2008-11-24 19:23:39 +00:00
Cole Robinson
a82bd0784b Fix reading vncdisplay from xend, add several test cases for xen vnc corner case
s.
2008-09-09 13:53:58 +00:00
Daniel P. Berrange
8c6f5a546b Convert XenD XML->SEXPR conversion to new domain XML APIs 2008-07-25 13:17:27 +00:00
Daniel P. Berrange
4b23495509 Convert test suites over to new test infrastructure 2008-05-29 15:31:49 +00:00
Daniel P. Berrange
1d73398e8f Remove all use of strcmp, strncmp in favour of STREQ, STREQLEN, STRPREFIX 2008-05-14 19:51:24 +00:00
Daniel Veillard
70f446631f Sound support for QEmu and Xen
* src/qemu_conf.c src/qemu_conf.h src/xend_internal.c
  src/xend_internal.h src/xm_internal.c src/xml.c src/xml.h:
  Patch from Cole Robinson adding sound support for QEmu and Xen
* tests/qemuxml2argvtest.c tests/sexpr2xmltest.c
  tests/xmconfigtest.c tests/xml2sexprtest.c:
  Associated regression tests
Daniel
2008-05-07 14:04:40 +00:00
Daniel P. Berrange
159cb2b97c Added support for network interface model setting 2008-04-30 12:30:55 +00:00
Daniel P. Berrange
e6f1123819 Added full support for serial and parallel devices to Xen drivers 2008-04-26 14:22:02 +00:00
Jim Meyering
5bf824ea10 convert TAB-based indentation in C sources to use only spaces
Done using this command (also includes .c.in and .h.in files):
for i in $(g ls-files|grep -E '\.[ch](\.in)?$'|grep -v gnulib); do
  expand -i $i > j && mv j $i;done
2008-04-10 16:54:54 +00:00
Jim Meyering
e04912a9f0 Remove all trailing blanks; turn on the rule to detect them.
* Makefile.cfg (local-checks-to-skip): Remove sc_trailing_blank.
* .x-sc_trailing_blank: New file, to exempt the few binary files.
2008-02-05 19:27:37 +00:00
Daniel P. Berrange
e87e3f86bf Added support for booting off kenrel+initrd with HVM guests 2008-02-05 16:21:25 +00:00
Jim Meyering
a378188194 Enable the <config.h>-requiring test; fix violations
Use <config.h>, not "config.h", per autoconf documentation.
* Makefile.cfg (local-checks-to-skip) [sc_require_config_h]: Enable.
* .x-sc_require_config_h: New file, to list exempted files.
* Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h.
2008-01-29 18:15:54 +00:00
Richard W.M. Jones
4bfdb77aae Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
        qemud/remote.c, src/internal.h, src/openvz_conf.c,
        src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
        src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
        src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
        tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
        tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
        tests/xmconfigtest.c, tests/xml2sexprtest.c:
        Change #include <> to #include "" for local includes.
        Removed many includes from src/internal.h and put them in
        the C files which actually use them.
        Removed <ansidecl.h> - unused.
        Added a comment around __func__.
        Removed a clashing redefinition of VERSION symbol.
        All limits (PATH_MAX etc) now done in src/internal.h, so we
        don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
Daniel P. Berrange
6d3f1d516e Disable Xen specific functions if Xen driver is disabled 2007-11-30 22:51:54 +00:00
Richard W.M. Jones
b7641686a6 Mon Nov 26 12:03:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* tests/Makefile.am, tests/nodeinfotest.c, tests/qemuxml2argvtest.c,
	  tests/qemuxml2xmltest.c, tests/sexpr2xmltest.c, tests/virshtest.c,
	  tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c:
	  Miscellaneous fixes to the tests to compile under Cygwin.
2007-11-26 12:03:34 +00:00
Daniel Veillard
ef4006b3a5 * tests/sexpr2xmltest.c tests/xml2sexprtest.c: warn before exiting
if the path environment variable is missing, add the tests for
  <shareable/> from/to w! ode for disk
* tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.sexpr
  tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml
  tests/xml2sexprdata/xml2sexpr-disk-block-shareable.sexpr
  tests/xml2sexprdata/xml2sexpr-disk-block-shareable.xml:
  the new tests data
Daniel
2007-11-20 10:05:45 +00:00
Jim Meyering
5a6571eba9 Arrange for tests to pass in a non-srcdir build.
* tests/Makefile.am: Include the contents of the *data directories
in the make-dist-built tarball by adding each of that *data
directories to EXTRA_DIST.
Also add int-overflow (via $(test_scripts)) to EXTRA_DIST.
* tests/nodeinfotest.c: Prepend "$abs_top_srcdir/tests" to
each input file name.
* tests/qemuxml2argvtest.c: Likewise.
* tests/qemuxml2xmltest.c: Likewise.
* tests/sexpr2xmltest.c: Likewise.
* tests/test_conf.sh: Likewise.
* tests/virshtest.c: Likewise.
* tests/xencapstest.c: Likewise.
* tests/xmconfigtest.c: Likewise.
* tests/xml2sexprtest.c: Likewise.


Author: Jim Meyering <meyering@redhat.com>
2007-11-14 10:35:58 +00:00
Daniel P. Berrange
0bd91c25c0 Fixed compiler warnings 2007-07-18 21:13:26 +00:00