]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
9 years agodomain_conf: fix migration/managedsave with usb keyboard 5/head
Pavel Hrdina [Fri, 6 May 2016 11:55:15 +0000 (13:55 +0200)] 
domain_conf: fix migration/managedsave with usb keyboard

Commin 36785c7e refactored the code for input devices but introduced a
bug where we removed all keyboard from migratable XML.  We have to
remove only implicit keyboards like PS2 or XEN.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoPrep for release 1.3.3.1 v1.3.3.1
Cole Robinson [Wed, 4 May 2016 23:40:19 +0000 (19:40 -0400)] 
Prep for release 1.3.3.1

9 years agospec: Use proper indentation
Andrea Bolognani [Tue, 26 Apr 2016 15:37:16 +0000 (17:37 +0200)] 
spec: Use proper indentation

Commit 1d4400082a02 added some code that was not indented properly
and broke syntax-check. Fix it.

(cherry picked from commit a528ae7fb7e24e448d2636012218109ae3ef82b6)

9 years agolibvirt.spec: remove duplicate files from -docs package
Daniel P. Berrange [Wed, 4 May 2016 09:11:37 +0000 (10:11 +0100)] 
libvirt.spec: remove duplicate files from -docs package

Previous commit moved some lists out of the -devel package
and into the -docs package

  commit feffcc03a0d3690dcffd860682dcbaa61d726b39
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Wed Apr 13 10:37:42 2016 -0400

    spec: Only pull in API docs with -devel package

What was not realized is that the rule 'libvirt-docs/*'
and ' docs/*.html docs/html docs/*.gif' actually point
to the exact same content. ie, we had previously included
the website HTML in *both* the -docs and -devel packages.

So this change ended up listing the files twice, which
caused RPM to print a load of warnings:

warning: File listed twice: /usr/share/doc/libvirt-docs/html
warning: File listed twice: /usr/share/doc/libvirt-docs/html/32favicon.png
warning: File listed twice: /usr/share/doc/libvirt-docs/html/404.html
warning: File listed twice: /usr/share/doc/libvirt-docs/html/acl.html
warning: File listed twice: /usr/share/doc/libvirt-docs/html/aclpolkit.html

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit d6c25c34ef682a69f73f6ec200129e61b2932088)

9 years agonetwork: Fix segfault on daemon reload
Cole Robinson [Sun, 24 Apr 2016 21:37:13 +0000 (17:37 -0400)] 
network: Fix segfault on daemon reload

We will segfault of a daemon reload picks up a new network config
that needs to be autostarted. We shouldn't be passing NULL for
network_driver here. This seems like it was missed in the larger
rework in commit 1009a61e

(cherry picked from commit 26af7e4e932d72e7ead88e2e687b3ee0ca4718bb)

9 years agosend default USB controller in xml to destination during migration
Shivaprasad G Bhat [Fri, 29 Apr 2016 14:01:51 +0000 (19:31 +0530)] 
send default USB controller in xml to destination during migration

The default USB controller is not sent to destination as the older versions
of libvirt(0.9.4 or earlier as I see in commit log of 409b5f54) didn't
support them. For some archs where the support started much later can
safely send the USB controllers without this worry. So, send the controller
to destination for all archs except x86. Moreover this is not very applicable
to x86 as the USB controller has model ich9_ehci1 on q35 and for pc-i440fx,
there cant be any slots before USB as it is fixed on slot 1.

The patch fixes a bug that, if the USB controller happens to occupy
a slot after disks/interfaces and one of them is hot-unplugged, then
the default USB controller added on destination takes the smallest slot
number and that would lead to savestate mismatch and migration
failure. Seen and verified on PPC64.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
(cherry picked from commit 192a53e07c5fefd9dad2f310886209b76dcc5d83)

9 years agovirsh: Fix support for 64 migration options
Nikolay Shirokovskiy [Wed, 20 Apr 2016 13:51:43 +0000 (16:51 +0300)] 
virsh: Fix support for 64 migration options

Add ULL suffix to all related operands of << or shift will give
all zeros instead of correct mask.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
(cherry picked from commit 4d28d0931f87177a762f6a78cfdbcc2e30d6d4af)

9 years agoqemu: Regenerate VNC socket paths
Martin Kletzander [Tue, 26 Apr 2016 12:27:16 +0000 (14:27 +0200)] 
qemu: Regenerate VNC socket paths

Similarly to what commit 714080791778 did with some internal paths,
clear vnc socket paths that were generated by us.  Having such path in
the definition can cause trouble when restoring the domain.  The path is
generated to the per-domain directory that contains the domain ID.
However, that ID will be different upon restoration, so qemu won't be
able to create that socket because the directory will not be prepared.

To be able to migrate to older libvirt, skip formatting the socket path
in migratable XML if it was autogenerated.  And mark it as autogenerated
if it already exists and we're parsing live XML.

Best viewed with '-C'.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 55320c23dd163e75eb61ed6bea2f339ccfeff4f9)

9 years agoqemu: conf: Set default logging approach in virQEMUDriverConfigNew
Peter Krempa [Wed, 27 Apr 2016 10:58:13 +0000 (12:58 +0200)] 
qemu: conf: Set default logging approach in virQEMUDriverConfigNew

Instead of setting the default qemu stdio logging approach in
virQEMUDriverConfigLoadFile set it in virQEMUDriverConfigNew so that
it's properly set even when the config is not present.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325075
(cherry picked from commit 63e2b766a5a704eb19b8bdaeb1cf0fa91f990cb8)

9 years agoqemu: Unref cfg in qemuDomainDefPostParse
Martin Kletzander [Tue, 26 Apr 2016 12:38:14 +0000 (14:38 +0200)] 
qemu: Unref cfg in qemuDomainDefPostParse

Introduced by commit 15ad2ecf114d.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit d3d4fb4b187e88d470d37867cdaff3f32e01efef)

9 years agospec: If installing default network, restart libvirtd
Cole Robinson [Thu, 16 Apr 2015 19:42:05 +0000 (15:42 -0400)] 
spec: If installing default network, restart libvirtd

