Commit Graph

113 Commits

Author SHA1 Message Date
Daniel P. Berrange
3c37a171a2 Add check for kill() to fix build of cgroups on win32
The kill() function doesn't exist on Win32, so it needs to be
checked for at build time & code disabled in cgroups

* configure.ac: Check for kill()
* src/util/cgroup.c: Stub out virCGroupKill* functions
  when kill() isn't available
2011-02-28 14:13:58 +00:00
Wen Congyang
606d63054c check device-mapper when building with mpath or disk storage driver
Currently, we need virIsDevMapperDevice() when we build libvirt with
disk or mpath storage drivers.  So we should check device-mapper-devel
when we build with disk storage driver but without mpath storage
driver.
2011-02-21 15:17:12 -07:00
Eric Blake
7b6286b780 build: fix broken mingw cross-compilation
Two regressions:
Commit df1011ca broke builds for systems that lack devmapper
(non-Linux, as well as Linux with ./autogen.sh --without-libvirtd
and without the libraries present).
Commit ce6fd650 broke cross-compilation, due to a gnulib bug.

* .gnulib: Update to latest, for cross-compilation fix.
* src/util/util.c (virIsDevMapperDevice): Provide stub for
platforms not using storage driver.
* configure.ac (devmapper): Arrange to define HAVE_LIBDEVMAPPER_H.
devmapper issue reported by Wen Congyang.
2011-02-18 12:02:22 -07:00
Eric Blake
1c07233436 build: speed up non-maintainer builds
* configure.ac (gl_ASSERT_NO_GNULIB_POSIXCHECK): Use to reduce
time spent in configure.
2011-02-18 09:04:22 -07:00
Osier Yang
df1011ca8e storage: Allow to delete device mapper disk partition
The name convention of device mapper disk is different, and 'parted'
can't be used to delete a device mapper disk partition. e.g.

Name                 Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1

Error: Expecting a partition number.

This patch introduces 'dmsetup' to fix it.

Changes:
  - New function "virIsDevMapperDevice" in "src/utils/utils.c"
  - remove "is_dm_device" in "src/storage/parthelper.c", use
    "virIsDevMapperDevice" instead.
  - Requires "device-mapper" for 'with-storage-disk" in "libvirt.spec.in"
  - Check "dmsetup" in 'configure.ac' for "with-storage-disk"
  - Changes on "src/Makefile.am" to link against libdevmapper
  - New entry for "virIsDevMapperDevice" in "src/libvirt_private.syms"

Changes from v1 to v3:
  - s/virIsDeviceMapperDevice/virIsDevMapperDevice/g
  - replace "virRun" with "virCommand"
  - sort the list of util functions in "libvirt_private.syms"
  - ATTRIBUTE_NONNULL(1) for virIsDevMapperDevice declaration.

e.g.

Name                 Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1

Vol /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 deleted

