]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agodomain_event: Add virDomainEventState structure
Cole Robinson [Wed, 5 Jan 2011 22:27:40 +0000 (17:27 -0500)]
domain_event: Add virDomainEventState structure

This structure will be used to unify lots of duplicated event handling code
across the state drivers.

v2:
    Check for state == NULL in StateFree
    Add NONNULL tagging
    Use bool for isDispatching

Signed-off-by: Cole Robinson <crobinso@redhat.com>
13 years agoxml: Use virXMLParse* helpers everywhere
Cole Robinson [Thu, 12 May 2011 21:20:47 +0000 (17:20 -0400)]
xml: Use virXMLParse* helpers everywhere

virt-aa-helper isn't even compile tested since I don't have the setup for
it.

v2:
    virt-aa-helper fixes from Eric

13 years agodomain: Require <init> for container guests
Cole Robinson [Thu, 12 May 2011 20:12:05 +0000 (16:12 -0400)]
domain: Require <init> for container guests

Use capabilities to allow a driver to register a default <init> if none
is specified in the XML. Openvz was already open-coding this to be /sbin/init

LXC currently falls over if no init is specified, so an explicit error is
an improvement IMO.

(Side note: I don't think we can set a default value for LXC. If we use
/sbin/init but the user doesn't specify a separate root FS for their guest,
the container will rerun the host's init which can be traumatic :). For
virt-install I'm thinking of defaulting to /sbin/init if a root FS has
been specified, otherwise require the user to manually specify <init>)

13 years agoxml: Make sure virXpathNodeSet always sets an error
Cole Robinson [Thu, 12 May 2011 19:45:22 +0000 (15:45 -0400)]
xml: Make sure virXpathNodeSet always sets an error

And update callers to actually respect the error

13 years agovbox: Implement the driver methods
Michal Privoznik [Fri, 1 Apr 2011 13:34:23 +0000 (15:34 +0200)]
vbox: Implement the driver methods

* src/vbox/vbox_tmpl.c: New vboxDomainScreenshot() function

13 years agoqemu: Implement the driver methods
Michal Privoznik [Fri, 1 Apr 2011 06:23:58 +0000 (08:23 +0200)]
qemu: Implement the driver methods

* src/qemu/qemu_driver.c: new qemuDomainScreenshot() function
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Monitor command

13 years agovirFDStream: Add option for delete file after it's opening
Michal Privoznik [Tue, 5 Apr 2011 10:27:35 +0000 (12:27 +0200)]
virFDStream: Add option for delete file after it's opening

This is needed if we want to transfer a temporary file. If the
transfer is done with iohelper, we might run into a race condition,
where we unlink() file before iohelper is executed.

* src/fdstream.c, src/fdstream.h,
  src/util/iohelper.c: Add new option
* src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
  src/storage/storage_driver.c, src/uml/uml_driver.c,
  src/xen/xen_driver.c: Expand existing function calls

13 years agoscreenshot: Implementing the remote protocol
Michal Privoznik [Mon, 4 Apr 2011 13:54:48 +0000 (15:54 +0200)]
screenshot: Implementing the remote protocol

* src/remote/remote_protocol.x: Wire protocol definition
* daemon/remote.c: Daemon part
* src/remote/remote_driver.c: Client part
* src/remote_protocol-structs: Add structures

13 years agoscreenshot: Implementing the public API
Michal Privoznik [Mon, 4 Apr 2011 12:07:43 +0000 (14:07 +0200)]
screenshot: Implementing the public API

* src/libvirt.c: new function virDomainScreenshot

13 years agoscreenshot: Defining the internal API
Michal Privoznik [Mon, 4 Apr 2011 10:35:45 +0000 (12:35 +0200)]
screenshot: Defining the internal API

* src/driver.h: Stub code for new API
* src/esx/esx_driver.c, src/libxl/libxl_driver.c,
  src/lxc/lxc_driver.c, src/openvz/openvz_driver.c,
  src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
  rc/remote/remote_driver.c, rc/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/vmware/vmware_driver.c, src/xen/xen_driver.c,
  src/xen/xen_driver.h, src/xen/xen_hypervisor.c,
  src/xen/xen_inotify.c, src/xen/xend_internal.c,
  src/xen/xm_internal.c, src/xen/xs_internal.c,
  src/xenapi/xenapi_driver.c: Add dummy entries in driver
  table for new APIs

