]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agosecret: Introduce virSecretObjListAdd* and virSecretObjListRemove
John Ferlan [Tue, 19 Apr 2016 20:05:38 +0000 (16:05 -0400)]
secret: Introduce virSecretObjListAdd* and virSecretObjListRemove

Add the functions to add/remove elements from the hashed secret obj list.
These will replace secret_driver functions secretAssignDef and secretObjRemove.

The virSecretObjListAddLocked will perform the necessary lookups and
decide whether to replace an existing hash entry or create a new one.
This includes setting up the configPath and base64Path as well as being
able to support the caller's need to restore from a previous definition
in case something goes wrong in the caller.

9 years agosecret: Introduce virSecretUsageIDForDef
John Ferlan [Tue, 19 Apr 2016 19:20:20 +0000 (15:20 -0400)]
secret: Introduce virSecretUsageIDForDef

Move the driver specific secretUsageIDForDef into secret_conf.c. It could
be more of a general purpose API.

9 years agosecret: Introduce virSecretObjListFindBy{UUID|Usage} support
John Ferlan [Tue, 19 Apr 2016 19:13:00 +0000 (15:13 -0400)]
secret: Introduce virSecretObjListFindBy{UUID|Usage} support

New API's including unlocked and Locked versions in order to be able
to use in either manner.

Support for searching hash object lists instead of linked lists will
replace existing secret_driver functions secretFindByUUID and
secretFindByUsage

9 years agosecret: Create virsecretobj.c and virsecretconf.h
John Ferlan [Sat, 27 Feb 2016 11:49:12 +0000 (06:49 -0500)]
secret: Create virsecretobj.c and virsecretconf.h

Move virSecretObj from secret_driver.c to virsecretobj.h

To support being able to create a hashed secrets list, move the
virSecretObj to virsecretobj.h so that the code can at least find
the definition.

This should be a temporary situation while the virsecretobj.c code
is patched in order to support a hashed secret object while still
having the linked list support in secret_driver.c. Eventually, the
goal is to move the virSecretObj into virsecretobj.c, although it
is notable that the existing model from which virSecretObj was
derived has virDomainObj in src/conf/domain_conf.h and virNetworkObj
in src/conf/network_conf.h, so virSecretObj wouldn't be unique if
it were to remain in virsecretobj.h  Still adding accessors to fetch
and store hashed object data will be the end goal.

Add definitions and infrastucture in virsecretobj.c to create and
handle a hashed virSecretObj and virSecretObjList including the class,
object, lock setup, and disposal API's. Nothing will call these yet.

This infrastructure will replace the forward linked list logic
within the secret_driver, eventually.

9 years agowireshark: Fix distcheck
Michal Privoznik [Thu, 21 Apr 2016 05:33:01 +0000 (07:33 +0200)]
wireshark: Fix distcheck

Our distcheck is broken. Well, it works but only by pure chance.
When wireshark plugin is enabled, we try to query which path
should the plugin be installed into. Firstly, we try to ask
pkg-config as some releases of wireshark already sets
corresponding variable in their pkg-config files. However, if we
obtained no value from there we try to construct the path on our
own. Based on our observations it usually is:
$libdir/wireshark/plugins/$version/.
Now, the problem is in the way we are deciding whether we have
obtained the plugin directory from pkg-config or not. Simply
said, we are checking wrong variable. The variable we are
checking has never been set, thus in our test is empty and
therefore we will always construct the plugin dir path on our
own, regardless of its presence in the pkg-config file.
To make things worse, after fixing this problem, VPATH build was
broken as it now tried to install plugin into correct directory.
Yes, this is problem, because --prefix was not honoured and
everything but the plugin was installed into given prefix. I've
managed to resolve this issue by replacing plugin dir prefix with
our own. So when doing regular installation (our prefix ==
wireshark prefix), nothing changes. When doing VPATH build &
installation plugin is installed into correctly prefixed dir.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotools: Introduce install-nss targets
Michal Privoznik [Wed, 20 Apr 2016 08:14:23 +0000 (10:14 +0200)]
tools: Introduce install-nss targets

We do have something similar for installing init system files.
Basically I'm trying to avoid the following warning produced by
automake:

tools/Makefile.am:429: warning: uninstall-local was already defined in condition TRUE, which includes condition WITH_BSD_NSS ...
tools/Makefile.am:292: ... 'uninstall-local' previously defined here

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoMakefile: Enable distuninstallcheck again
Michal Privoznik [Wed, 20 Apr 2016 07:27:06 +0000 (09:27 +0200)]
Makefile: Enable distuninstallcheck again

This target has been disabled historically for whatever reason.
Now that we do uninstall properly enable the test again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuProcessCreatePretendCmd: Rework FIPS handling
Michal Privoznik [Mon, 25 Apr 2016 05:47:59 +0000 (07:47 +0200)]
qemuProcessCreatePretendCmd: Rework FIPS handling