If libvirt-daemon-config-network is installed while libvirtd is already
running, the daemon doesn't notice the network. Users then have to
manually restart libvirtd (or reboot) to pick up the network.

Instead let's trigger a daemon restart when the package is first installed.
Then the default network is available immediately if libvirtd was already
running.

https://bugzilla.redhat.com/show_bug.cgi?id=867546
(cherry picked from commit 1d4400082a02c41b152cc9ab7b4cfc428cc527ee)

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
(cherry picked from commit ff2126225df019566e4e580d92e69e9df3ca96c0)

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
(cherry picked from commit 3a703b8120d9f996840bd315b6f74c45a7e98aad)

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>
(cherry picked from commit 72c313bce9043a181cc951871f38a37f6cbeb785)

9 years agoconf: Drop restrictions on rng backend path
Cole Robinson [Wed, 13 Apr 2016 19:09:30 +0000 (15:09 -0400)] 
conf: Drop restrictions on rng backend path

Currently we only allow /dev/random and /dev/hwrng as host input
for <rng><backend model='random'/> device. This was added after
various upstream discussions in commit 4932ef45

However this restriction has generated quite a few complaints over
the years, so a new discussion was initiated:

http://www.redhat.com/archives/libvir-list/2016-April/msg00987.html

Several people suggested removing the restriction, and nobody really
spoke up to defend it. So this patch drops the path restriction
entirely

https://bugzilla.redhat.com/show_bug.cgi?id=1074464
(cherry picked from commit 67f2b72723c242969c5282fcb9acf00cc01f2a54)

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.

(cherry picked from commit 18644491de68f9a654061f2748486f1c69900d17)

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>
(cherry picked from commit 2d04f6de77d437fa60361950e5f18fac8c1c922d)

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
(cherry picked from commit 3cc2a9e0d412776a07780b090cf286cc603cea84)

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
(cherry picked from commit bf3d9f305ebad9d8abd68e4600d2db996b860e68)

9 years agorpc: Don't leak fd via CreateXMLWithFiles
Ben Gray [Sat, 23 Apr 2016 22:38:21 +0000 (18:38 -0400)] 
rpc: Don't leak fd via CreateXMLWithFiles

FD passing APIs like CreateXMLWithFiles or OpenGraphicsFD will leak
file descriptors. The user passes in an fd, which is dup()'d in
virNetClientProgramCall. The new fd is what is transfered to the
server virNetClientIOWriteMessage.

Once all the fds have been written though, the parent msg->fds list
is immediately free'd, so the individual fds are never closed.

This closes each FD as its send to the server, so all fds have been
closed by the time msg->fds is free'd.

https://bugzilla.redhat.com/show_bug.cgi?id=1159766
(cherry picked from commit 5ba48584fbc5079c0ddbc9e9a52c96d7bcef0761)

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

(cherry picked from commit f1bae376b71ecc712e5d8359382290db1120e13e)

9 years agotests: fix xen-related tests
Ján Tomko [Tue, 12 Apr 2016 12:58:43 +0000 (14:58 +0200)] 
tests: fix xen-related tests

My commit 6879be4 moved the addition of the implicit video device
from the XML parser to the PostParse function, but did not regenerate
all the tests.

(cherry picked from commit 4b35a7155ad6b4346591dd54f03abead2f8c6e1f)

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
(cherry picked from commit 2f1dc3de4672f4d7aa42bb4984618d382388e0d2)

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

(cherry picked from commit cdb4caac81606b8c1bb6ed6f3c0e5d06e4b8b3d6)

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

(cherry picked from commit 3b9100a4d255fdb5f731fcfa49326746d371894a)

9 years agoExplicitly error on uri=qemu://system
Cole Robinson [Sat, 16 Apr 2016 12:59:08 +0000 (08:59 -0400)] 
Explicitly error on uri=qemu://system

It's a fairly common error that a user tries to connect to a URI
like qemu://system or qemu://session (missing a slash). This errors
like:

$ virsh --connect qemu://session
error: failed to connect to the hypervisor
error: Unable to resolve address 'session' service '16514': No address associated with hostname

If you already know that the standard qemu URI has 3 slashes, that
error will make it obvious enough. But new user's may not get it.
There's even a RHEL support page explicitly mentioning it!:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Troubleshooting-Common_libvirt_errors_and_troubleshooting.html