13 years agoscreenshot: Defining the public API
Michal Privoznik [Mon, 4 Apr 2011 09:58:53 +0000 (11:58 +0200)]
screenshot: Defining the public API

Add public API for taking screenshots of current domain console.

* include/libvirt/libvirt.h.in: add virDomainScreenshot
* src/libvirt_public.syms: Export new symbol

13 years agobuild: avoid compiler warning during configure
Wen Congyang [Thu, 12 May 2011 09:55:43 +0000 (17:55 +0800)]
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>
13 years agodocs: Fix documentation for cputune parameters
Osier Yang [Thu, 12 May 2011 10:48:23 +0000 (18:48 +0800)]
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>
13 years agoremote generator: Add skipgen/autogen flags to .x files
Matthias Bolte [Wed, 11 May 2011 19:28:39 +0000 (21:28 +0200)]
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.

13 years agonwfilter: drop unused flag argument
Eric Blake [Wed, 11 May 2011 22:30:36 +0000 (16:30 -0600)]
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.

13 years agomaint: omit translation for all VIR_INFO
Eric Blake [Wed, 11 May 2011 15:08:44 +0000 (09:08 -0600)]
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.

13 years agobuild: wrap macro body in one-shot do-while loop
Eric Blake [Wed, 11 May 2011 21:14:05 +0000 (15:14 -0600)]
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.

13 years agobuild: drop need for VIR_DOMAIN_DEBUG0()
Eric Blake [Wed, 11 May 2011 20:04:00 +0000 (14:04 -0600)]
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.

13 years agofix xdr detection and use with recent glibc
Christophe Fergeau [Tue, 10 May 2011 15:42:06 +0000 (17:42 +0200)]
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

13 years agobuild: avoid gcc preprocessor extensions
Eric Blake [Wed, 11 May 2011 19:24:50 +0000 (13:24 -0600)]
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.

13 years agolibvirt,logging: cleanup VIR_XXX0()
Lai Jiangshan [Mon, 9 May 2011 09:24:09 +0000 (17:24 +0800)]
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>
13 years agomaint: avoid a couple of gnulib regressions
Eric Blake [Tue, 10 May 2011 21:54:58 +0000 (15:54 -0600)]
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.

13 years agonode_device: avoid null dereference on error
Eric Blake [Wed, 4 May 2011 23:03:52 +0000 (17:03 -0600)]
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.

13 years agobuild: remove some dead assignments
Eric Blake [Wed, 4 May 2011 23:25:44 +0000 (17:25 -0600)]
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.

13 years agotests: avoid crash when run under gcov
Eric Blake [Wed, 11 May 2011 15:51:30 +0000 (09:51 -0600)]
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().

13 years agobuild: fix VPATH build with distributed generated files
Eric Blake [Wed, 11 May 2011 14:51:03 +0000 (08:51 -0600)]
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.

13 years agodocs: avoid double 'the'
Eric Blake [Wed, 11 May 2011 14:18:04 +0000 (08:18 -0600)]
docs: avoid double 'the'

* docs/testsuites.html.in: Keep 'make syntax-check' happy.

13 years agoAdd documentation about test suites
Daniel Veillard [Wed, 11 May 2011 11:18:38 +0000 (19:18 +0800)]
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

13 years agoAllow destroying QEMU VM even if a job is active
Daniel P. Berrange [Thu, 21 Apr 2011 15:19:06 +0000 (11:19 -0400)]
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

13 years agoAdd support for YAJL version 2 API/ABI
Daniel P. Berrange [Tue, 3 May 2011 16:50:58 +0000 (17:50 +0100)]
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

14 years agolibxl: support enabling the HPET
Paolo Bonzini [Tue, 10 May 2011 11:24:15 +0000 (13:24 +0200)]
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.

14 years agolibxl: support enabling the HPET
Paolo Bonzini [Tue, 10 May 2011 11:24:15 +0000 (13:24 +0200)]
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>
14 years agoxen: parse and generate hpet item in sxpr
Paolo Bonzini [Tue, 10 May 2011 11:24:14 +0000 (13:24 +0200)]
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>
14 years agodocs: updates to CA cert and client cert/key info
Doug Goldstein [Fri, 6 May 2011 15:01:04 +0000 (10:01 -0500)]
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>
14 years agovirsh: flexibility in CA cert and user cert/key
Doug Goldstein [Fri, 6 May 2011 15:00:53 +0000 (10:00 -0500)]
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>
14 years agoremote generator: Make parsing stricter
Matthias Bolte [Sat, 7 May 2011 06:15:51 +0000 (08:15 +0200)]
remote generator: Make parsing stricter