This function - in contrast with qemuBuildCommandLine - merely
constructs our internal command representation of a domain. This
is then later compared against expected output. Or, this function
is used also in virConnectDomainXMLToNative(). But due to a copy
paste error this function, just like its image - has @forceFips
argument that if enabled forces FIPS, otherwise mimics FIPS state
in the host. If FIPS is enabled or forced the generated command
line is different to state in which FIPS is disabled. Problem is,
while this could be desired in the virConnectDomainXMLToNative()
case, this is undesirable in the test suite as it will produce
unpredicted results.
Solution to this is to rename argument to @enableFips to
specifically tell whether we expect command line to be build in
either of fashions and make virConnectDomainXMLToNative()
implementation fetch FIPS state and pass it to
qemuProcessCreatePretendCmd().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: fix error log in qemuAssignPCIAddresses()
Laine Stump [Tue, 19 Apr 2016 16:53:02 +0000 (12:53 -0400)]
qemu: fix error log in qemuAssignPCIAddresses()

This error message was too specific, based on the incorrect assumption
that any error was cause by auto-added bridges:

  failed to create PCI bridge on bus 2: too many devices
  with fixed addresses

In practice you can't know if a bridge with an index <= the bus it's
connecting to was added automatically, or if it was a mistake in
explicit config, and the auto-add problem is going to be dealt with in
a different way in an upcoming patch. The new message is this:

  PCI Controller at index 1 (0x01) has "
  bus='0x02', but bus must be <= index

(note that index is given in both decimal and hex because it is
formatted as decimal in the XML, but bus is formatted as hex, and
displaying the hex value of index makes it easier to see the problem
when index > 9 (which will often be the case with PCIe, since most
controllers only have a single port, not 32 slots as with standard
PCI)).

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

9 years agoman: Fix links
Andrea Bolognani [Wed, 13 Apr 2016 17:46:06 +0000 (19:46 +0200)]
man: Fix links

Use L<> instead of C<> for URLs and man pages.

9 years agoman: Fix SYNOPSIS section
Andrea Bolognani [Wed, 13 Apr 2016 17:57:37 +0000 (19:57 +0200)]
man: Fix SYNOPSIS section

Format the text properly.

9 years agoman: Fix NAME section
Andrea Bolognani [Wed, 13 Apr 2016 17:34:01 +0000 (19:34 +0200)]
man: Fix NAME section

podchecker(1) complained about these, eg.

  *** WARNING: Verbatim paragraph in NAME section at line 3 in
               file tools/virt-host-validate.pod

9 years agobuild: Always ship virt-login-shell.conf
Andrea Bolognani [Wed, 13 Apr 2016 17:24:51 +0000 (19:24 +0200)]
build: Always ship virt-login-shell.conf

No need to special-case this one: we can add it to EXTRA_DIST so
that it will be shipped in any case, and if WITH_LOGIN_SHELL
happens to be enabled we mark it for installation as well.

9 years agobuild: Replace variables in man pages
Andrea Bolognani [Wed, 13 Apr 2016 16:52:12 +0000 (18:52 +0200)]
build: Replace variables in man pages

We can't use eg. @sysconfdir@ directly in the .pod file, because
pod2man(1) will interpret that as a variable name and format it
accordingly.

Instead, we use eg. SYSCONFDIR and use a subsequent sed(1) call
to turn it into the expected @sysconfdir@.

9 years agobuild: Ensure intermediate files are cleaned up properly
Andrea Bolognani [Wed, 13 Apr 2016 15:12:24 +0000 (17:12 +0200)]
build: Ensure intermediate files are cleaned up properly

All $(MANINFILES) should be deleted on distclean.

9 years agobuild: Group files
Andrea Bolognani [Wed, 13 Apr 2016 15:09:14 +0000 (17:09 +0200)]
build: Group files

Define $(PODFILES) and $(MANINFILES) so that adding a new man
page only requires changes in a few, well defined spots.

9 years agobuild: Never ship man pages
Andrea Bolognani [Tue, 12 Apr 2016 20:05:15 +0000 (22:05 +0200)]
build: Never ship man pages

The generated man pages may contain information that depend on
the build configuration, so they should not be shipped but
rather always built on the user's machine.

9 years agobuild: Standardize on .pod -> .x.in -> .x
Andrea Bolognani [Tue, 12 Apr 2016 20:28:27 +0000 (22:28 +0200)]
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

9 years agobuild: Perform post-processing on all man pages
Andrea Bolognani [Tue, 12 Apr 2016 20:15:45 +0000 (22:15 +0200)]
build: Perform post-processing on all man pages

Man pages in daemon/ and src/ are being already subjected to this
post-processing step: make it so those in tools/ are as well.

9 years agobuild: Build man pages in $(builddir)
Andrea Bolognani [Tue, 12 Apr 2016 19:32:21 +0000 (21:32 +0200)]
build: Build man pages in $(builddir)

No file should be created inside $(srcdir) during build.

