Commit Graph

837 Commits

Author SHA1 Message Date
Andrea Bolognani
5b479f3b5b build: Standardize on .pod -> .x.in -> .x
After this commit, all man pages are generated using the same two
steps:

  1. Process a source $command.pod file with pod2man(1) to obtain
     a valid man page in $command.$section.in

  2. Process $command.$section.in with sed(1) to obtain the final
     man page in $command.$section
2016-04-25 15:40:44 +02:00
Andrea Bolognani
90709d8d22 build: Build man pages in $(builddir)
No file should be created inside $(srcdir) during build.
2016-04-25 15:40:43 +02:00
Andrea Bolognani
71c22b186c build: Fix default network generation on FreeBSD
FreeBSD's sed(1) doesn't support using "\n" to insert a newline,
so the installed default.xml file ends up containing a literal
"n" between tags; to work around this problem, add a tr(1)
invocation as suggested by the sed FAQ[1].

[1] http://sed.sourceforge.net/sedfaq4.html (4.1 c)
2016-04-21 16:45:20 +02:00
Andrea Bolognani
d0062fb9b5 dist: ln(1) is not guaranteed to have a '-f' option
According to the autoconf manual, using '$(LN_S) -f' is not
portable; remove the target explicitly beforehand to work around
this limitation.

Adjust some slightly awkward indentation while at it.
2016-04-21 15:36:14 +02:00
Andrea Bolognani
ed5c929777 build: Use $(LN_S) safely
The autoconf documentation recommends to always use this
construct when creating symbolic links with $(LN_S) to avoid
unexpected behavior.
2016-04-21 10:02:36 +02:00
Andrea Bolognani
ce8379eedc build: Overwrite existing symbolic links
The current rule fails if the target already exists:

  cd /home/jenkins/build/libvirt/lib && \
    ln -s libnss_libvirt.so.1 nss_libvirt.so.1
  ln: nss_libvirt.so.1: File exists
  Makefile:3357: recipe for target 'install-exec-hook' failed

However, all other rules concerned with installation are
idempotent and will happily overwrite an existing target,
so this one should as well.
2016-04-21 10:02:36 +02:00
Andrea Bolognani
2561d4e395 build: Always use $(LN_S) and $(MKDIR_P)
autotools provide those for our convenience, so let's use them
everywhere instead of mixing in native command invocation.
2016-04-21 10:02:36 +02:00
Cole Robinson
e7db227810 util: Add virGettextInitialize, convert the code
Take setlocale/gettext error handling pattern from tools/virsh-*
and use it for all standalone binaries via a new shared
virGettextInitialize routine. The virsh* pattern differed slightly
from other callers. All users now consistently:

* Ignore setlocale errors. virsh has done this forever, presumably for
  good reason. This has been partially responsible for some bug reports:

  https://bugzilla.redhat.com/show_bug.cgi?id=1312688
  https://bugzilla.redhat.com/show_bug.cgi?id=1026514
  https://bugzilla.redhat.com/show_bug.cgi?id=1016158

* Report the failed function name
* Report strerror
2016-04-14 13:22:40 -04:00
Maxim Nestratov
4dc5d8f2c1 fix build by correcting functions order and src/Makefile.am
commit 30c61901 added new functions to libvirt_private.syms
not alpabetically sorted and erroneously added vz sources to
STATEFUL_DRIVER_SOURCE_FILES, which triggered check-aclrules
running while vz driver isn't ready for it yet.

Pushing under build-breaker rule.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-14 03:09:19 +03:00
Maxim Nestratov
30c61901c8 vz: build driver as module and don't register it on client's side
Make it possible to build vz driver as a module and don't link it with
libvirt.so statically.
Remove registering it on client's side as far as we start relying on daemon

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:43 +03:00
John Ferlan
2844de6f40 secret: Introduce virSecretGetSecretString
Commit id 'fb2bd208' essentially copied the qemuGetSecretString
creating an libxlGetSecretString.  Rather than have multiple copies
of the same code, create src/secret/secret_util.{c,h} files and
place the common function in there.