Anchor matches at the beginning of a line.

Specialize some general matches.

Add some comments to special cases.

14 years agoremote generator: Unify unsigned int notation in .x files
Matthias Bolte [Sat, 7 May 2011 05:42:04 +0000 (07:42 +0200)]
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.

14 years agoremote generator: Fix comment ignoring regex
Matthias Bolte [Sat, 7 May 2011 05:36:21 +0000 (07:36 +0200)]
remote generator: Fix comment ignoring regex

14 years agoRename internal DumpXML functions to GetXMLDesc
Matthias Bolte [Fri, 6 May 2011 19:53:10 +0000 (21:53 +0200)]
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.

14 years agoqemu,inject-nmi: Implement the driver methods
Lai Jiangshan [Tue, 10 May 2011 08:26:06 +0000 (16:26 +0800)]
qemu,inject-nmi: Implement the driver methods

14 years agoinject-nmi: Expose the new API in virsh
Lai Jiangshan [Tue, 10 May 2011 08:26:05 +0000 (16:26 +0800)]
inject-nmi: Expose the new API in virsh

14 years agoinject-nmi: Implementing the remote protocol
Lai Jiangshan [Tue, 10 May 2011 08:26:04 +0000 (16:26 +0800)]
inject-nmi: Implementing the remote protocol

14 years agoinject-nmi: Implementing the public API
Lai Jiangshan [Tue, 10 May 2011 08:26:03 +0000 (16:26 +0800)]
inject-nmi: Implementing the public API

14 years agoinject-nmi: Defining the internal API
Lai Jiangshan [Tue, 10 May 2011 08:26:02 +0000 (16:26 +0800)]
inject-nmi: Defining the internal API

14 years agoinject-nmi: Defining the public API
Lai Jiangshan [Tue, 10 May 2011 08:26:01 +0000 (16:26 +0800)]
inject-nmi: Defining the public API

14 years agolxc: container: Build init cmd before we close stdout
Cole Robinson [Fri, 6 May 2011 14:50:00 +0000 (10:50 -0400)]
lxc: container: Build init cmd before we close stdout

That way we can log the 'init' argv for debugging.

14 years agolxc: container: Convert <init> exec to virCommand
Cole Robinson [Thu, 5 May 2011 21:38:09 +0000 (17:38 -0400)]
lxc: container: Convert <init> exec to virCommand

14 years agocommand: Add virCommandExec helper
Cole Robinson [Fri, 6 May 2011 14:37:36 +0000 (10:37 -0400)]
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

14 years agolxc: driver: Improve logging when launching emulator
Cole Robinson [Thu, 5 May 2011 20:35:00 +0000 (16:35 -0400)]
lxc: driver: Improve logging when launching emulator

Log the full command line and a timestamp like we do for QEMU

14 years agolxc: driver: Convert emulator launching to virCommand
Cole Robinson [Thu, 5 May 2011 20:34:05 +0000 (16:34 -0400)]
lxc: driver: Convert emulator launching to virCommand

v2:
    Shorten a few virCommand calls
    s/remain/retain/

14 years agocommand: Add virCommandEnvAddFormat
Cole Robinson [Thu, 5 May 2011 20:32:52 +0000 (16:32 -0400)]
command: Add virCommandEnvAddFormat

Similar to virCommandArgAddFormat. We will use this shortly.

v2:
    Convert virCommandEnvAddPair to use the new function

14 years agoFix two uninitialized variable warnings
Matthias Bolte [Tue, 10 May 2011 06:39:56 +0000 (08:39 +0200)]
Fix two uninitialized variable warnings

gcc only reports them when compiling with -O3.

14 years agoapparmor: Fix uninitalized variable warning in virt-aa-helper
Matthias Bolte [Sat, 7 May 2011 11:13:41 +0000 (13:13 +0200)]
apparmor: Fix uninitalized variable warning in virt-aa-helper

14 years agobuild: translate generated strings
Eric Blake [Wed, 4 May 2011 14:18:06 +0000 (08:18 -0600)]
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 _().