9 years agobuild: Extract pod from source files
Andrea Bolognani [Tue, 12 Apr 2016 18:32:33 +0000 (20:32 +0200)]
build: Extract pod from source files

Instead of embedding the pod information inside the respective
source files, store them in separate files.

This allows us to reduce the number of custom build rules as
most of the information can be inferred for the file name;
moreover, text editors are more likely to use proper syntax
highlighting for standalone pod files.

9 years agobuild: Ship virt-admin.pod
Andrea Bolognani [Tue, 12 Apr 2016 19:35:52 +0000 (21:35 +0200)]
build: Ship virt-admin.pod

This is the source file for the virt-admin(1) manual page, so
it should be shipped.

9 years agovirsh: host: Use bitmap size in bytes rather than bit count
Peter Krempa [Mon, 25 Apr 2016 08:38:01 +0000 (10:38 +0200)]
virsh: host: Use bitmap size in bytes rather than bit count

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

9 years agoqemu: Fix off-by-one error in block I/O throttle messages
Martin Kletzander [Mon, 25 Apr 2016 09:54:56 +0000 (11:54 +0200)]
qemu: Fix off-by-one error in block I/O throttle messages

QEMU_BLOCK_IOTUNE_MAX is the maximum inclusively, so let's modify the
message so it makes sense.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agodocs: Fix some formatting oddities
Andrea Bolognani [Fri, 22 Apr 2016 11:51:50 +0000 (13:51 +0200)]
docs: Fix some formatting oddities

When describing attributes and elements, we mostly stick to
a certain pattern; however, there are a few cases when the
information is not presented in the usual way.

Since there doesn't seem to be any reason not to follow the
tried and true formula, rework those bits to fit the rest of
the documentation.

9 years agosyntax-check: Enforce <code> inside <dt> elements
Andrea Bolognani [Fri, 22 Apr 2016 09:12:10 +0000 (11:12 +0200)]
syntax-check: Enforce <code> inside <dt> elements

Commit 61b070cf20b5 cleaned up a number of cases where the <dt>
element was used to document symbols, but the symbol itself was
not inside a <code> element.

To make sure we don't end up having to clean up again a few
months from now, introduce a syntax-check rule that can spot
such mistakes.

All existing exceptions are marked as such, with either file
or line granularity depending on the case.

9 years agodocs: apibuild: Fix VPATH build
Peter Krempa [Fri, 22 Apr 2016 14:14:26 +0000 (16:14 +0200)]
docs: apibuild: Fix VPATH build

libvirt-common.h is generated into builddir/include/libvirt. apibuild.py
only operated on srcdir/inlcude/libvirt. With VPATH build
srcdir/docs/libvirt-libvirt-common.html would not get generated and make
RPM failed.

9 years agotests: consistently source test-lib.sh in scripts
Cole Robinson [Thu, 21 Apr 2016 17:50:18 +0000 (13:50 -0400)]
tests: consistently source test-lib.sh in scripts

This unifies the test scripts to all use the similar pattern added for
schematests in ace4aecd. This gives the following

- Enables running all tests from outside of tests/ dir
- Drops redundant abs_* definitions, which are set by test-lib.sh
- Drops unnecessary srcdir variable which was only used for sourcing
    test-lib.sh

Behavior changes:

- srcdir can no longer be overwritten, but I don't know why anyone would
    really need to...
- Script VERBOSE setting no longer prints commands executed by test-lib.sh.
    if anyone cares I suggest handling this in test-lib.sh which already
    has other verbose style handling

9 years agovbox: VIR_WARN if we don't support the API version
Cole Robinson [Fri, 22 Apr 2016 21:53:08 +0000 (17:53 -0400)]
vbox: VIR_WARN if we don't support the API version

We presently don't give any indication if the VirtualBox version
isn't in our support whitelist.

9 years agotests: remove 'reconnect' and 'statstest'
Cole Robinson [Thu, 21 Apr 2016 17:50:19 +0000 (13:50 -0400)]
tests: remove 'reconnect' and 'statstest'

These old tests expect to run against a real xen connection via
xend running on the host. Our intentions for the test suite are
that it doesn't require interacting with any specific host resources,
so these don't really belong here.

9 years agodocs: remove *other* reference to igmp for IPv6
Laine Stump [Fri, 22 Apr 2016 16:38:09 +0000 (12:38 -0400)]
docs: remove *other* reference to igmp for IPv6

This finishes the job started by commit 81f3839f8 - removing the
erroneous reference to nonexistent "igmp-ipv6" protocol.

9 years agodocs: Add bold style for <dt><code> elements
John Ferlan [Thu, 21 Apr 2016 11:54:30 +0000 (07:54 -0400)]
docs: Add bold style for <dt><code> elements

Add bolding for <dt><code> elements to make them "stick out" on the
page rather that just a stream of text where the elements only differ
by slightly different font style.