Name                 Path
-----------------------------------------
2011-02-17 15:29:07 +08:00
Daniel Veillard
43f8773c1f Release of libvirt-0.8.8
* configure.ac docs/news.html.in libvirt.spec.in: bump version and add docs
* po/*.po*: updated Gujarati, Polish and Dutch localisations and regenerated
2011-02-17 12:11:03 +08:00
Matthias Bolte
251ad3b28b Avoid empty strings when --with-packager(-version) is not specified
Make with_packager and with_packager_version default to "no". This way
--without-packager-version (as shorthand for --with-packager(-version)=no)
works correctly too.

Prior to this patch libvirt outputs a line like this when
--with-packager(-version) was not specified

# ./daemon/libvirtd
14:11:15.018: 31796: info : libvirt version: 0.8.8, package:  ()

Now the unspecified parts are correctly omitted.

Reported by Osier Yang.
2011-02-15 19:48:44 +01:00
Daniel P. Berrange
cee61fc298 Imprint all logs with version + package build information
The logging functions are enhanced so that immediately prior to
the first log message being printed to any output channel, the
libvirt package version will be printed.

eg

 $ LIBVIRT_DEBUG=1 virsh
 18:13:28.013: 17536: info : libvirt version: 0.8.7
 18:13:28.013: 17536: debug : virInitialize:361 : register drivers
 ...

The 'configure' script gains two new arguments which can be
used as

   --with-packager="Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10"
   --with-packager-version="1.fc14"

to allow distros to append a custom string with package specific
data.

The RPM specfile is modified so that it appends the RPM version,
the build host, the build date and the packager name.

eg

 $ LIBVIRT_DEBUG=1 virsh
 18:14:52.086: 17551: info : libvirt version: 0.8.7, package: 1.fc13 (Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10)
 18:14:52.086: 17551: debug : virInitialize:361 : register drivers

Thus when distro packagers receive bug reports they can clearly
see what version was in use, even if the bug reporter mistakenly
or intentionally lies about version/builds

* src/util/logging.c: Output version data prior to first log message
* libvirt.spec.in: Include RPM release, date, hostname & packager
* configure.ac: Add --with-packager & --with-packager-version args
2011-02-11 14:13:08 +00:00
Eric Blake
59b34f139d build: fix parted detection at configure time
* configure.ac (PARTED_FOUND): Issue configure error if
--with-storage-disk=yes but no parted is found.
2011-02-01 09:05:05 -07:00
Eric Blake
c5b11b3cc4 build: use more gnulib modules for simpler code
* .gnulib: Update to latest, for sigpipe and sigaction modules.
* bootstrap.conf (gnulib_modules): Add siaction, sigpipe, strerror_r.
* tools/virsh.c (vshSetupSignals) [!SIGPIPE]: Delete, now that
gnulib guarantees it.
(SA_SIGINFO): Define for mingw fallback.
* src/util/virterror.c (virStrerror): Simplify, now that gnulib
guarantees the POSIX interface.
* configure.ac (AC_CHECK_FUNCS_ONCE): Drop redundant check.
(AM_PROG_CC_STDC): Move earlier, to keep autoconf happy.
2011-01-18 15:35:41 -07:00
Guido Günther
dda24845fe Add AM_MAINTAINER_MODE
and keep it enabled by default. This allows downstreams to turn it off
via:

./configure --disable-maintainer-mode

as discussed in

https://www.redhat.com/archives/virt-tools-list/2010-October/msg00049.html
2011-01-07 20:22:24 +01:00
Daniel Veillard
6675e00744 Release of libvirt-0.8.7
* configure.ac libvirt.spec.in docs/news.html.in: bump version and add
  documentation
* po/*po*: regenerate po and pot files
2011-01-04 03:37:17 +01:00
Laine Stump
d596c6dc9b new virSetUIDGID() utility function
virSetUIDGID() sets both the real and effective group and user of the
process, and additionally calls initgroups() to assure that the
process joins all the auxiliary groups that the given uid is a member
of.
2010-12-23 16:48:26 -05:00
Laine Stump
8090a56890 Run radvd for virtual networks with IPv6 addresses
Running an instance of the router advertisement daemon (radvd) allows
guests using the virtual network to automatically acquire an IPv6
address and default route. Note that acquiring an address only works
for networks with a prefix length of exactly 64 - radvd is still run
in other circumstances, and still advertises routes, but autoconf will
not work because it requires exactly 64 bits of address info from the
network prefix.

This patch avoids a race condition with the pidfile by manually
daemonizing radvd rather than allowing it to daemonize itself, then
creating our own pidfile (in addition to radvd's own file, which is
unnecessary, but there is no way to tell radvd to not create it). This
is accomplished by exec'ing it with "--debug 1" in the commandline,
and using virCommand's features to fork, create a pidfile, and detach
from the newly forked process.
2010-12-23 15:55:05 -05:00
Laine Stump
537e65e7b7 Update iptables.c to also support ip6tables.
All of the iptables functions eventually call down to a single
bottom-level function, and fortunately, ip6tables syntax (for all the
args that we use) is identical to iptables format (except the
addresses), so all we need to do is:

1) Get an address family down to the lowest level function in each
   case, either implied through an address, or explicitly when no
   address is in the parameter list, and

2) At the lowest level, just decide whether to call "iptables" or
   "ip6tables" based on the family.

The location of the ip6tables binary is determined at build time by
autoconf. If a particular target system happens to not have ip6tables
installed, any attempts to run it will generate an error, but that
won't happen unless someone tries to define an IPv6 address for a
network. This is identical behavior to IPv4 addresses and iptables.
2010-12-23 15:54:32 -05:00
Laine Stump
20718b8bcb Replace brSetInetAddress/brSetInetNetmask with brAddInetAddress
brSetInetAddress can only set a single IP address on the bridge, and
uses a method (ioctl(SIOCSETIFADDR)) that only works for IPv4. Replace
it and brSetInetNetmask with a single function that uses the external
"ip addr add" command to add an address/prefix to the interface - this
supports IPv6, and allows adding multiple addresses to the interface.

Although it isn't currently used in the code, we also add a
brDelInetAddress for completeness' sake.

Also, while we're modifying bridge.c, we change brSetForwardDelay and
brSetEnableSTP to use the new virCommand API rather than the
deprecated virRun, and also log an error message in bridge_driver.c if
either of those fail (previously the failure would be completely
silent).
2010-12-23 15:53:26 -05:00
Wen Congyang
9a4af303fc fix syntax error in configure.ac
When I run configure, I receive some syntax error.

.....
checking where to find <rpc/rpc.h>... none
checking for library containing dlopen... -ldl
/configure: line 52500: test: =: unary operator expected
/configure: line 52766: test: =: unary operator expected
checking linux/kvm.h usability... yes
checking linux/kvm.h presence... yes
.....

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2010-12-23 09:29:41 -07:00
Matthias Bolte
42b2f35d36 esx: Move VMX handling code out of the driver directory
Now the VMware driver doesn't depend on the ESX driver anymore.

Add a WITH_VMX option that depends on WITH_ESX and WITH_VMWARE.
Also add a libvirt_vmx.syms file.

Move some escaping functions from esx_util.c to vmx.c.

Adapt the test suite, ESX and VMware driver to the new code layout.
2010-12-21 22:40:17 +01:00
Eric Blake
da24a892f2 build: make building on cygwin easier
* configure.ac (dlopen): Cygwin dlopen is in libc; avoid spurious
failure.
(XDR_CFLAGS): Define when needed.
* src/Makefile.am (libvirt_driver_remote_la_CFLAGS): Use it.
2010-12-20 11:14:27 -07:00
Eric Blake
8e2b26db94 build: allow older libselinux again
* configure.ac (with_selinux): Check for <selinux/label.h>.
* src/security/security_selinux.c (getContext): New function.
(SELinuxRestoreSecurityFileLabel): Use it to restore compilation
when using older libselinux.
2010-12-20 10:26:15 -07:00
Eric Blake
8837d3c7de build: allow autoconf 2.59 again
Autoconf 2.59 doesn't define ${localedir}, so libvirt was failing
to compile due to a missing LOCALEDIR until today's configmake fix.

* .gnulib: Update to latest for configmake fix.
* configure.ac (libpcap): Avoid AS_CASE.
2010-12-20 10:18:54 -07:00
Matthias Bolte
448347f8b0 vbox: Add glue layer for MSCOM on Windows
Don't require dlopen, but link to ole32 and oleaut32 on Windows.

Don't expose g_pVBoxFuncs anymore. It was only used to get the
version of the API. Make VBoxCGlueInit return the version instead.
This simplifies the implementation of the MSCOM glue layer.

Get the VirtualBox version from the registry.

Add a dummy implementation of the nsIEventQueue to the MSCOM glue
as there seems to be no direct equivalent with MSCOM. It might be
implemented using the normal window message loop. This requires
additional investigation.
2010-12-17 22:51:33 +01:00
Jean-Baptiste Rouault
cddd2a0628 Add VMware Workstation and Player driver 2010-12-17 21:19:39 +01:00
Eric Blake
65532f4558 maint: improve tests distribution
* tests/Makefile.am (EXTRA_DIST): Sort, and add directories.
(SUBDIRS): Drop automake recursion into subdirs.
* tests/commanddata/Makefile.am: Delete.
* tests/confdata/Makefile.am: Likewise.
* tests/sexpr2xmldata/Makefile.am: Likewise.
* tests/xencapsdata/Makefile.am: Likewise.
* tests/xmconfigdata/Makefile.am: Likewise.
* tests/xml2sexprdata/Makefile.am: Likewise.
2010-12-17 11:57:11 -07:00
Diego Elio Pettenò
30a4ee84c4 build: quote AC_LANG_PROGRAM to avoid warnings with autoconf 2.68 2010-12-13 11:01:15 -07:00
Diego Elio Pettenò
0b9ab2abf1 build: properly handle ./configure --with-libpcap
Without this fix, ./configure --with-libpcap will cause --with-libpcap=yes
to be implicitly passed down, which cause yes/bin/pcap-config to be
searched for rather than /usr/bin/pcap-config.

Also output pcap: no when pcap is not found or disabled.
2010-12-13 11:01:11 -07:00
Eric Blake
2a5ccbefb0 build: distribute commandtest files
* tests/Makefile.am (SUBDIRS): Add commanddata.
* tests/commandtest.c (checkoutput): Delete correct file.
(test4): Delete pid file.
(mymain): Delete unused variable.
* tests/commanddata/Makefile.am: New file.
* configure.ac (AC_OUTPUT): Build new makefile.
Reported by Dominik Klein.
2010-12-10 08:44:53 -07:00
Justin Clift
b113d279ee configure: improve misleading libnl missing error message
This fixes a misleading error message saying the libnl package
needs to be installed, when it's really the libnl-devel package
needing to be installed.
2010-12-08 14:21:58 +11:00
Daniel Veillard
a33db6cbfb Release of libvirt 0.8.6
- configure.ac libvirt.spec.in: bump version, add a missing systemtap
  build requirement
- docs/news.html.in: add informations about the release
- po/*: updated Polish and Dutch localizations, and regenerated
- tests/qemuxml2argvtest.c: Fix build problem
2010-11-30 20:42:46 +01:00
Daniel P. Berrange
9288c31bf7 Include a thread identifier in log messages
To allow messages from different threads to be untangled,
include an integer thread identifier in log messages.

* src/util/logging.c: Include thread ID
* src/util/threads.h, src/util/threads.h, src/util/threads-pthread.c:
  Add new virThreadSelfID() function
* configure.ac: Check for sys/syscall.h
2010-11-23 14:09:35 +00:00
Matthias Bolte
3bc0679f90 configure: Disable FS storage driver if mntent.h is not available
This is the case on FreeBSD.
2010-11-14 22:21:26 +01:00
Matthias Bolte
09c8c2e3ed configure: Remove bashism and replace 'test ==' with 'test ='
This also fixes configure problems on FreeBSD, as test doesn't
understand '==' there.
2010-11-12 21:38:27 +01:00
Daniel P. Berrange
7c08fcc439 Add a generic internal API for handling any FD based stream
To avoid the need for duplicating implementations of virStream
drivers, provide a generic implementation that can handle any
FD based stream. This code is copied from the existing impl
in the QEMU driver, with the locking moved into the stream
impl, and addition of a read callback

The FD stream code will refuse to operate on regular files or
block devices, since those can't report EAGAIN properly when
they would block on I/O

* include/libvirt/virterror.h, include/libvirt/virterror.h: Add
  VIR_FROM_STREAM error domain
* src/qemu/qemu_driver.c: Remove code obsoleted by the new
  generic streams driver.
* src/fdstream.h, src/fdstream.c, src/fdstream.c,
  src/libvirt_private.syms: Generic reusable FD based streams
2010-11-11 16:02:57 +00:00
Matthias Bolte
e65812d479 xen-proxy: Remove it entirely and use libvirtd instead
Suggested by danpb, as it's not up-to-date anymore and
lacks many functions that were added to libvirtd.
2010-11-08 22:00:35 +01:00
Daniel Veillard
4c2b3e1d29 Release of libvirt-0.8.5
* configure.ac libvirt.spec.in: new version
* docs/news.html.in: update news page and improve format
* po/*.po*: Update po again
2010-10-29 16:54:07 +02:00
Matthias Bolte
f4a8542dd5 vbox: Stop hardcoding a single path for VBoxXPCOMC.so
This partly reverts df90ca7661.

Don't disable the VirtualBox driver when configure can't find
VBoxXPCOMC.so, rely on detection at runtime again instead.

Keep --with-vbox=/path/to/virtualbox intact, added to for:
https://bugzilla.redhat.com/show_bug.cgi?id=609185

Detection order for VBoxXPCOMC.so:

1. VBOX_APP_HOME environment variable
2. configure provided location
3. hardcoded list of known locations
4. dynamic linker search path

Also cleanup the glue code and improve error reporting.
2010-10-29 15:50:38 +02:00
Eric Blake
5ee03c25f7 build: fix shell detection bug
A missing shell was noisy, and the use of command to decipher a
shell's absolute path requires "" rather than ''.

* configure.ac (lv_cv_wrapper_shell): Fix logic errors if candidate
shell is not available.
* .gitignore: Ignore file created when /bin/sh is old dash.
Reported by Matthias Bolte.
2010-10-26 15:55:12 -06:00
Eric Blake
f22e670b4a qemu: work around dash 0.5.5 bug in managed save
Older dash mistakenly truncates regular files when using <> redirection;
this kills our use of double dd to reduce storage overhead when
saving qemu images.  But qemu insists on running a command through
/bin/sh, so we work around it by having qemu run $sh -c 'real command'
when we have a replacement $sh in mind.

* configure.ac (VIR_WRAPPER_SHELL): Define to a replacement shell,
if /bin/sh is broken on <> redirection.
* src/qemu/qemu_monitor.h (VIR_WRAPPER_SHELL_PREFIX)
(VIR_WRAPPER_SHELL_SUFFIX): New macros.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrateToFile): Use
them.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONMigrateToFile):
Likewise.
2010-10-26 09:31:42 -06:00
Justin Clift
ff9bbffcd9 docs: make the location of the xml catalog file a configure option
The default location for the XML catalog file, /etc/xml/catalog,
used when validating the generated html docs, isn't correct for
MacOS X.

This commit adds an option to the configure script, allowing the
default to be overridden:

  --with-xml-catalog-file=/path/to/xml/catalog/file
2010-10-27 02:22:14 +11:00
Daniel P. Berrange
4b16b9c77f Include socket address in client probe data
It is useful to know where the client is connecting from,
so include the socket address in probe data.

* daemon/libvirtd.h: Use virSocketAddr for storing client
  address and keep printable address handy for logging
* daemon/libvirtd.c: Include socket address in client
  connect/disconnect probes
* daemon/probes.d: Add socket address to probes
* examples/systemtap/client.stp: Print socket address
* src/util/network.h: Add sockaddr_un to virSocketAddr union
2010-10-22 12:00:45 +01:00
Daniel P. Berrange
968eb4e5cd Add dtrace static probes in libvirtd
Adds initial support for dtrace static probes in libvirtd
daemon, assuming use of systemtap dtrace compat shim on
Linux. The probes are inserted for network client connect,
disconnect, TLS handshake states and authentication protocol
states.

This can be tested by running the xample program and then
attempting to connect with any libvirt client (virsh,
virt-manager, etc).

 # stap examples/systemtap/client.stp
  Client fd=44 connected readonly=0
  Client fd=44 auth polkit deny pid:24997,uid:500
  Client fd=44 disconnected
  Client fd=46 connected readonly=1
  Client fd=46 auth sasl allow test
  Client fd=46 disconnected

The libvirtd.stp file should also really not be required,
since it is duplicated info that is already available in
the main probes.d definition file. A script to autogenerate
the .stp file is needed, either in libvirtd tree, or better
as part of systemtap itself.

* Makefile.am: Add examples/systemtap subdir
* autobuild.sh: Disable dtrace for mingw32
* configure.ac: Add check for dtrace
* daemon/.gitignore: Ignore generated dtrace probe file
* daemon/Makefile.am: Build dtrace probe header & object
  files
* daemon/libvirtd.stp: SystemTAP convenience probeset
* daemon/libvirtd.c: Add connect/disconnect & TLS probes
* daemon/remote.c: Add SASL and PolicyKit auth probes
* daemon/probes.d: Master probe definition
* daemon/libvirtd.h: Add convenience macro for probes
  so that compilation is a no-op when dtrace is not available
* examples/systemtap/Makefile.am, examples/systemtap/client.stp
  Example systemtap script using dtrace probe markers
* libvirt.spec.in: Enable dtrace on F13/RHEL6
* mingw32-libvirt.spec.in: Force disable dtrace
2010-10-22 12:00:39 +01:00
Daniel P. Berrange
8f680ad3b8 Basic framework for auditing integration
Integrate with libaudit.so for auditing of important operations.
libvirtd gains a couple of config entries for auditing. By
default it will enable auditing, if its enabled on the host.
It can be configured to force exit if auditing is disabled
on the host. It will can also send audit messages via libvirt
internal logging API

Places requiring audit reporting can use the VIR_AUDIT
macro to report data. This is a no-op unless auditing is
enabled

* autobuild.sh, mingw32-libvirt.spec.in: Disable audit
  on mingw
* configure.ac: Add check for libaudit
* daemon/libvirtd.aug, daemon/libvirtd.conf,
  daemon/test_libvirtd.aug, daemon/libvirtd.c: Add config
  options to enable auditing
* include/libvirt/virterror.h, src/util/virterror.c: Add
  VIR_FROM_AUDIT source
* libvirt.spec.in: Enable audit
* src/util/virtaudit.h, src/util/virtaudit.c: Simple internal
  API for auditing messages
2010-10-19 17:31:31 +01:00
Eric Blake
8f11a9beb0 build: provide URL in 'configure --help'
* configure.ac (AC_INIT): Provide email and URL.
2010-10-14 05:51:01 -06:00
Eric Blake
2399597a7e build: fix mingw build
* .gnulib: Update to latest, for termios fix.
* configure.ac (AC_CHECK_HEADERS): Drop redundent check.
* bootstrap: Synchronize from upstream.
Reported by Daniel P. Berrange.
2010-10-14 05:51:01 -06:00
Justin Clift
577ad920d7 configure: disable network and storage-fs drivers on mac os x
Disabling these two drivers on MacOS X, where they are known to
not work, allows libvirt (including the daemon) to compile without
any further changes.
2010-10-06 00:29:58 +11:00
Justin Clift
8bd11f37c4 configure: tweak logic flow of virtport check
This fixes a small logic bug, where passing --without-macvtap
on the configure line, or otherwise indicating a lack of
support for macvtap, causes configure to bail.
2010-09-30 00:42:07 +10:00
Justin Clift
fc812dd974 mpath: disable devmapper-multipath checking on non-linux
The configure script was breaking on MacOS X unless passed:

  --without-storage-mpath

This patch leverages Stefan Bergers earlier work for nwfilter,
so non-linux systems don't even attempt to build multipath.
2010-09-30 00:25:19 +10:00
Stefan Berger
b502a6ebac Rework configure logic for virtualport support
In this patch I am reworking the logic around detecting virtual port support and requiring the libnl dependency.

- It requires --with-macvtap and displays an error in case of --without-macvtap --with-virtualport.
- It tests for availability of certain data in include files and displays an error in case the include file is not at the correct level and --with-virtualport was chosen
- displays 'checking' messages for macvtap and virtualport support and results
- libnl support is required when macvtap is found or requested; if libnl is not there, please supply without-macvtap
2010-09-29 07:56:26 -04:00
Justin Clift
637133bd54 virtualbox: fix a typo in the expected location on mac os x
Mac OS X provides an "/Applications" folder, not an "/Application" folder,
so installed VirtualBox wasn't being detected by default.

This 1 character patch fixes this.
2010-09-28 11:31:18 +10:00
Stefan Berger
2e7294df08 nwfilter: Don't compile nwfilter driver on other systems than Linux
Don't compile the nwfilter driver (instantiating the rules) on other systems than Linux.
2010-09-27 15:44:27 -04:00