Modify the the build in order to build the module as a library
which is then pulled in by both the qemu and libxl drivers for
usage from both qemu_command.c and libxl_conf.c
2016-04-06 20:31:21 -04:00
Guido Günther
12b239a9fa Link libvirt_xenconfig instead of libvirt against libxl
to avoid the test failure

 7) Test driver "xen"  ... 2016-03-31 12:53:26.950+0000: 22430: debug : virDriverLoadModule:54 : Module load xen
 2016-03-31 12:53:26.950+0000: 22430: error : virDriverLoadModule:73 : failed to load module /build/libvirt-1.3.3~rc1/debian/build/src/.libs/libvirt_driver_xen.so /build/libvirt-1.3.3~rc1/debian/build/src/.libs/libvirt_driver_xen.so: undefined symbol: xlu_cfg_destroy
FAILED
2016-04-06 20:26:59 +02:00
Qiaowei Ren
28b446292b perf: implement a set of util functions for perf event
This patch implement a set of interfaces for perf event. Based on
these interfaces, we can implement internal driver API for perf,
and get the results of perf conuter you care about.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Message-id: 1459171833-26416-4-git-send-email-qiaowei.ren@intel.com
2016-03-29 13:13:05 +01:00
Michal Privoznik
7dbcb26f7f nss: Implement _nss_libvirt_gethostbyname3_r
The implementation is pretty straightforward. Moreover, because
of the nature of things, gethostbyname_r and gethostbyname2_r can
be implemented at the same time too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-18 17:29:53 +01:00
Michal Privoznik
fd9514f8d2 Export virLease* functions for leases file handling
These functions are going to be reused very shortly. So instead
of duplicating the code, lets move them into utils module.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-18 17:29:53 +01:00
Jiri Denemark
1a0f076dd6 Use correct LDFLAGS for leaseshelper
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-03-03 13:23:46 +01:00
John Ferlan
de71e0e500 qemu: Move qemuAssign*Alias* API's into their own module
Create a new module qemu_alias.c to handle the qemuAssign*Alias* APIs
and the qemuDomainDeviceAliasIndex
2016-02-16 11:07:48 -05:00
John Ferlan
177db48734 qemu: Move qemuDomain*Address* functions
Create new modules qemu_domain_address.c and qemu_domain_address.h to
contain all the new functions and header data. Additionally move any
supporting static functions.

Make qemuDomainSupportsPCI non static.

Also, move and rename the following:

qemuSetSCSIControllerModel to qemuDomainSetSCSIControllerModel
qemuCollectPCIAddress to qemuDomainCollectPCIAddress
qemuValidateDevicePCISlotsPIIX3 to qemuDomainValidateDevicePCISlotsPIIX3
qemuAssignDevicePCISlots to qemuDomainAssignDevicePCISlots

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-02-16 11:07:47 -05:00
Andrea Bolognani
e76bef7f7b gic: Introduce virGICVersion enumeration
We currently blindly accept any numeric value as a GIC version, even
though only GIC v2 and GIC v3 actually exist; on the other hand, we
reject "host", which is a perfectly legitimate value for QEMU guests.

This new enumeration contains all GIC versions libvirt is aware of.
2016-02-16 14:58:58 +01:00
John Ferlan
d860b2f537 qemu: Split the command parsing routines into own module
Extract out the qemuParseCommandLine{String|Pid} into their own
separate module - taking with it all the various static functions.

Causes a ripple effect with a few other modules to include the
new qemu_parse_command.h.

Narrowed down the list of #include's in the split out module to
those that are necessary for build.
2016-02-10 15:21:37 -05:00
Pavel Hrdina
36785c7e77 device: cleanup input device code
The current code was a little bit odd.  At first we've removed all
possible implicit input devices from domain definition to add them later
back if there was any graphics device defined while parsing XML
description.  That's not all, while formating domain definition to XML
description we at first ignore any input devices with bus different to
USB and VIRTIO and few lines later we add implicit input devices to XML.

This seems to me as a lot of code for nothing.  This patch may look
to be more complicated than original approach, but this is a preferred
way to modify/add driver specific stuff only in those drivers and not
deal with them in common parsing/formating functions.

The update is to add those implicit input devices into config XML to
follow the real HW configuration visible by guest OS.