9 years agodocs: Use <code> inside <dt> for symbols
Andrea Bolognani [Thu, 21 Apr 2016 13:23:56 +0000 (15:23 +0200)]
docs: Use <code> inside <dt> for symbols

Most of the time, the <dt> tag is used when providing
documentation for a symbol; enclose symbols in <code> tags to
style them appropriately.

9 years agodocs: apibuild: Fix for python 2.6
Peter Krempa [Fri, 22 Apr 2016 08:08:56 +0000 (10:08 +0200)]
docs: apibuild: Fix for python 2.6

Ancient python didn't like the new list added in 99283874. Convert it to
a dict.

9 years agoqemu: Limit maximum block device I/O tune values
Martin Kletzander [Wed, 20 Apr 2016 14:14:02 +0000 (16:14 +0200)]
qemu: Limit maximum block device I/O tune values

The values are currently limited to LLONG_MAX which causes some
problems.  QEMU conveniently changed their maximum to 1e15 (1 PB) which
is enough for some time and we need to adapt to that so that we don't
throw "Unknown error" messages.  Strictly limiting these values actually
fixes some corner case values (off-by-one checks in QEMU probably).

Since values out of the new specified range do not overflow anything,
change the type of error as well.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: rename test_conf -> virconftest
Cole Robinson [Thu, 21 Apr 2016 15:36:05 +0000 (11:36 -0400)]
tests: rename test_conf -> virconftest

And confdata to virconfdata, since 'conf' can mean a few different
things in libvirt

9 years agotests: consistently name virsh tests with 'virsh-' prefix
Cole Robinson [Thu, 21 Apr 2016 15:30:55 +0000 (11:30 -0400)]
tests: consistently name virsh tests with 'virsh-' prefix

9 years agotests: build: Remove duplicate libvirtd test list
Cole Robinson [Thu, 21 Apr 2016 15:24:21 +0000 (11:24 -0400)]
tests: build: Remove duplicate libvirtd test list

Store the test list in libvirtd_test_scripts, and use it where
appropriate. This also fixes the fact that we didn't ship
virsh-uriprecedence when libvirtd build is disabled.

9 years agovirconf: Handle conf file without ending newline
Cole Robinson [Thu, 21 Apr 2016 00:25:31 +0000 (20:25 -0400)]
virconf: Handle conf file without ending newline

$ echo -n 'log_level=1' > ~/.config/libvirt/libvirtd.conf
$ libvirtd --timeout=10
2014-10-10 10:30:56.394+0000: 6626: info : libvirt version: 1.1.3.6, package: 1.fc20 (Fedora Project, 2014-09-08-17:50:42, buildvm-05.phx2.fedoraproject.org)
2014-10-10 10:30:56.394+0000: 6626: error : main:1261 : Can't load config file: configuration file syntax error: /home/rjones/.config/libvirt/libvirtd.conf:1: expecting a value: /home/rjones/.config/libvirt/libvirtd.conf

Rather than try to fix this in the depths of the parser, just catch
the case when a config file doesn't end in a newline, and manually
append a newline to the content before parsing

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

9 years agodocs: remove reference to non-existent "igmp-ipv6" protocol
Laine Stump [Thu, 21 Apr 2016 18:32:51 +0000 (14:32 -0400)]
docs: remove reference to non-existent "igmp-ipv6" protocol

IGMP is used on IPv4 networks tp setup multicast group memberships. On
IPv6, this job is done by Multicast Listener Discovery (MLD), which
uses ICMPv6 packets rather than its own IP protocol number like IGMP.

The nwfilter documentation lists "igmp-ipv6" as one of the possible
protocols, but this is ignored (and stripped from the xml). This patch
removes that erroneous reference.

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

9 years agonetwork: fix DHCPv6 on networks with prefix != 64
Laine Stump [Thu, 21 Apr 2016 18:03:18 +0000 (14:03 -0400)]
network: fix DHCPv6 on networks with prefix != 64

According to the dnsmasq manpage, the netmask for IPv4 address ranges
will be auto-deteremined from the interface dnsmasq is listening on,
but it can't do this for IPv6 for some reason - it instead assumes a
network prefix of 64 for all IPv6 address ranges. If this is
incorrect, dnsmasq will refuse to give out an address to clients,
instead logging this message:

 dnsmasq-dhcp[2380]: no address range available for DHCPv6 request via virbr0

The solution is for libvirt to add ",$prefix" to all IPv6 dhcp-range
arguments when building the dnsmasq.conf file.

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

9 years agoconf: disk: extract validation of startup policy
Peter Krempa [Wed, 20 Apr 2016 15:26:23 +0000 (17:26 +0200)]
conf: disk: extract validation of startup policy

9 years agoconf: disk: Extract checking of removable status
Peter Krempa [Wed, 20 Apr 2016 15:19:04 +0000 (17:19 +0200)]
conf: disk: Extract checking of removable status