14 years agoRemove bogus assert() from migration code
Daniel P. Berrange [Wed, 20 Apr 2011 10:39:51 +0000 (11:39 +0100)]
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

14 years agoPull in gnulib fnmatch module
Daniel P. Berrange [Tue, 19 Apr 2011 13:39:57 +0000 (14:39 +0100)]
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

14 years agojson: Fix *GetBoolean functions
Jiri Denemark [Thu, 5 May 2011 11:48:31 +0000 (13:48 +0200)]
json: Fix *GetBoolean functions

They were not used anywhere so far so nobody noticed they are broken.

14 years agobuild: rebuild generated files after rpcgen_fix.pl tweak
Eric Blake [Fri, 6 May 2011 23:34:58 +0000 (17:34 -0600)]
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.

14 years agobuild: fix VPATH builds
Eric Blake [Fri, 6 May 2011 23:10:43 +0000 (17:10 -0600)]
build: fix VPATH builds

* src/Makefile.am (REMOTE_DRIVER_GENERATED): Generated files
should live in $(srcdir). Update rules to reflect this.

14 years agoRe-add libvirt.spec to tarball to allwo "make rpm"
Daniel Veillard [Mon, 9 May 2011 06:23:19 +0000 (14:23 +0800)]
Re-add libvirt.spec to tarball to allwo "make rpm"

Commit e6972165 broke "make rpm" and rpmbuild -ta tarball

14 years agobuild: Remove all generated RPC files from GIT
Daniel P. Berrange [Fri, 6 May 2011 13:11:32 +0000 (14:11 +0100)]
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.

14 years agobuild: refactor generated RPC files
Daniel P. Berrange [Fri, 6 May 2011 13:11:32 +0000 (14:11 +0100)]
build: refactor generated RPC files

Always generate the rpc files, and require rpcgen during bootstrap.

* daemon/Makefile.am: Removed generated files with
  maintainer-clean target
* src/Makefile.am: Removed generated files with
  maintainer-clean target. Always run 'rpcgen' if
  generated files are missing

14 years agobuild: rename generated files to .h, for automake's sake
Eric Blake [Fri, 6 May 2011 19:54:32 +0000 (13:54 -0600)]
build: rename generated files to .h, for automake's sake

In preparation for removing generated files, it is necessary
to tell automake that the generated files must be distributed
but not directly compiled (since they are included into the
body of a larger .c file that is compiled).  Hence, even though
these files are code and not headers in the strict sense of
the word, it is easier to rename them to .h for automake's sake.

* daemon/remote_client_bodies.c: Rename to .h.
* daemon/qemu_client_bodies.c: Likewise.
* src/remote/remote_client_bodies.c: Likewise.
* src/remote/qemu_client_bodies.c: Likewise.
* daemon/Makefile.am (remote_dispatch_bodies.c)
(qemu_dispatch_bodies.c): Rename to .h.
(remote.c, EXTRA_DIST): Reflect rename.
* daemon/remote.c: Likewise.
* daemon/remote_generator.pl: Likewise.
* src/Makefile.am (remote/remote_driver.c): Likewise.
* src/remote/remote_driver.c: Likewise.
* po/POTFILES.in: Likewise.
* cfg.mk (exclude_file_name_regexp--sc_require_config_h)
(exclude_file_name_regexp--sc_require_config_h_first)
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF):
Likewise.

14 years agoremote generator, client: Handle arguments with limited length
Matthias Bolte [Sun, 24 Apr 2011 07:49:42 +0000 (09:49 +0200)]
remote generator, client: Handle arguments with limited length

This adds length checks to all affected functions.

14 years agoremote generator, client: Handle functions that return lists
Matthias Bolte [Sat, 23 Apr 2011 21:00:26 +0000 (23:00 +0200)]
remote generator, client: Handle functions that return lists

14 years agoremote: Refactor remote*Open and remote*Close functions
Matthias Bolte [Sat, 23 Apr 2011 20:07:44 +0000 (22:07 +0200)]
remote: Refactor remote*Open and remote*Close functions

Add generic versions of the open and close functions and call them.

14 years agoremote generator, client: Handle functions with optional return values
Matthias Bolte [Sat, 23 Apr 2011 21:03:44 +0000 (23:03 +0200)]
remote generator, client: Handle functions with optional return values