There was also inconsistence between our behavior and QEMU's in the way,
that in QEMU there is no way how to disable those implicit input devices
for x86 architecture and they are available always, even without graphics
device.  This applies also to XEN hypervisor.  VZ driver already does its
part by putting correct implicit devices into live XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-26 17:53:33 +01:00
Martin Kletzander
4b47f9b82c Fix make check with gcc version 5
When building with gcc-5 (particularly gcc-5.3.0 now) and having pdwtags
installed (package dwarves) make check fails with the following error:

  $ make lock_protocol-struct
  GEN      lock_protocol-struct
  --- lock_protocol-structs	2016-01-13 15:04:59.318809607 +0100
  +++ lock_protocol-struct-t3	2016-01-13 15:05:17.703501234 +0100
  @@ -26,10 +26,6 @@
           virLockSpaceProtocolNonNullString name;
           u_int                      flags;
   };
  -enum virLockSpaceProtocolAcquireResourceFlags {
  -        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
  -        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
  -};
   struct virLockSpaceProtocolAcquireResourceArgs {
           virLockSpaceProtocolNonNullString path;
           virLockSpaceProtocolNonNullString name;
  Makefile:10415: recipe for target 'lock_protocol-struct' failed
  make: *** [lock_protocol-struct] Error 1

That happens because without any specific options gcc doesn't keep enum
information in the resulting binary object.  I managed to isolate the
parameters of gcc that caused this issue to disappear, however I
remember that they influenced the resulting binaries quite a bit and
were definitely not something we would want to add as mandatory to the
build process.

So to deal with this cleanly, let's take that enum and separate it out
to its own header file.  Since it is only used in the lockd driver and
the protocol, lock_driver_lockd.h feels like a suitable name.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-18 15:19:21 +01:00
Jasper Lievisse Adriaanse
2b6f6ad64b Unify int types handling in protocol files
Some of the protocol files already include handing of the missing int
types such as xdr_uint64_t, some don't. To fix it everywhere, move out
of the appropriate defines to the utils/virxdrdefs.h file and include
it where needed.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2016-01-11 19:56:06 +03:00
Cédric Bosdonnat
bec787ee9d Allow building lxc without virt-login-shell
Add a configure option to disable virt-login-shell build even if lxc is
enabled.
2015-12-17 15:49:06 +01:00
Martin Kletzander
2340f3ebfb admin: Distribute libvirt-admin.conf
Commit 48cd3dfa66 introduced configuration
file for libvirt-admin but forgot to distribute it.  Also the change
made to libvirt.conf in commit dbecb87f94
should've been removed thanks to introduction of separate config file.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-12-01 11:44:48 +01:00
Martin Kletzander
524492dcea admin: Include admin_remote.c in the dist package
Otherwise all builds from the package will fail.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-12-01 08:59:33 +01:00
Martin Kletzander
97c9ddefa1 build: Create needed folders without dependency tracking
The parameter --disable-dependency-tracking is supposed to speed up
one-time build due to the fact that it disables some dependency
extractors that, apparently, take longer time to execute.  That is a
problem for code that is generated into builddir (especially some
specific subdirectory) because the directory it should be installed to
does not exists in VPATH and without the dependency tracking is not
created.  Generating such file hence fails with -ENOENT.  In order to
keep generating files into builddir instead of srcdir, we must create
the directory ourselves.  This should finally fix the problem that is
being fixed multiple times since its introduction in commit a9fe620372
and let us continue with cleaning those parts of Makefiles that depend
on generating files into the srcdir rather than builddir as it should
be.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-11-30 15:48:17 +01:00
Michal Privoznik
90f3c0d717 conf: Split virDomainObjList into a separate file
Our domain_conf.* files are big enough. Not only they contain XML
parsing code, but they served as a storage of all functions whose
name is virDomain prefixed. This is just wrong as it gathers not
related functions (and modules) into one big file which is then
harder to maintain. Split virDomainObjList module into a separate
file called virdomainobjlist.[ch].

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-11-30 13:55:10 +01:00
Daniel P. Berrange
6bb575d128 logging: remove reference to non-existent augeas files
The libvirt_logd.aug and test_libvirt_logd.aug.in files
have never existed so shouldn't be in EXTRA_DIST. It was
a copy+paste mistake when closing virtlogd from virtlockd

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-27 14:24:25 +00:00
Daniel P. Berrange
37ed422404 logging: add client for virtlogd daemon
Add the virLogManager API which allows for communication with
the virtlogd daemon to RPC program. This provides the client
side API to open log files for guest domains.

The virtlogd daemon is setup to auto-spawn on first use when
running unprivileged. For privileged usage, systemd socket
activation is used instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:30:13 +00:00
Daniel P. Berrange
19e5db4ae2 logging: introduce log handling protocol
Define a new RPC protocol for the virtlogd daemon that provides
for handling of logs. The initial RPC method defined allows a
client to obtain a file handle to use for writing to a log
file for a guest domain. The file handle passed back will not
actually refer to the log file, but rather an anonymous pipe.
The virtlogd daemon will forward I/O between them, ensuring
file rotation happens when required.

Initially the log setup is hardcoded to cap log files at
128 KB, and keep 3 backups when rolling over, which gives
a max usage of 512 KB per guest.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:28:55 +00:00
Daniel P. Berrange
323a329b26 Import stripped down virtlockd code as basis of virtlogd
Copy the virtlockd codebase across to form the initial virlogd
code. Simple search & replace of s/lock/log/ and gut the remote
protocol & dispatcher. This gives us a daemon that starts up
and listens for connections, but does nothing with them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:28:55 +00:00
Daniel P. Berrange
910e65d973 util: add APIs for reading/writing from/to rotating files
Add virRotatingFileReader and virRotatingFileWriter objects
which allow reading & writing from/to files with automation
rotation to N backup files when a size limit is reached. This
is useful for guest logging when a guaranteed finite size
limit is required. Use of external tools like logrotate is
inadequate since it leaves the possibility for guest to DOS
the host in between invokations of logrotate.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-11-26 14:28:55 +00:00
Eric Blake
4117e80332 build: include xdr cflags for libvirt-admin
Without this, building on cygwin fails with:

  CC       libvirt_admin_la-libvirt-admin.lo
libvirt-admin.c:25:21: fatal error: rpc/rpc.h: No such file or directory
 #include <rpc/rpc.h>
                     ^

Reported-by: Yaakov Selkowitz <yselkowi@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2015-10-13 14:39:08 -06:00
Andrea Bolognani
6c928996e6 src: Remove $(builddir) usage
Commit 4e8032272f used $(builddir) in the header search
path to fix a build issue; however, $(builddir) is not defined
by old autoconf versions such as the one available in CentOS 5,
resulting in the following error:

  cc1: error: /util: No such file or directory
  make[3]: *** [libvirt_driver_la-fdstream.lo] Error 1

Since $(builddir) is defined to always be '.', just use that
value directly instead.
2015-10-09 13:04:56 +02:00
Andrea Bolognani
4e8032272f src: Include $(builddir)/util in the header search path
Since a9fe620372, we are generating virkeymaps.h at build
time; however, we are not including $(builddir)/util in the
header search path, so when doing a VPATH build the compiler
is unable to locate the file.

make[2]: Entering directory
`/home/jenkins/libvirt/systems/libvirt-fedora-20/build/src'
  GEN      util/virkeymaps.h
  ...
  CC       util/libvirt_util_la-virkeycode.lo
  CC       util/libvirt_util_la-virkeyfile.lo
  CC       util/libvirt_util_la-virlockspace.lo
  CC       util/libvirt_util_la-virlog.lo
../../src/util/virkeycode.c:27:24: fatal error: virkeymaps.h: No such file or directory
 #include "virkeymaps.h"
                        ^
compilation terminated.
2015-10-09 09:40:37 +02:00
Maxim Nestratov
bd6ae7b8ab vz: remove storage driver as never used
In fact, it was never used as far as vz has no features supporting it.
That is why there will be no harm to anyone if we just remove this code to
prevent further misunderstanding and efforts to support dead code.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Maxim Nestratov
439f29e78c vz: remove network driver as never used
At the time this code was added we had intentions to support libvirt interface
to manage vz networks. In fact, it was never implemented completely to work
correctly that makes me think that there will be no harm to anyone if we just
rip it off. Moreover, in vz7 we started to use libvirt bridge network driver to
manage networks.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Martin Kletzander
a9fe620372 Do not distribute generated virkeymaps.h
We are distributing virkeymaps.h and all the tools needed to rebuild
that file.  On top of that, we are generating that file into the
$(srcdir) and that sometimes fails when trying to do make dist in VPATH
on rawhide fedora.  And we don't clean the file when maintainer-clean
make target is requested.  So let's not distribute the file and rather
let everyone rebuild it when needed and clean it when appropriate.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-10-06 15:10:36 +02:00
Luyao Huang
789bdd7dea Makefile: fix build fail when make rpm
Build fail and error like this:

  CC       qemu/libvirt_driver_qemu_impl_la-qemu_command.lo
qemu/qemu_capabilities.c:46:27: fatal error: qemu_capspriv.h: No such file or directory
 #include "qemu_capspriv.h"

Add qemu_capspriv.h to source.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
2015-09-23 08:06:56 +02:00
Martin Kletzander
f05f005c8b qemu: Allow others to browse /var/lib/libvirt/qemu
Commit f1f68ca334 tried fixing running multiple domains under various
users, but if the user can't browse the directory, it's hard for the
qemu running under that user to create the monitor socket.

The permissions need to be fixed in two places in the spec file due to
support for both installations with and without driver modules.

Creating a directory with '$(MKDIR_P) -m' shouldn't fail even on systems
where autoconf needs to fallback to 'install-sh -d'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146886

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-09-14 10:06:00 +02:00
Michal Privoznik
a0d2ceb32f src: Check for symbols ordering in ADMIN_SYM_FILES
Like we are checking for the correct order in SYM_FILES, we
should do the same for ADMIN_SYM_FILES.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-08-31 12:45:16 +02:00
Michal Privoznik
28fa50d226 src: Cleanup libvirt_admin.syms
It's a generated file, so after 'distclean' it should be gone.
But it isn't yet.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-08-31 11:37:45 +02:00
Michal Privoznik
74f11dd25b src: Check libvirt_admin.syms for exported symbols
We have this check rule in src/Makefile: check-symfile that
should check if all symbols we wanted to export are exported.
Moreover, if we are not exporting something more. Do the same
with libvirt_admin.syms.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-08-31 11:35:46 +02:00
ik.nitk
c27553b6e2 lxc: Inherit namespace feature
This patch adds feature for lxc containers to inherit namespaces.
This is very similar to what lxc-tools or docker provides.  Look
for "man lxc-start" and you will find that you can pass command
args as [ --share-[net|ipc|uts] name|pid ]. Or check out docker
networking option in which you can give --net=container:NAME_or_ID
as an option for sharing +namespace.

>From this patch you can add extra libvirt option to share
namespace in following way.

 <lxc:namespace>
   <lxc:sharenet type='netns' value='red'/>
   <lxc:shareipc type='pid' value='12345'/>
   <lxc:shareuts type='name' value='container1'/>
 </lxc:namespace>

The netns option is specific to sharenet. It can be used to
inherit from existing network namespace.

Co-authored: Daniel P. Berrange <berrange@redhat.com>
2015-08-26 11:28:30 +01:00
Guido Günther
a2c5d16a70 libvirt-admin: Generate symbols file
Since we're linking this into libvirtd we need some symbols to be public
but not part of the public API so mark them as
LIBVIRT_ADMIN_PRIVATE_<VERSION> as we do with libvirt.

Making all other symbols local makes sure we don't accidentally leak
unwanted ones.
2015-08-20 10:19:27 +02:00
Andrea Bolognani
ef770f0160 cpu: Rename {powerpc,ppc} => ppc64 (filesystem)
The driver only supports VIR_ARCH_PPC64 and VIR_ARCH_PPC64LE.

Just shuffling files around and updating the build system
accordingly. No functional changes.
2015-08-05 13:30:16 +02:00
Martin Kletzander
0aa81bbdc3 Escape left brace as new perl suggests
After upgrade to perl-5.22.0, it started complaining about one of our
scripts.  The thing is that even though it works, it wants all curly
brackets escaped properly.  The change is not functional, it merely gets
rid of the following error:

  Unescaped left brace in regex is deprecated, passed through in regex;
  marked by <-- HERE in m/^enum { <-- HERE / at -e line 3.

There is one more error like this that I'm getting, but it is because of
GNU automake bug #21001:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21001

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-07-20 10:35:18 +02:00
Maxim Nestratov
9156991668 parallels: substitute parallels with vz spec file and Makefile
Since we have changed the name of the driver to vz, let's
reference it as vz everywhere.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-17 15:07:55 +03:00
Maxim Nestratov
e6d180f07f parallels: rename all parallels files and driver directory to vz
This patch moves all src/parallels/parallels* files to vz/vz*
and fixes build accordingly.
No functional changes.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-17 15:07:55 +03:00