9 years agoconf: disk: Move validation of disk bus vs disk type
Peter Krempa [Wed, 20 Apr 2016 15:11:52 +0000 (17:11 +0200)]
conf: disk: Move validation of disk bus vs disk type

9 years agoconf: disk: extract sgio/rawio validation
Peter Krempa [Wed, 20 Apr 2016 14:52:46 +0000 (16:52 +0200)]
conf: disk: extract sgio/rawio validation

9 years agoconf: disk: Don't bother setting removable state to 0 by default
Peter Krempa [Wed, 20 Apr 2016 14:40:48 +0000 (16:40 +0200)]
conf: disk: Don't bother setting removable state to 0 by default

9 years agoconf: disk: Initialize closed device tray state to 0
Peter Krempa [Wed, 20 Apr 2016 14:39:44 +0000 (16:39 +0200)]
conf: disk: Initialize closed device tray state to 0

Additionally avoid initializing it after being calloced.

9 years agoconf: disk: Extract disk type and device right away
Peter Krempa [Wed, 20 Apr 2016 14:35:26 +0000 (16:35 +0200)]
conf: disk: Extract disk type and device right away

Additionally switch to using a common temp variable for the xml
elements.

9 years agoconf: disk: Remove custom single-use temporary variables
Peter Krempa [Wed, 20 Apr 2016 14:16:22 +0000 (16:16 +0200)]
conf: disk: Remove custom single-use temporary variables

Use a single temporary variable instead shortening the code.

9 years agoconf: disk: Mark VIR_DOMAIN_DISK_IO_DEFAULT as 0 and simplify parsing
Peter Krempa [Wed, 20 Apr 2016 13:50:04 +0000 (15:50 +0200)]
conf: disk: Mark VIR_DOMAIN_DISK_IO_DEFAULT as 0 and simplify parsing

9 years agoconf: disk: Sanitize parsing of disk format
Peter Krempa [Wed, 20 Apr 2016 13:36:05 +0000 (15:36 +0200)]
conf: disk: Sanitize parsing of disk format

9 years agoconf: disk: Avoid temporary variable when parsing driver name
Peter Krempa [Wed, 20 Apr 2016 13:08:52 +0000 (15:08 +0200)]
conf: disk: Avoid temporary variable when parsing driver name

9 years agoconf: disk: Split out parsing of disk <driver> element
Peter Krempa [Wed, 20 Apr 2016 12:41:27 +0000 (14:41 +0200)]
conf: disk: Split out parsing of disk <driver> element

9 years agoconf: disk: Extract verification of disk config
Peter Krempa [Wed, 20 Apr 2016 13:01:44 +0000 (15:01 +0200)]
conf: disk: Extract verification of disk config

Rather than checking individual fields in dubious places extract them to
a central point.

9 years agobuild: Fix default network generation on FreeBSD
Andrea Bolognani [Thu, 21 Apr 2016 10:01:27 +0000 (12:01 +0200)]
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)

9 years agodaemonStreamHandleRead: Rework to follow our coding pattern
Michal Privoznik [Fri, 8 Apr 2016 14:56:28 +0000 (16:56 +0200)]
daemonStreamHandleRead: Rework to follow our coding pattern

Usually, we have this 'if() goto cleanup;' pattern in our new
code. It is going to be useful here too. Thing is, there was a
memleak. If there has been an error in
virNetServerProgramSendStreamError() or
virNetServerProgramSendStreamData() created message was never
freed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirNet{Client,Server}*Stream: Update comment
Michal Privoznik [Mon, 4 Apr 2016 14:44:27 +0000 (16:44 +0200)]
virNet{Client,Server}*Stream: Update comment

After 434de30da545aea137 the status values are prefixed VIR_NET_
rather than REMOTE_.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon stream: Remove useless empty lines from header file
Michal Privoznik [Mon, 4 Apr 2016 11:01:17 +0000 (13:01 +0200)]
daemon stream: Remove useless empty lines from header file

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon stream: Convert @tx in daemonClientStream to bool
Michal Privoznik [Mon, 4 Apr 2016 10:49:48 +0000 (12:49 +0200)]
daemon stream: Convert @tx in daemonClientStream to bool

This structure item is used as pure boolean. There's no need to
hold whole integer for it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemon stream: Prefer bool over unsigned int var:1
Michal Privoznik [Mon, 4 Apr 2016 10:46:19 +0000 (12:46 +0200)]
daemon stream: Prefer bool over unsigned int var:1

There is no need for doing that since we have a bool type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodaemonClientStream: Use unsigned int to store stream @serial
Michal Privoznik [Tue, 29 Mar 2016 15:33:14 +0000 (17:33 +0200)]
daemonClientStream: Use unsigned int to store stream @serial

The stream serial number is the serial number of the RPC call
that initiated a data transfer. And as such can never be
negative. Moreover, when looking up internal state for a stream,
the serial numbers are compared. But hey, the serial number in
message header is unsigned too!

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoinclude: common: Fix function formatting
Peter Krempa [Thu, 21 Apr 2016 12:49:18 +0000 (14:49 +0200)]
include: common: Fix function formatting