Catch this error early in libvirt.c virConnectOpen for qemu (and vbox
which has similar rules

https://bugzilla.redhat.com/show_bug.cgi?id=1038304
(cherry picked from commit 0d1579572a864c33621da4d01408f8bcb6de5d4a)

9 years agolxc: explicitly error on interface type=ethernet
Cole Robinson [Mon, 11 Apr 2016 14:48:20 +0000 (10:48 -0400)] 
lxc: explicitly error on interface type=ethernet

It isn't implemented and does not work:

error: internal error: guest failed to start: /usr/lib/libvirt/libvirt_lxc: option '--veth' requires an argument
syntax: /usr/lib/libvirt/libvirt_lxc [OPTIONS] ...

We previously threw an explicit error, but this changed in
22cff52a2b8e06c913b1f97767e5d390fb17fc3b , which I suspect was
untested for LXC

(cherry picked from commit 27f2b74782e15c528079c8a93e5ccf216fe7b22c)

9 years agotests: Fix syntax in iSCSI auth/secret tests
John Ferlan [Sat, 16 Apr 2016 12:11:00 +0000 (08:11 -0400)] 
tests: Fix syntax in iSCSI auth/secret tests

While working on the tests for the secret initialization vector, I found
that the existing iSCSI tests were lacking in how they defined the IQN.
Many had IQN's of just 'iqn.1992-01.com.example' for one disk while using
'iqn.1992-01.com.example/1' for the second disk (same for hostdevs - guess
how they were copied/generated).

Typically (and documented this way), IQN's would include be of the form
'iqn.1992-01.com.example:storage/1' indicating an IQN using "storage" for
naming authority specific string and "/1" for the iSCSI LUN.

So modify the input XML's to use the more proper format - this of course
has a ripple effect on the output XML and the args.

Also note that the "%3A" is generated by the virURIFormat/xmlSaveUri
to represent the colon.

Signed-off-by: John Ferlan <jferlan@redhat.com>
(cherry picked from commit dd1400280eb0fcd38906b17a9341ac9fe6317498)

9 years agoLibvirt: virTypedParamsValidate: Fix detection of multiple parameters
Jason J. Herne [Tue, 12 Apr 2016 14:13:27 +0000 (10:13 -0400)] 
Libvirt: virTypedParamsValidate: Fix detection of multiple parameters

virTypedParamsValidate currently uses an index based check to find
duplicate parameters. This check does not work. Consider the following
simple example:

We have only 2 keys
A  (multiples allowed)
B  (multiples NOT allowed)

We are given the following list of parameters to check:
A
A
B

If you work through the validation loop you will see that our last iteration
through the loop has i=2 and j=1. In this case, i > j and keys[j].value.i will
indicate that multiples are not allowed. Both conditionals are satisfied so
an incorrect error will be given: "parameter '%s' occurs multiple times"

This patch replaces the index based check with code that remembers
the name of the last parameter seen and only triggers the error case if
the current parameter name equals the last one. This works because the
list is sorted and duplicate parameters will be grouped together.

In reality, we hit this bug while using selective block migration to migrate
a guest with 5 disks. 5 was apparently just the right number to push i > j
and hit this bug.

virsh migrate --live guestname --copy-storage-all
              --migrate-disks vdb,vdc,vdd,vde,vdf
              qemu+ssh://dsthost/system

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
(cherry picked from commit 0e570a6acc13ebbca913e69026f1468daf28240f)

9 years agoResolve a couple of memory leaks
John Ferlan [Thu, 14 Apr 2016 14:21:27 +0000 (10:21 -0400)] 
Resolve a couple of memory leaks

Commit id '4b75237f' seems to have triggered Coverity into finding
at least one memory leak in xen_xl.c for error path for cleanup where
the listenAddr would be leaked. Reviewing other callers, it seems that
qemu_parse_command.c would have the same issue, so just it too.

(cherry picked from commit 727a3c5860ef5e1fb8878da9d44c6e5e33a4f4ae)

9 years agolibxl: use LIBXL_API_VERSION 0x040200
Jim Fehlig [Thu, 14 Apr 2016 22:10:32 +0000 (16:10 -0600)] 
libxl: use LIBXL_API_VERSION 0x040200

To ensure the libvirt libxl driver will build with future versions
of Xen where the libxl API may change in incompatible ways,
explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
does use new libxl APIs that have been added since Xen 4.2, but
currently it does not make use of any changes made to existing
APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
The version can be bumped if/when the libxl driver consumes the
changed APIs.

Further details can be found in the following discussion thread

https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit e744065679ccba8471d28b2cf6e93f443cd20c8c)

9 years agoAdd functions for handling exponential backoff loops.
Richard W.M. Jones [Fri, 8 Apr 2016 11:11:10 +0000 (12:11 +0100)] 
Add functions for handling exponential backoff loops.

In a few places in libvirt we busy-wait for events, for example qemu
creating a monitor socket.  This is problematic because:

 - We need to choose a sufficiently small polling period so that
   libvirt doesn't add unnecessary delays.

 - We need to choose a sufficiently large polling period so that
   the effect of busy-waiting doesn't affect the system.

The solution to this conflict is to use an exponential backoff.

This patch adds two functions to hide the details, and modifies a few
places where we currently busy-wait.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit beaa447a2982bc78adb26c183560d0ee566c1268)

9 years agospec: Only pull in API docs with -devel package
Cole Robinson [Wed, 13 Apr 2016 14:37:42 +0000 (10:37 -0400)] 
spec: Only pull in API docs with -devel package

Move some API specific documentation out of -docs package and into
-devel, and some end user docs out of -devel and into -docs, then
drop the -devel dep on -docs. This is more in line with the suggested
Fedora guidelines.

https://bugzilla.redhat.com/show_bug.cgi?id=1310155
(cherry picked from commit feffcc03a0d3690dcffd860682dcbaa61d726b39)

9 years agoutil: Add virGettextInitialize, convert the code
Cole Robinson [Tue, 12 Apr 2016 22:29:52 +0000 (18:29 -0400)] 
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

(cherry picked from commit e7db22781071a39668276a395fb547c0dd90875d)

9 years agoman: virsh: Document lxc-enter-namespace --noseclabel
Cole Robinson [Mon, 11 Apr 2016 21:02:25 +0000 (17:02 -0400)] 
man: virsh: Document lxc-enter-namespace --noseclabel

https://bugzilla.redhat.com/show_bug.cgi?id=1147737
(cherry picked from commit 0f8be2531c44f04854af0b0569d3f2c373b1bba6)

9 years agostorage: mpath: Don't error on target_type=NULL
Cole Robinson [Wed, 13 Apr 2016 21:29:59 +0000 (17:29 -0400)] 
storage: mpath: Don't error on target_type=NULL

We use device-mapper to enumerate all dm devices, and filter out
the list of multipath devices by checking the target_type string
name. The code however cancels all scanning if we encounter
target_type=NULL

I don't know how to reproduce that situation, but a user was hitting
it in their setup, and inspecting the lvm2/device-mapper code shows
many places where !target_type is explicitly ignored and processing
continues on to the next device. So I think we should do the same

https://bugzilla.redhat.com/show_bug.cgi?id=1069317
(cherry picked from commit 8f8c0feb113420625f15b7f1e17bfd719c977eeb)

9 years agoqemu: command: don't overwrite watchdog dump action
Cole Robinson [Wed, 13 Apr 2016 15:20:19 +0000 (11:20 -0400)] 
qemu: command: don't overwrite watchdog dump action

The watchdog cli refactoring in 4666b762 dropped the temporary variable
we use to convert to action=dump to action=pause for the qemu cli, and
stored the converted value in the domain structure. Our other watchdog
handling code then treated it as though the user requested action=pause,
which broke action=dump handling.

Revive the temporary variable to fix things.

(cherry picked from commit a91177c8f7b432e67d2e232650d7debbbfc694da)