14 years agoremote generator, client: Handle functions with multiple return values
Matthias Bolte [Sat, 23 Apr 2011 19:25:49 +0000 (21:25 +0200)]
remote generator, client: Handle functions with multiple return values

14 years agoremote generator, client: Handle functions with wrapped return values
Matthias Bolte [Sat, 23 Apr 2011 17:03:14 +0000 (19:03 +0200)]
remote generator, client: Handle functions with wrapped return values

14 years agoremote generator, client: Handle functions with simple return values
Matthias Bolte [Sat, 23 Apr 2011 14:33:57 +0000 (16:33 +0200)]
remote generator, client: Handle functions with simple return values

14 years agoremote generator, client: Handle simple remote driver functions
Matthias Bolte [Sat, 23 Apr 2011 10:53:57 +0000 (12:53 +0200)]
remote generator, client: Handle simple remote driver functions

Rename remoteSecretListSecrets to remoteListSecrets to match the normal
naming pattern.

14 years agoremote generator: Reorder into prepare and print section
Matthias Bolte [Sat, 23 Apr 2011 07:40:14 +0000 (09:40 +0200)]
remote generator: Reorder into prepare and print section

14 years agoremote generator, daemon: Handle functions with multiple return values
Matthias Bolte [Sat, 23 Apr 2011 07:36:33 +0000 (09:36 +0200)]
remote generator, daemon: Handle functions with multiple return values

Once again rename members in the XDR definitions to avoid special case
code in the generator.

14 years agoremote generator, daemon: Combine multiple ifs in the generated code
Matthias Bolte [Sat, 23 Apr 2011 06:35:03 +0000 (08:35 +0200)]
remote generator, daemon: Combine multiple ifs in the generated code

14 years agoremote generator, daemon: Handle the CPU functions
Matthias Bolte [Sat, 23 Apr 2011 06:19:46 +0000 (08:19 +0200)]
remote generator, daemon: Handle the CPU functions

They require additional special cases.

14 years agoremote generator: Refactor duplicate code
Matthias Bolte [Fri, 22 Apr 2011 22:19:14 +0000 (00:19 +0200)]
remote generator: Refactor duplicate code

14 years agoremote generator, daemon: Handle functions that return lists
Matthias Bolte [Fri, 22 Apr 2011 20:48:25 +0000 (22:48 +0200)]
remote generator, daemon: Handle functions that return lists

14 years agoremote: Rename 'nameslen' to the common 'maxnames'
Matthias Bolte [Fri, 22 Apr 2011 20:45:02 +0000 (22:45 +0200)]
remote: Rename 'nameslen' to the common 'maxnames'

Avoids special case handling in the remote generator.

14 years agoremote generator, daemon: Handle functions with optional arguments
Matthias Bolte [Fri, 22 Apr 2011 18:31:05 +0000 (20:31 +0200)]
remote generator, daemon: Handle functions with optional arguments

14 years agoremote generator, daemon: Handle more functions
Matthias Bolte [Fri, 22 Apr 2011 16:54:51 +0000 (18:54 +0200)]
remote generator, daemon: Handle more functions

This covers functions that return single wrapped objects and don't
involve complexer code in the body.

14 years agoremote generator, daemon: Handle simple-return-value functions
Matthias Bolte [Fri, 22 Apr 2011 15:09:33 +0000 (17:09 +0200)]
remote generator, daemon: Handle simple-return-value functions

14 years agoremote generator, daemon: Change capitalization of some words
Matthias Bolte [Fri, 22 Apr 2011 13:36:52 +0000 (15:36 +0200)]
remote generator, daemon: Change capitalization of some words

Again this will simplify the generator, due to less special case handling.

14 years agoremote: Replace 'domain' with 'dom' in the XDR protocol
Matthias Bolte [Fri, 22 Apr 2011 13:40:31 +0000 (15:40 +0200)]
remote: Replace 'domain' with 'dom' in the XDR protocol

This simplifies the remote protocol code generator.

Also rename 'ret' to 'result' to resolve a naming conflict in the
generator.

14 years agoremote generator, daemon: Output function bodies too
Matthias Bolte [Fri, 22 Apr 2011 18:35:34 +0000 (20:35 +0200)]
remote generator, daemon: Output function bodies too

This patch just covers the simple functions without explicit return
values. There is more to be handled.