9 years agoapi: Generate docs for libvirt-common.h
Peter Krempa [Thu, 21 Apr 2016 12:35:29 +0000 (14:35 +0200)]
api: Generate docs for libvirt-common.h

Since commit f5d9c5d00cfc0c moved the virTypedParam stuff into
libvirt-common we did not generate any docs for them and neither did we
populate them into libvirt-api.xml. This broke the sanity check in
libvirt python. Fix it by generating docs for libvirt-common.h too.

9 years agoapibuild: Allow completely skipping certain macros
Peter Krempa [Thu, 21 Apr 2016 12:31:23 +0000 (14:31 +0200)]
apibuild: Allow completely skipping certain macros

Some macros don't make sense to be documented at all. Add infrastructure
to the web/api generator and add VIR_DEPRECATED and VIR_EXPORT_VAR as
macros we should not document.

9 years agoinclude: common: Fix file header for apibuild.py
Peter Krempa [Thu, 21 Apr 2016 12:27:24 +0000 (14:27 +0200)]
include: common: Fix file header for apibuild.py

Our docs/web generator would take the complete license text and put it
into the description of the file, since it depends on position of the
"Author:" line. Move the author line to the top and remove the spurious
emacs comment.

9 years agodist: ln(1) is not guaranteed to have a '-f' option
Andrea Bolognani [Thu, 21 Apr 2016 11:16:56 +0000 (13:16 +0200)]
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.

9 years agoqemu: process: split out startup XML validation
Cole Robinson [Wed, 20 Apr 2016 20:55:48 +0000 (16:55 -0400)]
qemu: process: split out startup XML validation

And document that these specific bits are done at startup time for
back compat reasons

9 years agoqemu: process: split out shmem startup warning
Cole Robinson [Wed, 20 Apr 2016 20:44:25 +0000 (16:44 -0400)]
qemu: process: split out shmem startup warning

Now we can return early and save some indentation

9 years agovirsh: Don't clear old connection if 'connect $uri' fails
Cole Robinson [Wed, 20 Apr 2016 17:56:27 +0000 (13:56 -0400)]
virsh: Don't clear old connection if 'connect $uri' fails

    virsh # list --all
     Id    Name                           State
    ----------------------------------------------------
     1     test                           running

    virsh # connect frob
    error: Failed to connect to the hypervisor
    error: no connection driver available for frob

    virsh # list --all
    error: failed to connect to the hypervisor
    error: no valid connection
    error: no connection driver available for frob

Seems sensible IMO to just not clear out the old connection state
until the new virConnectOpen succeeds.

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

9 years agolibvirt: Fix crash on URI without scheme
Cole Robinson [Wed, 20 Apr 2016 17:25:07 +0000 (13:25 -0400)]
libvirt: Fix crash on URI without scheme

My commit 0d1579572 crashes on a URI without a scheme, like via
'virsh --connect frob'

Add a check on uri->server too while we are at it, and centralize
them all

9 years agotests: virnetdaemontest: Enable testing for no-keepalive-required
Erik Skultety [Wed, 13 Apr 2016 19:06:00 +0000 (21:06 +0200)]
tests: virnetdaemontest: Enable testing for no-keepalive-required

Commit a8743c39 removed keepalive_required attribute from daemon, added a test
case for it, but forgot to enable the test itself in virnetdaemontest.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agotests: virnetdaemon: Replace tabs with spaces
Erik Skultety [Wed, 13 Apr 2016 18:41:16 +0000 (20:41 +0200)]
tests: virnetdaemon: Replace tabs with spaces

We already did this once, but somehow commit 252610f7 managed to bring the tabs
back again.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agotests: remove virnetservertest data leftovers
Erik Skultety [Tue, 12 Apr 2016 19:08:57 +0000 (21:08 +0200)]
tests: remove virnetservertest data leftovers

Commit a4746114 renamed virnetservertest to virnetdaemontest to reflect some
refactor changes to virNetServer code (which moved daemon-related parts to
virNetDaemon module). Moving test data from virnetserverdata to
virnetdaemondata was also part of the commit, but the commit failed to clean
half of the files that were copied (rather than moved).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agovirsh: re-fix help printing without connection
Roman Bogorodskiy [Thu, 21 Apr 2016 08:26:31 +0000 (11:26 +0300)]
virsh: re-fix help printing without connection

Re-do 0217089 so it does not add regression for commit c0726e0 that allowed to
print help without making a connection to the daemon.

9 years agobuild: Use $(LN_S) safely
Andrea Bolognani [Wed, 20 Apr 2016 17:24:22 +0000 (19:24 +0200)]
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.

9 years agobuild: Overwrite existing symbolic links
Andrea Bolognani [Wed, 20 Apr 2016 16:33:20 +0000 (18:33 +0200)]
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.