9 years agorpc: daemon: Fix virtlog/virtlock daemon reload
Cole Robinson [Wed, 13 Apr 2016 14:13:12 +0000 (10:13 -0400)] 
rpc: daemon: Fix virtlog/virtlock daemon reload

Trying to reload/SIGUSR1 virtlogd or virtlockd fails with:

error : virNetDaemonRun:747 : internal error: Not all servers restored, cannot run server

Commit 252610f7 changed the daemon state json to allow tracking
multiple servers. However it missed clearing dmn->srvObject after
the json is empty, like the previous code paths handled.  Later on in
virNewDaemonRun, dmn->srvObject is expected to be empty otherwise we
throw the above error.

https://bugzilla.redhat.com/show_bug.cgi?id=1311013
(cherry picked from commit 9b69f02243f2abec4170576dfe28f8a4bb398b4e)

9 years agoconf: also mark the implicit video as primary
Ján Tomko [Mon, 11 Apr 2016 12:26:06 +0000 (14:26 +0200)] 
conf: also mark the implicit video as primary

Commit 119cd06 started setting the primary bool for the first
user-specified video even if user omitted the 'primary' attribute.

However this was done before the addition of the implicit device.
This broke startup of transient qemu domains with no <video>:
https://bugzilla.redhat.com/show_bug.cgi?id=1325757

Move this default to virDomainDefPostParseInternal,
after the addition of the implicit video device, to catch the implicit
video as well.

(cherry picked from commit 6d8b6d2847f31a3d7a234536c12b8feca751a02f)

9 years agoconf: move default video addition after XML parsing
Ján Tomko [Mon, 11 Apr 2016 12:06:03 +0000 (14:06 +0200)] 
conf: move default video addition after XML parsing

Separate parsing of the XML from auto-generating the device.

(cherry picked from commit 6879be484c9502394e55c799f5bb95c24c510644)

9 years agovirtlogd: Fix a couple minor memory leaks
Cole Robinson [Sun, 10 Apr 2016 23:19:25 +0000 (19:19 -0400)] 
virtlogd: Fix a couple minor memory leaks

https://bugzilla.redhat.com/show_bug.cgi?id=1303885
(cherry picked from commit cdced0128a45fb44c687325376311dabb1116324)

9 years agoqemu: Free priv->machineName
Martin Kletzander [Fri, 8 Apr 2016 13:29:40 +0000 (15:29 +0200)] 
qemu: Free priv->machineName

Commit c3bd0019c0e3 forgot to cleanup after itself.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 16b41728b59a7188f643937303e3aec4c299a980)

9 years agoconfigure: Fix check for --with-login-shell on Windows
Andrea Bolognani [Fri, 8 Apr 2016 14:17:16 +0000 (16:17 +0200)] 
configure: Fix check for --with-login-shell on Windows

The check is supposed to stop users from trying to compile
virt-login-shell on Windows by erroring out during the
configure phase; however, there are two flaws in it:

  * the value of "x$with_win" is compared to "yes" instead
    of "xyes" (note the "x" in the first string)

  * "test" is not being used, so the script will actually
    try to run a command called "x$with_win" instead of
    performing string comparison

This patch fixes both issues.

(cherry picked from commit ccf58bd72a426f34481787af694d6eae78b4e64e)

9 years agoutil: move ENODATA redefine to internal.h
Roman Bogorodskiy [Thu, 7 Apr 2016 06:51:11 +0000 (09:51 +0300)] 
util: move ENODATA redefine to internal.h

FreeBSD lacks ENODATA, and viruuid.c redefines it to EIO, but it's not
actually using it. On the other hand, we have virrandom.c that's using
ENODATA. So make this re-definition common by moving it to internal.h,
so all the current and possible future users don't need to care about
that.

(cherry picked from commit edc028d122a45b09988dae6d93510adbd9f5c3e4)

9 years agolibxl: libxl_domain_create_restore has an extra argument
Wei Liu [Tue, 5 Apr 2016 14:20:12 +0000 (15:20 +0100)] 
libxl: libxl_domain_create_restore has an extra argument

In the latest libxenlight code, libxl_domain_create_restore accepts a
new argument. Update libvirt's libxl driver for that. Use the macro
provided by libxenlight to detect which version should be used.

The new parameter (send_back_fd) is set to -1 because libvirt provides
no such fd.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Message-id: 1459866012-27081-1-git-send-email-wei.liu2@citrix.com
(cherry picked from commit 216650f14b35ad11a45505405347f8027bc294d7)

9 years agoqemu: perf: Fix crash/memory corruption on failed VM start
Peter Krempa [Thu, 7 Apr 2016 10:50:15 +0000 (12:50 +0200)] 
qemu: perf: Fix crash/memory corruption on failed VM start

The new perf code didn't bother to clear a pointer in 'priv' causing a
double free or other memory corruption goodness if a VM failed to start.

Clear the pointer after freeing the memory.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324757
(cherry picked from commit 03e8d5fb54c7c897225ed9ea56d83b894930f144)

9 years agoqemu: alias: Fix calculation of memory device aliases
Peter Krempa [Wed, 6 Apr 2016 15:32:12 +0000 (17:32 +0200)] 
qemu: alias: Fix calculation of memory device aliases

For device hotplug, the new alias ID needs to be checked in the list
rather than using the count of devices. Unplugging a device that is not
last in the array will make further hotplug impossible due to alias
collision.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1324551
(cherry picked from commit be6e92f541ab27019de530f1f08ec9b2912765a9)

9 years agoLink libvirt_xenconfig instead of libvirt against libxl
Guido Günther [Thu, 31 Mar 2016 12:57:24 +0000 (14:57 +0200)] 
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

(cherry picked from commit 12b239a9fafe84bf025437fe0324e7af5d12cd67)

9 years agovirt-admin: get rid of LIBVIRT_DEFAULT_ADMIN_URI env var
Ján Tomko [Wed, 6 Apr 2016 12:57:21 +0000 (14:57 +0200)] 
virt-admin: get rid of LIBVIRT_DEFAULT_ADMIN_URI env var