The generator collects the members of the XDR argument structs and uses
this information to generate the function bodies.

Exclude the generated files from offending syntax-checks.

Suggested by Richard W.M. Jones

14 years agoremote generator: Replace tabs with spaces and rename file
Matthias Bolte [Sun, 24 Apr 2011 07:58:01 +0000 (09:58 +0200)]
remote generator: Replace tabs with spaces and rename file

No functional change included, just a whitespace change.

14 years agoBalloon dom0 in libxl driver
Markus Groß [Wed, 4 May 2011 10:17:06 +0000 (12:17 +0200)]
Balloon dom0 in libxl driver

Creating a domU on a freshly booted dom0 does not work,
because the libxl driver does not allocate memory for the domU.
After creating a domain with xl libvirt is able to create domains too.
This patch reserves enough memory for the domU first.

14 years agobuild: drop files generated by config.status from tarball
Eric Blake [Fri, 6 May 2011 16:17:16 +0000 (10:17 -0600)]
build: drop files generated by config.status from tarball

The rule of thumb is that any file generated by config.status
is a) reproducible by any user, b) dependent on configure options.
Therefore, it is inappropriate to include such generated files
in the tarball (for proof, Makefile is generated from Makefile.in;
the former is not in the tarball while the latter is).

* Makefile.am (EXTRA_DIST): Remove files covered by AC_OUTPUT.

14 years agoremote: check actual access to the cert
Doug Goldstein [Fri, 6 May 2011 16:24:25 +0000 (11:24 -0500)]
remote: check actual access to the cert

Instead of calling stat(), check that we'll actually be able to access
and read the file.

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
14 years agomaint: avoid comparisons to bool constants
Eric Blake [Thu, 5 May 2011 20:27:51 +0000 (14:27 -0600)]
maint: avoid comparisons to bool constants

HACKING already mentions that comparisons against literal 'true'
are unsafe; for consistency, also shorten comparisons against 'false'.

* src/conf/domain_conf.c (virDomainNetDefParseXML): Simplify.
* src/nwfilter/nwfilter_gentech_driver.c
(virNWFilterDomainFWUpdateCB): Likewise.
* tools/virsh.c (cmdVolDownload, vshCommandRun, vshPrintExtra):
Likewise.

14 years agoAdd warning message to XML definition files stored on disk
Michal Privoznik [Fri, 29 Apr 2011 09:28:28 +0000 (11:28 +0200)]
Add warning message to XML definition files stored on disk

Users often edit XML file stored in configuration directory
thinking of modifying a domain/network/pool/etc. Thus it is wise
to let them know they are using the wrong way and give them hint.

14 years agoFix security driver handling of FIFOs with QEMU
Daniel P. Berrange [Tue, 29 Mar 2011 14:46:48 +0000 (15:46 +0100)]
Fix security driver handling of FIFOs with QEMU

When setting up a FIFO for QEMU, it allows either a pair
of fifos used unidirectionally, or a single fifo used
bidirectionally. Look for the bidirectional fifo first
when labelling since that is more useful

* src/security/security_dac.c,
  src/security/security_selinux.c: Fix fifo handling

14 years agoMake taint warnings also go into the domain logfile
Daniel P. Berrange [Thu, 5 May 2011 11:48:07 +0000 (12:48 +0100)]
Make taint warnings also go into the domain logfile

As well as taint warnings going to the main libvirt log,
add taint warnings to the per-domain logfile

  Domain id=3 is tainted: high-privileges
  Domain id=3 is tainted: disk-probing
  Domain id=3 is tainted: shell-scripts
  Domain id=3 is tainted: custom-monitor

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Enhance
  qemuDomainTaint to also log to the domain logfile
* src/qemu/qemu_driver.c: Pass -1 for logFD to taint methods to
  auto-append to logfile
* src/qemu/qemu_process.c: Pass open logFD at startup for taint
  methods

14 years agoAdd a qemuDomainAppendLog method for writing to the domain logfile
Daniel P. Berrange [Thu, 5 May 2011 11:40:50 +0000 (12:40 +0100)]
Add a qemuDomainAppendLog method for writing to the domain logfile

The qemuDomainAppendLog method allows writing a formatted string
to the end of the domain logfile, optionally opening it if needed.

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
  qemuDomainAppendLog