9 years agobuild: Add AC_PROG_LN_S to configure
Andrea Bolognani [Wed, 20 Apr 2016 17:15:56 +0000 (19:15 +0200)]
build: Add AC_PROG_LN_S to configure

We use $(LN_S) for creating symbolic links, but the appropriate
autoconf macro was not included among the checks for external
programs.

9 years agobuild: Always use $(LN_S) and $(MKDIR_P)
Andrea Bolognani [Wed, 20 Apr 2016 16:17:07 +0000 (18:17 +0200)]
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.

9 years agovirsh: perf: Remove unnecessary 'error' label
Peter Krempa [Thu, 21 Apr 2016 07:54:45 +0000 (09:54 +0200)]
virsh: perf: Remove unnecessary 'error' label

The only place that uses it doesn't warrant a separate label.

9 years agovirsh: perf: Don't leak domain
Peter Krempa [Thu, 21 Apr 2016 07:51:08 +0000 (09:51 +0200)]
virsh: perf: Don't leak domain

After failing to parse the perf event list, the code would return
failure without freeing the previously acquired object. Rearrange the
code to avoid the problem.

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

9 years agovirsh: don't override connection URI from argv
Roman Bogorodskiy [Thu, 21 Apr 2016 06:32:00 +0000 (09:32 +0300)]
virsh: don't override connection URI from argv

Currently, if a connection URI was specified on the command line by the
'-c' switch, virsh connects to it, but after connecting overrides its
value with the one it tries to obtain from the VIRSH_DEFAULT_CONNECT_URI
environment variable.

This makes virsh connecting to the wrong URI if it disconnects from the
hypervisor and then tries to reconnect, and also leaks the original connname.

Fix by calling virGetEnvBlockSUID() before virshParseArgv().

9 years agodocs: domain: Document network <filterref>
Cole Robinson [Fri, 15 Apr 2016 21:58:00 +0000 (17:58 -0400)]
docs: domain: Document network <filterref>

The proper nwfilter docs go into full detail, but we should still
have a brief bit about domain XML in the domain documentation

9 years agodocs: Don't leave any documentation behind
Michal Privoznik [Tue, 19 Apr 2016 11:22:27 +0000 (13:22 +0200)]
docs: Don't leave any documentation behind

Our uninstall script is not exact counterpart of install one.
Therefore we are leaving couple of files behind. This should not
happen.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodocs: Uninstall libvirt logo too
Michal Privoznik [Tue, 19 Apr 2016 09:20:10 +0000 (11:20 +0200)]
docs: Uninstall libvirt logo too

While we could leave it behind as an indelible sign that libvirt
has been running on host, other users might not be that fond of
it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoexamples: Try harder to uninstall nwfilter
Michal Privoznik [Tue, 19 Apr 2016 09:13:00 +0000 (11:13 +0200)]
examples: Try harder to uninstall nwfilter

We have this code in our Makefile that tries to remove
/etc/libvirt/nwfilter if directory is left empty after all our
example nwfilters were uninstalled. However, the check for that
is missing quotation marks thus rendering the test useless:

test -z allow-arp.xml allow-dhcp-server.xml .. qemu-announce-self.xml || \
  rmdir "/some/path/libvirt.git/_install/etc/libvirt/nwfilter"
/bin/sh: line 0: test: too many arguments

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonss: Try harder to uninstall
Michal Privoznik [Tue, 19 Apr 2016 09:08:48 +0000 (11:08 +0200)]
nss: Try harder to uninstall

On BSD we are creating this symlink to libnss_libvirt.so called
nss_libvirt.so. That's just the way it is on BSD. However, when
uninstalling, we try to remove libnss_libvirt.so instead of the
symlink. Moreover, if file we are trying to remove does not exist
we error out instead of ignoring the error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovz: fix config input device check
Nikolay Shirokovskiy [Wed, 20 Apr 2016 08:58:21 +0000 (11:58 +0300)]
vz: fix config input device check

We don't have input devices in SDK thus for define/dumpxml
operations to be consistent we need to:

1. on dumpxml: infer input devices from other parts of config.
It is already done in prlsdkLoadDomain.

2. on define: check that input devices are the same that
will be infer back on dumpxml operation.

The second part should be fixed.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovz: add default input devices on post parse
Nikolay Shirokovskiy [Wed, 20 Apr 2016 08:58:20 +0000 (11:58 +0300)]
vz: add default input devices on post parse

It is on par with prlsdkLoadDomain actions.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovirt-aa-helper: disallow VNC socket read permissions
Simon Arlott [Fri, 8 Apr 2016 13:01:33 +0000 (09:01 -0400)]
virt-aa-helper: disallow VNC socket read permissions

The VM does not need read permission for its own VNC socket to create(),
bind(), accept() connections or to receive(), send(), etc. on connections.

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

9 years agostorage: drop the plumbing needed for kvm-img/qcow-create
Cole Robinson [Fri, 15 Apr 2016 21:07:02 +0000 (17:07 -0400)]
storage: drop the plumbing needed for kvm-img/qcow-create