There is a LIBVIRT_ADMIN_DEFAULT_URI environment variable
which is honored by virAdmConnectOpen and documented
in the virt-admin man page.

LIBVIRT_DEFAULT_ADMIN_URI is undocumented and this is its
only occurrence.

(cherry picked from commit df8964308ed3d7eeb4f15f26e17993b5f7af1c51)

9 years agolibvirt-admin: do not crash on URI without a scheme
Ján Tomko [Wed, 6 Apr 2016 08:43:39 +0000 (10:43 +0200)] 
libvirt-admin: do not crash on URI without a scheme

(cherry picked from commit 7f35b6b658288749d41cb5ff138baf9f679e57fd)

9 years agovirsh: read default connection uri from env later
Ján Tomko [Wed, 6 Apr 2016 08:08:55 +0000 (10:08 +0200)] 
virsh: read default connection uri from env later

Postpone filling out the default connection in ctl->connname
after calling virshInit.

This allows printing help without a connection to the daemon.

(cherry picked from commit c0726e0708762e571a7883cb0558cfec32459669)

9 years agobuild: add GCC 6.0 -Wlogical-op workaround
Pavel Hrdina [Sun, 10 Apr 2016 16:22:20 +0000 (18:22 +0200)] 
build: add GCC 6.0 -Wlogical-op workaround

fdstream.c: In function 'virFDStreamWrite':
fdstream.c:390:29: error: logical 'or' of equal expressions [-Werror=logical-op]
        if (errno == EAGAIN || errno == EWOULDBLOCK) {
                            ^~

Fedora rawhide now uses gcc 6.0 and there is a bug with -Wlogical-op
producing false warnings.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602

Use GCC pragma push/pop and ignore -Wlogical-op for GCC that supports
push/pop pragma and also has this bug.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit d713a6b120904c488170e7920c482b2fade70ae1)

9 years agobuild: cleanup GCC < 4.6 -Wlogical-op workaround
Pavel Hrdina [Sun, 10 Apr 2016 16:21:13 +0000 (18:21 +0200)] 
build: cleanup GCC < 4.6 -Wlogical-op workaround

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 7fb81831fc497aa4a34fdfc036be9c9ae4401084)

9 years agoqemu: support virt-2.6 machine type on arm
Ján Tomko [Fri, 8 Apr 2016 08:46:41 +0000 (10:46 +0200)] 
qemu: support virt-2.6 machine type on arm

Some places already check for "virt-" prefix as well as plain "virt".
virQEMUCapsHasPCIMultiBus did not, resulting in multiple PCI devices
having assigned the same unnumbered "pci" alias.

Add a test for the "virt-2.6" machine type which also omits the
<model type='virtio'/> in <interface>, to check if
qemuDomainDefaultNetModel works too.

https://bugzilla.redhat.com/show_bug.cgi?id=1325085
(cherry picked from commit f06ca25d235433f9139cbfb3d5d9eae7409156b9)

