Commit Graph

7014 Commits

Author SHA1 Message Date
Wen Congyang
1ba6e2d926 build: avoid compiler warning during configure
There is no need to redefine _GNU_SOURCE in tests that occur after
gl_INIT, since that macro already AC_DEFINE'd it for us.

Signed-off-by: Eric Blake <eblake@redhat.com>
2011-05-12 08:50:01 -06:00
Osier Yang
81cfe71998 docs: Fix documentation for cputune parameters
This re-adds the example section originally written by Osier Yang,
and indicates the version in which the cputune parameters became
available in libvirt.

Signed-off-by: Igor Serebryany <igor47@moomers.org>
2011-05-12 18:48:23 +08:00
Matthias Bolte
2a5251e2c4 remote generator: Add skipgen/autogen flags to .x files
Make procedure parsing more robust, by allowing arbitrary
amounts of whitespaces.

Also make some error messages more verbose.
2011-05-12 08:44:07 +02:00
Eric Blake
88d03d4ff1 nwfilter: drop unused flag argument
The public API and RPC over-the-wire format have no flags argument,
so neither should the internal callback API.  This simplifies the
RPC generator.

* src/driver.h (virDrvNWFilterDefineXML): Drop argument that does
not match public API.
* src/nwfilter/nwfilter_driver.c (nwfilterDefine): Likewise.
* src/libvirt.c (virNWFilterDefineXML): Likewise.
* daemon/remote_generator.pl: Drop special case.
2011-05-11 19:26:59 -06:00
Eric Blake
cb84580a25 maint: omit translation for all VIR_INFO
We were 31/73 on whether to translate; since less than 50% translated
and since VIR_INFO is less than VIR_WARN which also doesn't translate,
this makes sense.

* cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
falls between WARN and DEBUG.
* daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
(qemudDispatchServer): Adjust offenders.
* daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
* src/network/bridge_driver.c (networkReloadIptablesRules)
(networkStartNetworkDaemon, networkShutdownNetworkDaemon)
(networkCreate, networkDefine, networkUndefine): Likewise.
* src/qemu/qemu_driver.c (qemudDomainDefine)
(qemudDomainUndefine): Likewise.
* src/storage/storage_driver.c (storagePoolCreate)
(storagePoolDefine, storagePoolUndefine, storagePoolStart)
(storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
(storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
* src/util/bridge.c (brProbeVnetHdr): Likewise.
* po/POTFILES.in: Drop src/util/bridge.c.
2011-05-11 15:20:33 -06:00
Eric Blake
5c129f7438 build: wrap macro body in one-shot do-while loop
* src/libvirt.c (VIR_DOMAIN_DEBUG_1): Convert to single statement.
Suggested by Jiri Denemark.
2011-05-11 15:14:05 -06:00
Eric Blake
5bc168ede3 build: drop need for VIR_DOMAIN_DEBUG0()
This one's tricker than the VIR_DEBUG0() removal, but the end
result is still C99 compliant, and reasonable with enough comments.

* src/libvirt.c (VIR_ARG10, VIR_HAS_COMMA)
(VIR_DOMAIN_DEBUG_EXPAND, VIR_DOMAIN_DEBUG_PASTE): New macros.
(VIR_DOMAIN_DEBUG): Rewrite to handle one argument, moving
multi-argument guts to...
(VIR_DOMAIN_DEBUG_1): New macro.
(VIR_DOMAIN_DEBUG0): Rename to VIR_DOMAIN_DEBUG_0.
2011-05-11 15:08:53 -06:00
Christophe Fergeau
29d753c8d5 fix xdr detection and use with recent glibc
glibc 2.13.90 has obsoleted its rpc implementation in favour of
the one provided by the TI-RPC library:

> * The RPC implementation in libc is obsoleted.  Old programs keep working
>   but new programs cannot be linked with the routines in libc anymore.
>   Programs in need of RPC functionality must be linked against TI-RPC.
>   The TI-RPC implemtation is IPv6 enabled and there are other benefits.
>
>   Visible changes of this change include (obviously) the inability to
>   link
>   programs using RPC functions without referencing the TI-RPC library,
>   the
>   removal of the RPC headers from the glibc headers, and the lack of
>   symbols defined in <rpc/netdb.h> when <netdb.h> is installed.
>   Implemented by Ulrich Drepper.
(from glibc NEWS)

Thus with recent glibc, we need to try linking with -ltirpc when looking
for the XDR functions. The daemon also needs to use XDR_CFLAGS to be able
to find the XDR headers stored in /usr/include/tirpc.

When using TI-RPC, there are some warnings about redundant declarations, but
the fix probably belongs in other modules:

/usr/include/tirpc/rpc/rpcent.h:68:13: warning: redundant redeclaration of
'setrpcent' [-Wredundant-decls]
/usr/include/rpc/netdb.h:53:13: note: previous declaration of 'setrpcent'
was here

/usr/include/tirpc/rpc/rpcent.h:69:13: warning: redundant redeclaration of
'endrpcent' [-Wredundant-decls]
/usr/include/rpc/netdb.h:54:13: note: previous declaration of 'endrpcent'
was here

/usr/include/tirpc/rpc/rpc.h:84:12: warning: redundant redeclaration of
'bindresvport' [-Wredundant-decls]
/usr/include/netinet/in.h:440:12: note: previous declaration of
'bindresvport' was here
2011-05-11 14:56:57 -06:00
Eric Blake
bc6bfeaa17 build: avoid gcc preprocessor extensions
Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by
C99; thankfully, we can avoid it by lumping the format argument
into the var-args set.

* src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT)
(VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick
to C99 var-arg macro syntax.
* examples/domain-events/events-c/event-test.c (VIR_DEBUG):
Simplify.
2011-05-11 13:28:50 -06:00
Lai Jiangshan
b65f37a4a1 libvirt,logging: cleanup VIR_XXX0()
These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.

How do these coversions works? The magic is using the gcc extension of ##.
When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
avoid compile error.

example: origin				after CPP
	high_level_api("%d", a_int)	low_level_api("%d", a_int)
	high_level_api("a  string")	low_level_api("a  string")

About 400 conversions.

8 special conversions:
VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
  (for security) 6 conversions

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2011-05-11 12:41:14 -06:00
Eric Blake
0e5a7ace8a maint: avoid a couple of gnulib regressions
Double-close regression in upstream gnulib fclose was introduced
to libvirt in commit 9d8e01a1d.

Meanwhile, adding rpcgen as a bootstrap prerequisite in commit
fb1e8d9c prevented RHEL 5 from running bootstrap.

* .gnulib: Update to latest, for fclose and bootstrap fixes.
* bootstrap: Synchronize from upstream.
2011-05-11 12:03:45 -06:00
Eric Blake
98cd17bd18 node_device: avoid null dereference on error
If we plow on after udev_device_get_syspath fails, we will hit a NULL
dereference.  Clang found one due to strdup later in udevSetParent,
but in fact we hit a NULL dereference sooner because of the use of
STREQ within virNodeDeviceFindBySysfsPath.

* src/conf/node_device_conf.h (virNodeDeviceFindBySysfsPath): Mark
path argument non-null.
* src/node_device/node_device_udev.c (udevSetParent): Avoid null
dereference.
2011-05-11 11:55:16 -06:00
Eric Blake
4c6ae9ae36 build: remove some dead assignments
No syntactic effect; this merely silences some clang warnings.

* src/libxl/libxl_driver.c (libxlDomainSetVcpusFlags): Drop
redundant ret=0 statement.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextDriveDel):
Likewise.
2011-05-11 10:43:13 -06:00
Eric Blake
70ea7decbe tests: avoid crash when run under gcov
Running ./autobuild.sh failed when gcov is installed, because
commandtest ended up crashing during gcov's getenv() call after
exit() had already started.  I traced this nasty bug back to
a scoping issue present since the test introduction.

* tests/commandtest.c (mymain): Move newenv...
(newenv): ...to a scope that is still useful during exit().
2011-05-11 09:58:35 -06:00
Eric Blake
ba13a37cff build: fix VPATH build with distributed generated files
* daemon/Makefile.am (DAEMON_GENERATED, remote_dispatch_*.h)
(qemu_dispatch_*.h): Update to live in srcdir, since they are
distributed.
Detected by Daniel P. Berrange's autobuilder.
2011-05-11 09:17:19 -06:00
Eric Blake
2c28717522 docs: avoid double 'the'
* docs/testsuites.html.in: Keep 'make syntax-check' happy.
2011-05-11 08:18:04 -06:00
Daniel Veillard
ef82932bb5 Add documentation about test suites
Create a new top level entry, add a new page listing the 3
test suites, and then one page for the TCK and one page for
libvirt-test-API
2011-05-11 19:18:38 +08:00
Daniel P. Berrange
cbf9f2f2c0 Allow destroying QEMU VM even if a job is active
Introduce a virProcessKill function that can be safely called
even when the job mutex is held. This allows virDomainDestroy
to kill any VM even if it is asleep in a monitor job. The PID
will die and the thread asleep on the monitor will then wake
up releasing the job mutex.

* src/qemu/qemu_driver.c: Kill process before using qemuProcessStop
  to ensure job is released
* src/qemu/qemu_process.c: Add virProcessKill for killing off
  QEMU processes
2011-05-11 09:35:15 +01:00
Daniel P. Berrange
9f5d3a912d Add support for YAJL version 2 API/ABI
Version 2.0.0 or yajl changed API. It is fairly trivial for us to
cope with both APIs in libvirt, so adapt.

* configure.ac: Probe for yajl2 API
* src/util/json.c: Conditional support for yajl2 API
2011-05-11 09:35:10 +01:00
Paolo Bonzini
761a742a8d libxl: support enabling the HPET
libxl accepts hpet configuration in its domain info struct.  Parse the
domain definition's <clock> element in order to set the value.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Apologies from Eric Blake, for mistakenly committing the broken
intermediate version.
2011-05-10 16:38:30 -06:00
Paolo Bonzini
0fd3fac537 libxl: support enabling the HPET
libxl accepts hpet configuration in its domain info struct.  Parse the
domain definition's <clock> element in order to set the value.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-05-10 16:28:09 -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
Doug Goldstein
fa4732724e docs: updates to CA cert and client cert/key info
Update the documentation to mention that the CA certificate and the
client cert/key pair can come from the user's location or the global
location independent of each other.

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
2011-05-10 14:56:53 -06:00
Doug Goldstein
343c69dbad virsh: flexibility in CA cert and user cert/key
Allow the CA certificate to come from the user's home directory or from
the global location independently of the client certificate/key pair.

Mostly for the case when each user on a system has their own cert/key
pair but the system as a whole shares the same CA.

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
2011-05-10 14:45:09 -06:00
Matthias Bolte
8c6df9139b remote generator: Make parsing stricter
Anchor matches at the beginning of a line.

Specialize some general matches.

Add some comments to special cases.
2011-05-10 20:51:26 +02:00
Matthias Bolte
bfb188dd44 remote generator: Unify unsigned int notation in .x files
Rename u_int and unsigned to unsigned int. This gets rid of some special
case code in the generator.
2011-05-10 20:47:24 +02:00
Matthias Bolte
e4f6e1230d remote generator: Fix comment ignoring regex 2011-05-10 20:36:13 +02:00
Matthias Bolte
9817604afc Rename internal DumpXML functions to GetXMLDesc
This matches the public API and helps to get rid of some special
case code in the remote generator.

Rename driver API functions and XDR protocol structs.

No functional change included outside of the remote generator.
2011-05-10 20:32:41 +02:00
Lai Jiangshan
fcf967f2ad qemu,inject-nmi: Implement the driver methods 2011-05-10 11:40:51 -06:00
Lai Jiangshan
a083d44c87 inject-nmi: Expose the new API in virsh 2011-05-10 11:40:51 -06:00
Lai Jiangshan
b8c776eb63 inject-nmi: Implementing the remote protocol 2011-05-10 11:40:51 -06:00
Lai Jiangshan
9a1b5dc66f inject-nmi: Implementing the public API 2011-05-10 11:40:51 -06:00
Lai Jiangshan
b19bd85e15 inject-nmi: Defining the internal API 2011-05-10 11:40:51 -06:00
Lai Jiangshan
b08ad6cd87 inject-nmi: Defining the public API 2011-05-10 11:40:51 -06:00
Cole Robinson
0ed4aa448e lxc: container: Build init cmd before we close stdout
That way we can log the 'init' argv for debugging.
2011-05-10 13:15:50 -04:00
Cole Robinson
0719c3d64c lxc: container: Convert <init> exec to virCommand 2011-05-10 13:15:50 -04:00
Cole Robinson
f095398a47 command: Add virCommandExec helper
Actually execs the argv/env we've generated, replacing the current process.
Kind of has a limited usage, but allows us to use virCommand in LXC
driver to launch the 'init' process
2011-05-10 13:15:50 -04:00
Cole Robinson
924eb9a4b4 lxc: driver: Improve logging when launching emulator
Log the full command line and a timestamp like we do for QEMU
2011-05-10 13:15:50 -04:00
Cole Robinson
451cfd05a2 lxc: driver: Convert emulator launching to virCommand
v2:
    Shorten a few virCommand calls
    s/remain/retain/
2011-05-10 13:15:50 -04:00
Cole Robinson
35c1b35e25 command: Add virCommandEnvAddFormat
Similar to virCommandArgAddFormat. We will use this shortly.

v2:
    Convert virCommandEnvAddPair to use the new function
2011-05-10 13:15:50 -04:00
Matthias Bolte
fc0ab50abd Fix two uninitialized variable warnings
gcc only reports them when compiling with -O3.
2011-05-10 08:39:56 +02:00
Matthias Bolte
ebea59ad82 apparmor: Fix uninitalized variable warning in virt-aa-helper 2011-05-10 08:03:31 +02:00
Eric Blake
9d8e01a1db build: translate generated strings
Make sure that xgettext scans generated files for translatable
strings, rather than just files stored in libvirt.git.

* .gnulib: Update, for bootstrap and syntax-check fixes.
* bootstrap: Resynchronize with gnulib.
* cfg.mk (generated_files): Define.
* po/POTFILES.in: Add more files with _().
2011-05-09 11:51:05 -06:00
Daniel P. Berrange
8b83cc4219 Remove bogus assert() from migration code
assert() is forbidden in libvirt code, and these two cases would
in fact never execute due to earlier error checks.

* src/libvirt.c: Remove assert() usage
2011-05-09 17:59:04 +01:00
Daniel P. Berrange
604708df27 Pull in gnulib fnmatch module
The libvirtd daemon uses fnmatch. Although we don't yet build
it on Win32, we should use gnulib's fnmatch module to ensure
portability to all platforms.

* bootstrap.conf: Add fnmatch
2011-05-09 16:10:46 +01:00
Jiri Denemark
b9171eba2f json: Fix *GetBoolean functions
They were not used anywhere so far so nobody noticed they are broken.
2011-05-09 14:02:13 +02:00
Eric Blake
0f536dea9b build: rebuild generated files after rpcgen_fix.pl tweak
Noticed this while trying to run rpcgen on cygwin.

* src/Makefile.am ($(srcdir)/remote/%_protocol.h)
($(srcdir)/remote/%_protocol.c): Add a dependency.
2011-05-09 14:02:13 +02:00
Eric Blake
3e63a94cb9 build: fix VPATH builds
* src/Makefile.am (REMOTE_DRIVER_GENERATED): Generated files
should live in $(srcdir). Update rules to reflect this.
2011-05-09 14:02:13 +02:00
Daniel Veillard
c7ac48c7d7 Re-add libvirt.spec to tarball to allwo "make rpm"
Commit e6972165 broke "make rpm" and rpmbuild -ta tarball
2011-05-09 14:23:19 +08:00
Daniel P. Berrange
3496b7f500 build: Remove all generated RPC files from GIT
Stop storing the generated files for the remote protocol client
and server in source control. The generated files will still be
included in the result of 'make dist' to avoid end-users needing
to generate the files

Signed-off-by: Eric Blake <eblake@redhat.com>

Unfortunately, this means that the strings marked for translation
in generated files are not picked up by gnulib's syntax-check,
I'm working on fixing that in gnulib.

* .gitignore, cfg.mk, po/POTFILES.in: Reflect deletion.
2011-05-06 16:22:33 -06:00