Remove all the plumbing needed for the different qcow-create/kvm-img
non-raw file creation.

We can drop the error messages because CreateQemuImg will thrown an
error for us but with slightly less fidelity (unable to find qemu-img),
which I think is acceptable given the unlikeliness of that error in
practice.

9 years agostorage: remove support for /usr/bin/kvm-img
Cole Robinson [Fri, 15 Apr 2016 21:00:40 +0000 (17:00 -0400)]
storage: remove support for /usr/bin/kvm-img

This an ubuntu/debian packaging convention. At one point it may have
been an actually different binary, but at least as of ubuntu precise
(the oldest supported ubuntu distro, released april 2012) kvm-img is
just a symlink to qemu-img for back compat.

I think it's safe to drop support for it

9 years agostorage: remove support for /usr/bin/qcow-create
Cole Robinson [Fri, 15 Apr 2016 20:48:59 +0000 (16:48 -0400)]
storage: remove support for /usr/bin/qcow-create

qcow-create was a crippled qemu-img impl that shipped with xen. I
think supporting this was only relevant for really old distros
that didn't have a proper qemu package, like early RHEL5. I think
it's fair to drop support

9 years agoman: Clarify virsh vol-clone works within a single pool
Cole Robinson [Tue, 19 Apr 2016 21:34:57 +0000 (17:34 -0400)]
man: Clarify virsh vol-clone works within a single pool

virsh vol-clone is expected to clone a volume within a single
pool; it doesn't work for cloning across pools. Clarify the docs

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

9 years agonetwork: Don't use ERR_NO_SUPPORT for invalid net-update requests
Cole Robinson [Tue, 19 Apr 2016 18:48:30 +0000 (14:48 -0400)]
network: Don't use ERR_NO_SUPPORT for invalid net-update requests

VIR_ERR_NO_SUPPORT maps to the error string

    this function is not supported by the connection driver

and is largely only used for when a driver doesn't have any
implementation for a public API. So its usage with invalid
net-update requests is a bit out of place. Instead use
VIR_ERR_OPERATION_UNSUPPORTED which maps to:

    Operation not supported

And is what qemu's hotplug routines use in similar scenarios

9 years agolibvirt: Use conventional function names
Cole Robinson [Tue, 19 Apr 2016 16:18:40 +0000 (12:18 -0400)]
libvirt: Use conventional function names

do_open and winsock_init don't follow the naming pattern of other
functions in this file. Rename them to match

9 years agoRevert "daemon: use socket activation with systemd"
Cole Robinson [Mon, 11 Apr 2016 22:36:20 +0000 (18:36 -0400)]
Revert "daemon: use socket activation with systemd"

This reverts commit 1e9808d3a1e00a7121bae8b163d9c42d441d2ca8.

We shouldn't advertise libvirtd.socket activation, since currently
it means VM/network/... autostart won't work as expected.

We tried to find a middle ground by installing the config file without
an [Install] section, since systemd won't allow .socket to be enabled
without one... or at least it did do that; presently on f24 it allows
activating the socket quite happily. This also caused user confusion[1]

Just remove the socket file. I've filed a new RFE to track coming up
with a solution to the autostart problem[2], we can point users at that
if there's more confusion:

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1279348
[2]: https://bugzilla.redhat.com/show_bug.cgi?id=1326136

9 years agotests: Fix enumeration value
Andrea Bolognani [Wed, 20 Apr 2016 12:36:37 +0000 (14:36 +0200)]
tests: Fix enumeration value

Commit 3a773c43c801 introduced the testCompareNetXML2XMLResult
enumeration; however, in one instance the result variable was
assigned a value from the very similar testCompareDocXML2XMLResult
enumeration, leading to a build error.

  networkxml2xmltest.c:33:42: error:
    implicit conversion from enumeration type 'testCompareDomXML2XMLResult'
    to different enumeration type 'testCompareNetXML2XMLResult'
    [-Werror,-Wenum-conversion]

  testCompareNetXML2XMLResult result = TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS;
                              ~~~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the proper value (TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS) instead.

9 years agodocs: Document the new XML elements
Andrea Bolognani [Mon, 18 Apr 2016 17:20:07 +0000 (19:20 +0200)]
docs: Document the new XML elements

9 years agoqemu: Cache GIC capabilities
Andrea Bolognani [Thu, 10 Mar 2016 16:59:51 +0000 (17:59 +0100)]
qemu: Cache GIC capabilities

Implement support for saving GIC capabilities in the cache and
read them back.

9 years agoqemu: Fill in GIC capabilities
Andrea Bolognani [Wed, 9 Mar 2016 18:18:24 +0000 (19:18 +0100)]
qemu: Fill in GIC capabilities

Take the GIC capabilities stored in a virQEMUCaps instance and
update a virDomainCaps instance appropriately.