9 years agoRelease of libvirt-1.3.3 v1.3.3
Daniel Veillard [Wed, 6 Apr 2016 07:18:46 +0000 (15:18 +0800)] 
Release of libvirt-1.3.3
- docs/news.html.in libvirt.spec.in: update for release
- po/*.po*: regenerated

9 years agodocs: fix logfile paragraph
Boris Fiuczynski [Tue, 5 Apr 2016 12:44:43 +0000 (14:44 +0200)] 
docs: fix logfile paragraph

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
9 years agonetwork: Remove extraneous ATTRIBUTE_NONNULL
John Ferlan [Tue, 5 Apr 2016 09:43:47 +0000 (05:43 -0400)] 
network: Remove extraneous ATTRIBUTE_NONNULL

Commit id '3992ff14' added the prototype for networkGetActualType
with 1 parameter, but added 2 ATTRIBUTE_NONNULL's (assume from a
cut-n-paste), just remove (2).

9 years agoqemu: Fix mis-merge of qemuBuildRedirdevCommandLine
John Ferlan [Mon, 4 Apr 2016 19:27:58 +0000 (15:27 -0400)] 
qemu: Fix mis-merge of qemuBuildRedirdevCommandLine

Commit id '59e7ef3c' misapplied a merge of commit id '019244751'
to place the "-chardev" command after formatting the character
backend value.

9 years agoqemu: Fix mis-merge of qemuBuildConsoleCommandLine
John Ferlan [Mon, 4 Apr 2016 19:26:43 +0000 (15:26 -0400)] 
qemu: Fix mis-merge of qemuBuildConsoleCommandLine

Commit id 'e6944a52' misapplied a merge of commit id '019244751'
to place the "-chardev" command after formatting the character
backend value.

9 years agoqemu: Fix mis-merge of qemuBuildChannelsCommandLine
John Ferlan [Mon, 4 Apr 2016 19:24:28 +0000 (15:24 -0400)] 
qemu: Fix mis-merge of qemuBuildChannelsCommandLine

Commit id '3cdcc910' misapplied a merge of commit id '019244751'
to place the "-chardev" command after formatting the character
backend value.

9 years agoqemu: Fix mis-merge of qemuBuildParallelsCommandLine
John Ferlan [Mon, 4 Apr 2016 19:23:07 +0000 (15:23 -0400)] 
qemu: Fix mis-merge of qemuBuildParallelsCommandLine

Commit id '0e1e7ade' misapplied a merge of commit id '019244751'
to place the "-chardev" command after formatting the character
backend value.

9 years agoqemu: Fix mis-merge of qemuBuildSerialCommandLine
John Ferlan [Mon, 4 Apr 2016 19:21:57 +0000 (15:21 -0400)] 
qemu: Fix mis-merge of qemuBuildSerialCommandLine

Commit id '5ab8640' misapplied a merge of commit id '019244751'
to place the "-chardev" command after formatting the character
backend value.

9 years agoqemu: Fix mis-merge of qemuBuildSmartcardCommandLine
John Ferlan [Mon, 4 Apr 2016 19:19:57 +0000 (15:19 -0400)] 
qemu: Fix mis-merge of qemuBuildSmartcardCommandLine

Commit id '858bafeb' misapplied a merge of commit id '019244751'
to place the "-chardev" command after formatting the character
backend value.

9 years agonodedev: Fix parsing of generated XMLs
Martin Kletzander [Sun, 3 Apr 2016 17:55:54 +0000 (19:55 +0200)] 
nodedev: Fix parsing of generated XMLs

Commit d77ffb6876 added not only reporting of the PCI header type, but
also parsing of that information.  However, because there was no parsing
done for the other sub-PCI capabilities, if there was any other
capability then a valid header type name (like phys_function or
virt_functions) the parsing would fail.  This prevented passing node
device XMLs that we generated into our own functions when dealing with,
e.g. with SRIOV cards.

Instead of reworking the whole parsing, just fix this one occurence and
remove a test for it for the time being.  Future patches will deal with
the rest.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: fix alias name for <interface type='hostdev'>
Laine Stump [Fri, 1 Apr 2016 17:18:57 +0000 (13:18 -0400)] 
qemu: fix alias name for <interface type='hostdev'>

Starting with commit f8e712fe, if you start a domain that has an
<interface type='hostdev' (or that has <interface type='network'>
where the network is a pool of devices for hostdev assignment), when
you later try to add *another* interface (of any kind) with hotplug,
the function qemuAssignDeviceNetAlias() fails as soon as it sees a
"hostdevN" alias in the list of interfaces), causing the attach to
fail.

This is because (starting with f8e712fe) the device alias names are
assigned during the new function qemuProcessPrepareDomain(), which is
called *before* networkAllocateActualDevice() (which is called from
qemuProcessPrepareHost(), which is called from
qemuProcessLaunch()). Prior to that commit,
networkAllocateActualDevice() was called first.

The problem with this is that the alias for interfaces that are really
a hostdev (<interface type='hostdev'>) is of the form "hostdevN" (just
like other hostdevs), while other interfaces are "netN". But if you
don't know that the interface is going to be a hostdev at the time you
assign the alias name, you can't name it differently. (As far as I've
seen so far, the change in name by itself wouldn't have been a problem
(other than just an outwardly noticeable change in behavior) except
for the abovementioned failure to attach/detach new interfaces.

Rather than take the chance that there may be other not-yet-revealed
problems associated with changing the alias name, this patch changes
the way that aliases are assigned to restore the old behavior.

Old: In the past, assigning an alias to an interface was skipped if it
was seen that the interface was type='hostdev' - we knew that the
hostdev part of the interface was also in the list of hostdevs (that's
part of what happens in networkAllocateActualDevice()) and it would be
assigned when all the other hostdev aliases were assigned.

New: When assigning an alias to an interface, we haven't yet called
networkAllocateActualDevice() to construct the hostdev part of the
interface, so we can't just wait for the loop that creates aliases for
all the hostdevs (there's nothing on that list for this device
yet!). Instead we handle it immediately in the loop creating interface
aliases, by calling the new function networkGetActualType() to
determine if it is going to be hostdev, and if so calling
qemuAssignDeviceHostdevAlias() instead.

Some adjustments have to be made to both
qemuAssignDeviceHostdevAlias() and to qemuAssignDeviceNetAlias() to
accommodate this. In both of them, an error return from
qemuDomainDeviceAliasIndex() is no longer considered an error; instead
it's just ignored (because it almost certainly means that the alias
string for the device was "net" when we expected "hostdev" or vice
versa). in qemuAssignDeviceHostdevAlias() we have to look at all
interface aliases for hostdevN in addition to looking at all hostdev
aliases (this wasn't necessary in the past, because both the interface
entry and the hostdev entry for the device already pointed at the
device info; no longer the case since the hostdev entry hasn't yet
been setup).

Fortunately the buggy behavior hasn't yet been in any official release
of libvirt.

9 years agoqemu: change args to qemuAssignDeviceHostdevAlias()
Laine Stump [Fri, 1 Apr 2016 14:40:23 +0000 (10:40 -0400)] 
qemu: change args to qemuAssignDeviceHostdevAlias()

In certain cases, we need to assign a hostdevN-style alias in a case
when we don't have a virDomainHostdevDefPtr (instead we have a
virDomainNetDefPtr). Since qemuAssignDeviceHostdevAlias() doesn't use
anything in the virDomainHostdevDef except the alias string itself
anyway, this patch just changes the arguments to pass a pointer to the
alias pointer instead.

9 years agonetwork: new function networkGetActualType
Laine Stump [Fri, 1 Apr 2016 13:45:51 +0000 (09:45 -0400)] 
network: new function networkGetActualType

There are times when it's necessary to learn the actual type of a
network connection before any resources have been allocated
(e.g. during qemuProcessPrepareDomain()), but in the past it was
necessary to call networkAllocateActualDevice() in order to have the
actual type filled in.

This new function returns the type of network that *will be* setup
once it actually happens, but without making any changes on the host.

9 years agoqemu: Clear generated private paths
Martin Kletzander [Sun, 3 Apr 2016 19:51:29 +0000 (21:51 +0200)] 
qemu: Clear generated private paths

The paths have the domain ID in them.  Without cleaning them, they would
contain the same ID even after multiple restarts.  That could cause
various problems, e.g. with access.

Add function qemuDomainClearPrivatePaths() for this as a counterpart of
qemuDomainSetPrivatePaths().

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Simplify calls to qemuDomainSetPrivatePaths
Martin Kletzander [Sun, 3 Apr 2016 19:59:46 +0000 (21:59 +0200)] 
qemu: Simplify calls to qemuDomainSetPrivatePaths

Since commit 9dca74ee6f54, the function can take driver and a vm, no
need to overcomplicate.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoapparmor: QEMU monitor socket moved
Guido Günther [Sat, 2 Apr 2016 10:49:28 +0000 (12:49 +0200)] 
apparmor: QEMU monitor socket moved

The directory name changed in a89f05ba8df095875f5ec8a9065a585af63a010b.

This unbreaks launching QEMU/KVM VMs with apparmor enabled. It also adds
the directory for the qemu guest-agent socket which is not known when
parsing the domain XML.

9 years agoRevert "hostdev: Use actual device when reattaching"
Andrea Bolognani [Fri, 1 Apr 2016 12:51:29 +0000 (14:51 +0200)] 
Revert "hostdev: Use actual device when reattaching"

This reverts commit ee4cfb56436b50345b072c706b87aff82e06d760.

Since we're still not persisting our bookkeeping lists across
daemon restarts, we might have lost some information
virPCIDeviceReattach() relies on, for example whether the
device needs to be unbound from the stub driver.

As a result, if the daemon has been restarted in the meantime,
the device might end up remaining bound to the stub driver even
after 'virsh nodedev-reattach' or similar has been called, with
no way of giving it back to the host short of messing with
sysfs behind libvirt's back.

Revert back to the previous behavior of always trying to bind
the device to the host driver, regardless of its status when it
was detached, until persistent bookkeeping lists have been
implemented.

9 years agodocs: Remove useless p:first-line CSS rule
Andrea Bolognani [Fri, 1 Apr 2016 09:31:11 +0000 (11:31 +0200)] 
docs: Remove useless p:first-line CSS rule

According to MDN[1], 'margin-left' and similar CSS properties,
including 'margin-right', cannot be applied to the '::first-line'
pseudo-element, so this rule will never have any effect and can
be safely removed.

[1] https://developer.mozilla.org/en/docs/Web/CSS/::first-line

9 years agodocs: Remove unused #sponsor CSS rule
Andrea Bolognani [Fri, 1 Apr 2016 08:59:36 +0000 (10:59 +0200)] 
docs: Remove unused #sponsor CSS rule

Commit e14c5069c512 dropped the only user of the 'sponsor'
CSS id, so we can drop it from the stylesheet as well.

9 years agoPass the correct cpu count when calling virDomainGetCPUStats.
Nitesh Konkar [Fri, 1 Apr 2016 06:05:04 +0000 (02:05 -0400)] 
Pass the correct cpu count when calling virDomainGetCPUStats.

When using the --start option, the show_count should not be set to
max_id as the --start <cpu> means we dont need those many initial cpu
stats. Hence, show_count should be adjusted accordingly.

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

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agomigration: convert speed from MiB/sec to bytes/sec in drive-mirror jobs
Rudy Zhang [Fri, 1 Apr 2016 02:16:53 +0000 (10:16 +0800)] 
migration: convert speed from MiB/sec to bytes/sec in drive-mirror jobs

Commit 08cc14f moved the conversion of MiB/s to B/s out of the
qemuMonitor APIs, but forgot to adjust the qemuMigrationDriveMirror
caller.

This patch will convert the migrate_speed value from MiB/s to its
mirror_speed equivalent in bytes/s.

Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agoqemu: perf: Tweak flags before using them
Peter Krempa [Thu, 31 Mar 2016 14:45:14 +0000 (16:45 +0200)] 
qemu: perf: Tweak flags before using them

@flags have a valid modification impact only after calling
virDomainObjUpdateModificationImpact. virDomainObjGetOneDef calls it but
doesn't update them in the caller.

9 years agolibxl: fix net device detach v1.3.3-rc2
Jim Fehlig [Wed, 30 Mar 2016 21:12:35 +0000 (15:12 -0600)] 
libxl: fix net device detach

Chunyan sent a nice cleanup patch for libxlDomainDetachNetDevice

https://www.redhat.com/archives/libvir-list/2016-March/msg00926.html

which I incorrectly modified before pushing as commit b5534e53. My
modification caused network devices of type hostdev to no longer
be removed. This patch changes b5534e53 to resemble Chunyan's
original, correct patch.

9 years agolibxl: fix attaching net device of type hostdev
Jim Fehlig [Wed, 30 Mar 2016 20:57:29 +0000 (14:57 -0600)] 
libxl: fix attaching net device of type hostdev

Chunyan sent a correct patch to fix a resource leak on error in
libxlDomainAttachNetDevice

https://www.redhat.com/archives/libvir-list/2016-March/msg00924.html

I made what was thought to be an improvement and pushed the patch as
commit e6336442. As it turns out, my change broke adding net devices
that are actually hostdevs to the list of nets in virDomainDef. This
patch changes e6336442 to resemble Chunyan's original, correct
patch.

9 years agobuild: workaround broken SASL header (again)
Fabiano Fidêncio [Wed, 30 Mar 2016 06:52:38 +0000 (08:52 +0200)] 
build: workaround broken SASL header (again)

Compilation for xdg-app failed due to a buggy SASL headers present on
the used runtime (org.gnome.Sdk 3.18).

In file included from rpc/virnetsaslcontext.h:24:0,
                 from rpc/virnetsaslcontext.c:25:
/usr/include/sasl/sasl.h:230:38: error: unknown type name 'size_t'
 typedef void *sasl_realloc_t(void *, size_t);
                                      ^
/usr/include/sasl/sasl.h:235:5: error: unknown type name 'sasl_realloc_t'
     sasl_realloc_t *,

Use the same workaround as commit 1be3dfd did.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agoqemuProcessVerifyGuestCPU: Avoid coverity false positive
Michal Privoznik [Thu, 31 Mar 2016 14:45:11 +0000 (16:45 +0200)] 
qemuProcessVerifyGuestCPU: Avoid coverity false positive

We use _LAST items in enums to mark the last position in given
enum. Now, if and enum is passed to switch(), compiler checks
that all the values from enum occur in 'case' enumeration.
Including _LAST. But coverity spots it's a dead code. And it
really is. So to resolve this, we tend to put a comment just
above 'case ..._LAST' notifying coverity that we know this is a
dead code but we want to have it that way.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirPerfReadEvent: Prefer saferead over read
Michal Privoznik [Thu, 31 Mar 2016 14:43:08 +0000 (16:43 +0200)] 
virPerfReadEvent: Prefer saferead over read

Do I really need to explain why?
Well, if read() is interrupted int the middle of reading, we will
never read the rest (even though it's highly unlikely as we are
reading just 8 bytes).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodocs: Make most headers a bit smaller
Andrea Bolognani [Wed, 30 Mar 2016 13:31:20 +0000 (15:31 +0200)] 
docs: Make most headers a bit smaller

Headers are bold already, so the font doesn't need to be that
big to draw attention.

9 years agodocs: Use bold text for all headers
Andrea Bolognani [Wed, 30 Mar 2016 13:32:34 +0000 (15:32 +0200)] 
docs: Use bold text for all headers

All headers except for <h1> were already bold: make it bold as
well to increase visual consistency.

9 years agodocs: Don't use bold text for menu entries
Andrea Bolognani [Wed, 30 Mar 2016 12:21:00 +0000 (14:21 +0200)] 
docs: Don't use bold text for menu entries

The menu should not take the focus away from the actual contents.

9 years agodocs: Make menu entries smaller
Andrea Bolognani [Wed, 30 Mar 2016 12:10:09 +0000 (14:10 +0200)] 
docs: Make menu entries smaller

The menu should not take the focus away from the actual contents.

9 years agodocs: Don't use <strong> in headers
Andrea Bolognani [Wed, 30 Mar 2016 09:28:31 +0000 (11:28 +0200)] 
docs: Don't use <strong> in headers

There's only one instance of that happening, and it looks
kinda off. Get rid of it, along with the corresponding
CSS rules.

9 years agodocs: Remove empty CSS rule
Andrea Bolognani [Wed, 30 Mar 2016 09:37:06 +0000 (11:37 +0200)] 
docs: Remove empty CSS rule

9 years agodocs: Adjust vertical whitespace in CSS
Andrea Bolognani [Wed, 30 Mar 2016 09:33:58 +0000 (11:33 +0200)] 
docs: Adjust vertical whitespace in CSS

Ensure all CSS rules are separated with a single blank line.

9 years agoremote: Add flags to remote_protocol-structs
Martin Kletzander [Thu, 31 Mar 2016 12:05:34 +0000 (14:05 +0200)] 
remote: Add flags to remote_protocol-structs

Caused by 3b6c8185328f.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirDomain{Get,Set}PerfEvents: Grab job
Michal Privoznik [Thu, 31 Mar 2016 05:21:11 +0000 (07:21 +0200)] 
virDomain{Get,Set}PerfEvents: Grab job

Even though we have the machine locked throughout whole APIs we
are querying/modifying domain internal state. We should grab a
job whilst doing that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirDomain{Get,Set}PerfEvents: support --config --live --current
Michal Privoznik [Wed, 30 Mar 2016 16:33:29 +0000 (18:33 +0200)] 
virDomain{Get,Set}PerfEvents: support --config --live --current

Now that we have @flags we can support changing perf events just
in active or inactive configuration regardless of the other.
Previously, calling virDomainSetPerfEvents set events in both
active and inactive configuration at once. Even though we allow
users to set perf events that are to be enabled once domain is
started up. The virDomainGetPerfEvents API was flawed too. It
returned just runtime info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsh: Make perf accept event list separated by commas
Michal Privoznik [Wed, 30 Mar 2016 15:56:02 +0000 (17:56 +0200)] 
virsh: Make perf accept event list separated by commas

Everywhere else we use a comma separated list. There's no good
reason to make 'perf' command an exception. Currently, it accepts
string list separated by '|'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsh: Prefer VIRSH_COMMON_OPT_DOMAIN_FULL over full enumeration
Michal Privoznik [Wed, 30 Mar 2016 15:45:37 +0000 (17:45 +0200)] 
virsh: Prefer VIRSH_COMMON_OPT_DOMAIN_FULL over full enumeration

We have a macro that does exactly what is done via full
enumeration.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirDomain{Get,Set}PerfEvents: Add @flags argument
Michal Privoznik [Wed, 30 Mar 2016 15:40:50 +0000 (17:40 +0200)] 
virDomain{Get,Set}PerfEvents: Add @flags argument

I've noticed that these APIs are missing @flags argument. Even
though we don't have a use for them, it's our policy that every
new API must have @flags.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoremoteDomainGetPerfEvents: Re-indent
Michal Privoznik [Wed, 30 Mar 2016 15:40:10 +0000 (17:40 +0200)] 
remoteDomainGetPerfEvents: Re-indent

There are few lines off the indentation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: command: Split up formatting of -numa and memory devices
Peter Krempa [Thu, 24 Mar 2016 14:56:16 +0000 (15:56 +0100)] 
qemu: command: Split up formatting of -numa and memory devices

They recently were extracted to a separate function. They don't belong
together though. Since -numa formatting is pretty compact, move it to
the main function and rename qemuBuildNumaCommandLine to
qemuBuildMemoryDeviceCommandLine.

9 years agoqemu: command: Pass numad nodeset when formatting memory devices at boot
Peter Krempa [Thu, 24 Mar 2016 15:05:11 +0000 (16:05 +0100)] 
qemu: command: Pass numad nodeset when formatting memory devices at boot

When starting up a VM libvirtd asks numad to place the VM in case of
automatic nodeset. The nodeset would not be passed to the memory device
formatter and the user would get an error.

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

9 years agoqemu_process: add check for hyperv features
Pavel Hrdina [Tue, 29 Mar 2016 13:17:45 +0000 (15:17 +0200)] 
qemu_process: add check for hyperv features

Commit 7068b56c introduced several hyperv features.  Not all hyperv
features are supported by old enough kernels and we shouldn't allow to
start a guest if kernel doesn't support any of the hyperv feature.

There is one exception, for backward compatibility we cannot error out
if one of the RELAXED, VAPIC or SPINLOCKS isn't supported, for the same
reason we ignore invtsc, to not break restoring saved domains with older
libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: skip only cpu features
Pavel Hrdina [Tue, 29 Mar 2016 13:13:52 +0000 (15:13 +0200)] 
qemu_process: skip only cpu features

This check is there to allow restore saved domain with older libvirt
where we included invtsc by default for host-passthrough model.  Don't
skip the whole function, but only the part that checks for invtsc.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agodocs: fix qemu version for hyperv features
Pavel Hrdina [Tue, 29 Mar 2016 11:10:12 +0000 (13:10 +0200)] 
docs: fix qemu version for hyperv features

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>