14 years agoMove qemuProcessLogReadFD and qemuProcessLogFD methods
Daniel P. Berrange [Thu, 5 May 2011 11:38:04 +0000 (12:38 +0100)]
Move qemuProcessLogReadFD and qemuProcessLogFD methods

Move the qemuProcessLogReadFD and qemuProcessLogFD methods
into qemu_domain.c, renaming them to qemuDomainCreateLog
and qemuDomainOpenLog.

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
  qemuDomainCreateLog and qemuDomainOpenLog.
* src/qemu/qemu_process.c: Remove qemuProcessLogFD
  and qemuProcessLogReadFD

14 years agoLog taint warnings in QEMU driver
Daniel P. Berrange [Wed, 4 May 2011 10:59:20 +0000 (11:59 +0100)]
Log taint warnings in QEMU driver

Wire up logging of VM tainting to the QEMU driver

 - If running QEMU as root user/group or without capabilities
   being cleared
 - If passing custom QEMU command line args
 - If issuing custom QEMU monitor commands
 - If using a network interface config with an associated
   shell script
 - If using a disk config relying on format probing

The warnings, per-VM appear in the main libvirtd logs

  11:56:17.571: 10832: warning : qemuDomainObjTaint:712 : Domain id=1 name='l2' uuid=c7a3edbd-edaf-9455-926a-d65c16db1802 is tainted: high-privileges
  11:56:17.571: 10832: warning : qemuDomainObjTaint:712 : Domain id=1 name='l2' uuid=c7a3edbd-edaf-9455-926a-d65c16db1802 is tainted: disk-probing

The taint flags are reset when the VM is stopped.

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Helper APIs
  for logging taint warnings
* src/qemu/qemu_driver.c: Log tainting with custom QEMU monitor
  commands and disk/net hotplug with unsupported configs
* src/qemu/qemu_process.c: Log tainting at startup based on
  unsupported configs

14 years agoAdd field to virDomainObjPtr to track "tainting"
Daniel P. Berrange [Wed, 4 May 2011 10:40:59 +0000 (11:40 +0100)]
Add field to virDomainObjPtr to track "tainting"

Some configuration setups for guests are allowed, but strongly
discouraged and unsupportable in production systems. Introduce
a concept of 'tainting' to virDomainObjPtr to allow such setups
to be identified. Drivers can then log warnings at suitable
times

* src/conf/domain_conf.c, src/conf/domain_conf.h: Declare taint
  flags and add parsing/formatting of domain status XML

14 years agovirsh: improve TLS certificate error messages
Doug Goldstein [Thu, 5 May 2011 22:54:52 +0000 (17:54 -0500)]
virsh: improve TLS certificate error messages

Print the name of the CA cert, certificate, and key file that resulted
in the failure so that the user has an idea what to troubleshoot.

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
14 years agovirsh: use new method for easier log to file
Eric Blake [Sat, 30 Apr 2011 17:05:43 +0000 (11:05 -0600)]
virsh: use new method for easier log to file

Easier to maintain, and no longer an arbitrary line length limit.

* tools/virsh.c (vshOutputLogFile): Replace snprintf with
virBuffer.

14 years agobuf: add virBufferVasprintf
Eric Blake [Sat, 30 Apr 2011 16:44:42 +0000 (10:44 -0600)]
buf: add virBufferVasprintf

Match the fact that we have virAsprintf and virVasprintf.

* src/util/buf.h (virBufferVasprintf): New prototype.
* src/util/buf.c (virBufferAsprintf): Move guts...
(virBufferVasprintf): ...to new function.
* src/libvirt_private.syms (buf.h): Export it.
* bootstrap.conf (gnulib_modules): Add stdarg, for va_copy.

14 years agomaint: rename virBufferVSprintf to virBufferAsprintf
Eric Blake [Sat, 30 Apr 2011 16:34:49 +0000 (10:34 -0600)]
maint: rename virBufferVSprintf to virBufferAsprintf

We already have virAsprintf, so picking a similar name helps for
seeing a similar purpose.  Furthermore, the prefix V before printf
generally implies 'va_list', even though this variant was '...', and
the old name got in the way of adding a new va_list version.

global rename performed with:

$ git grep -l virBufferVSprintf \
  | xargs -L1 sed -i 's/virBufferVSprintf/virBufferAsprintf/g'

then revert the changes in ChangeLog-old.