]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agovirsh: Extract cpumap formatting in cmdVcpuinfo
Peter Krempa [Thu, 29 Sep 2016 10:59:37 +0000 (12:59 +0200)]
virsh: Extract cpumap formatting in cmdVcpuinfo

cmdVcpuinfo will be split in upcomming patches thus extract the common
code that formats pinning cpumaps for the vcpus.

8 years agovirsh: Fix xpath queries for retrieving vcpu count
Peter Krempa [Tue, 11 Oct 2016 13:40:31 +0000 (15:40 +0200)]
virsh: Fix xpath queries for retrieving vcpu count

The fallback code used if virDomainGetVcpusFlags is not supported used
wrong XPath queries and basically did not work at all. Fix them to point
to the <domain> <vcpu> element instead of <vcpus> which was not present
until lately.

8 years agovirsh: domain: Fix broken indentation in virshCPUCountCollect
Peter Krempa [Mon, 3 Oct 2016 14:46:11 +0000 (16:46 +0200)]
virsh: domain: Fix broken indentation in virshCPUCountCollect

I managed to space most of the code by 5 spaces instead of 4 when
orignally implementing this function.

8 years agoutil: bitmap: Make bitmaps const in virBitmapNewData and virBitmapDataToString
Peter Krempa [Thu, 29 Sep 2016 10:56:58 +0000 (12:56 +0200)]
util: bitmap: Make bitmaps const in virBitmapNewData and virBitmapDataToString

The functions just read the passed pointer so it can be marked as const.

8 years agolibvirt-guests: Weaken dependency on libvirtd
Andrea Bolognani [Fri, 7 Oct 2016 08:10:42 +0000 (10:10 +0200)]
libvirt-guests: Weaken dependency on libvirtd

The Requires relationship is very strong, in that it prevents
a unit from running unless all the units it Requires are
running as well.

This turns out to be a problem because we want to be able to
restart libvirtd at any time without having libvirt-guests
suspend or shutdown running guests.

Turn the Requires relationship into a Wants relationship:
this way starting libvirt-guests will cause systemd to (attempt
to) start libvirtd as well, but stopping or restarting libvirtd
will not alter libvirt-guests' running state.

8 years agoqemu: Disable migration with ivshmem
Martin Kletzander [Tue, 20 Sep 2016 09:24:49 +0000 (11:24 +0200)]
qemu: Disable migration with ivshmem

It was never safe anyway and as such shouldn't have been enabled in the
first place.  Future patches will allow hot-(un)pluging of some ivshmem
devices as a workaround.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Don't complicate find loop
Martin Kletzander [Fri, 7 Oct 2016 13:56:40 +0000 (15:56 +0200)]
conf: Don't complicate find loop

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Fix virDomainShmemDefFind
Martin Kletzander [Wed, 21 Sep 2016 13:14:46 +0000 (15:14 +0200)]
conf: Fix virDomainShmemDefFind

Due to the switch of parameters in a call to virDomainShmemDefEquals()
no device was found when looking for device with all the information
except address.  Also fix the indentation.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoClean timer in virObjectEventStateFlush
Martin Kletzander [Tue, 11 Oct 2016 11:44:21 +0000 (13:44 +0200)]
Clean timer in virObjectEventStateFlush

If the last event callback is unregistered while the event loop is
dispatching, it is only marked as deleted, but not removed.  The number
of callbacks is more than zero in that case, so the timer is not
removed.  Because it can be removed in this function now (but also
accessed afterwards so that we set 'isDispatching = false' and have it
locked), we need to temporarily increase the reference counter of the
state for the duration of this function.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoDe-duplicate code into virObjectEventStateCleanupTimer()
Martin Kletzander [Tue, 11 Oct 2016 11:35:18 +0000 (13:35 +0200)]
De-duplicate code into virObjectEventStateCleanupTimer()

There is a repeating pattern of code that removes the timer if it's not
needed.  So let's move it to a new function.  We'll also use it later.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoReference state when using it as opaque
Martin Kletzander [Tue, 11 Oct 2016 11:30:11 +0000 (13:30 +0200)]
Reference state when using it as opaque

There should be one more reference because it is being kept in the list
of callbacks as an opaque.  We also unref it properly using
virObjectFreeCallback.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoChange virDomainEventState to virObjectLockable
Martin Kletzander [Tue, 11 Oct 2016 07:48:36 +0000 (09:48 +0200)]
Change virDomainEventState to virObjectLockable

This way we get reference counting and we can get rid of locking
function.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: migration: Disallow migration of read only disk
Corey S. McQuay [Mon, 26 Sep 2016 17:16:00 +0000 (13:16 -0400)]
qemu: migration: Disallow migration of read only disk

Currently Libvirt allows attempts to migrate read only disks. Qemu
cannot handle this as read only disks cannot be written to on the
destination system. The end result is a cryptic error message and a
failed migration.

This patch causes migration to fail earlier and provides a meaningful
error message stating that migrating read only disks is not supported.

Signed-off-by: Corey S. McQuay <csmcquay@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoqemu: Reuse virDomainDeGetVcpusTopology to calculate total vcpu count
Peter Krempa [Mon, 10 Oct 2016 13:57:54 +0000 (15:57 +0200)]
qemu: Reuse virDomainDeGetVcpusTopology to calculate total vcpu count

Rather than multiplying sockets, cores, and threads use the new helper
for getting the vcpu count resulting from the topology.

8 years agoconf: Sanitize cpu topology numbers
Peter Krempa [Mon, 10 Oct 2016 13:46:25 +0000 (15:46 +0200)]
conf: Sanitize cpu topology numbers

Make sure that the topology results into a sane number of cpus (up to
UINT_MAX) so that it can be sanely compared to the vcpu count of the VM.

Additionally the helper added in this patch allows to fetch the total
number the topology results to so that it does not have to be
reimplemented later.

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

8 years agoutil: Remove need for local 'nelems'
John Ferlan [Mon, 10 Oct 2016 20:08:39 +0000 (16:08 -0400)]
util: Remove need for local 'nelems'

Since it's only used in loop - just go direct.

8 years agotests: Need to initialize data
John Ferlan [Mon, 10 Oct 2016 15:08:26 +0000 (11:08 -0400)]
tests: Need to initialize data

If not initialized and the virAsprintf to jsonreply or fulllablel fails,
then the call to qemuMonitorTestFree will take stack data.

8 years agovsh: Fix some issues in auto completion code
John Ferlan [Mon, 10 Oct 2016 13:01:18 +0000 (09:01 -0400)]
vsh: Fix some issues in auto completion code

1. Move the declaration of const vshCmdDef *help - it should be at the
   top of the "if" rather than in the middle.

2. Change a comparison from && to || - without doing so we could crash
   on commands like 'virsh list' which would allow completion of some
   non -- option based on whatever was found in the current working
   directory and then as soon as that was completed, the next <tab>
   would crash since "opt" would be returned as NULL, but the check
   was dereferencing "&& opt->type"

3. Before dereferencing opt->completer, be sure opt isn't NULL.

8 years agoutil: Resolve memory leaks in virLogParse{Output|Filter}
John Ferlan [Mon, 10 Oct 2016 11:18:30 +0000 (07:18 -0400)]
util: Resolve memory leaks in virLogParse{Output|Filter}

In both virLogParseOutput and virLogParseFilter, rather than returning
NULL, goto cleanup since it's possible that for each the first condition
passes, but the || condition doesn't and thus we leak memory.

8 years agotests: Prefer virGetLastErrorMessage in testSELinuxLabeling
John Ferlan [Mon, 10 Oct 2016 10:30:28 +0000 (06:30 -0400)]
tests: Prefer virGetLastErrorMessage in testSELinuxLabeling

Yet another case of not needing virGetLastError processing

8 years agoconf: Remove incorrect check when encoding shmem audit message
John Ferlan [Mon, 10 Oct 2016 10:24:06 +0000 (06:24 -0400)]
conf: Remove incorrect check when encoding shmem audit message

Remove the !size check since size is initialized to NULL and thus
causing the condition to always be true

8 years agonetwork: add dnsmasq option 'dhcp-authoritative'
Martin Wilck [Wed, 21 Sep 2016 08:49:41 +0000 (10:49 +0200)]
network: add dnsmasq option 'dhcp-authoritative'

The dnsmasq man page recommends that dhcp-authoritative "should be
set when dnsmasq is definitely the only DHCP server on a network".
This is the case for libvirt-managed virtual networks.

The effect of this is that VMs that fail to renew their DHCP lease
in time (e.g. if the VM or host is suspended) will be able to
re-acquire the lease even if it's expired, unless the IP address has
been taken by some other host. This avoids various annoyances caused
by changing VM IP addresses.

8 years agoDon't update timer if there's none.
Martin Kletzander [Thu, 6 Oct 2016 15:05:14 +0000 (17:05 +0200)]
Don't update timer if there's none.

Sometimes virObjectEventStateFlush can be called without timer (if the
last event was unregistered right when the timer fired).  There is a
check for timer == -1, but that triggers warning and other log messages,
which is unnecessary.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotools: Exclude Xen dom0 from libvirt-guests.sh list
Stefan Bader [Fri, 7 Oct 2016 07:56:33 +0000 (09:56 +0200)]
tools: Exclude Xen dom0 from libvirt-guests.sh list

With newer versions of libvirt Domain-0 is again visible in the list of
running guests but it should not be considered as a guest for shutdown
or suspend.

Signed-off-by Stefan Bader <stefan.bader@canonical.com>

8 years agotools: Ignore newlines in libvirt-guests.sh guest list
Stefan Bader [Fri, 7 Oct 2016 07:56:32 +0000 (09:56 +0200)]
tools: Ignore newlines in libvirt-guests.sh guest list

The list file expects all guest UUIDs on the same line as the URI
which the guests run on. This does not happen when the list is
echo'ed in quotes. When stripping the quotes, newlines get transformed
into spaces. Without this, only the first guest on the list is actually
handled.

Based on a fix by Omar Siam <simar@gmx.net>

Bug-Ubuntu: http://bugs.launchpad.net/bugs/1591695

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
8 years agoexamples: Distribute all systemtap scripts.
Luyao Huang [Mon, 10 Oct 2016 03:42:46 +0000 (11:42 +0800)]
examples: Distribute all systemtap scripts.

Due to a missing entries in Makefile, we were not distributing
all the systemtap scripts we have.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirlog: Split parsing and setting priority
Erik Skultety [Mon, 21 Mar 2016 13:35:37 +0000 (14:35 +0100)]
virlog: Split parsing and setting priority

Handling of outputs and filters has been changed in a way that splits
parsing and defining. Do the same thing for logging priority as well, this
however, doesn't need much of a preparation.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Remove functions that aren't used anywhere anymore
Erik Skultety [Tue, 16 Aug 2016 19:28:21 +0000 (21:28 +0200)]
virlog: Remove functions that aren't used anywhere anymore

This is mainly virLogAddOutputTo* which were replaced by virLogNewOutputTo* and
the previously poorly named ones virLogParseAndDefine* functions. All of these
are unnecessary now, since all the original callers were transparently switched
to the new model of separate parsing and defining logic.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agodaemon: Split filter parsing and filter defining
Erik Skultety [Tue, 29 Mar 2016 14:48:08 +0000 (16:48 +0200)]
daemon: Split filter parsing and filter defining

Similar to outputs, parser should do parsing only, thus the 'define' logic
is going to be stripped from virLogParseAndDefineFilters by replacing calls to
this method to virLogSetFilters instead.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agodaemon: Split output parsing and output defining
Erik Skultety [Thu, 17 Mar 2016 14:26:40 +0000 (15:26 +0100)]
daemon: Split output parsing and output defining

Since virLogParseAndDefineOutputs is going to be stripped from 'output defining'
logic, replace all relevant occurrences with virLogSetOutputs call to make the
change transparent to all original callers (daemons mostly).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogSetFilters
Erik Skultety [Thu, 24 Mar 2016 13:34:11 +0000 (14:34 +0100)]
virlog: Introduce virLogSetFilters

This method will eventually replace virLogParseAndDefineFilters which
currently does both parsing and defining.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogSetOutputs
Erik Skultety [Tue, 8 Mar 2016 12:37:56 +0000 (13:37 +0100)]
virlog: Introduce virLogSetOutputs

This API is the entry point to output modification of the logger. Currently,
everything is done by virLogParseAndDefineOutputs. Parsing and defining will be
split into two operations both handled by this method transparently.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogParseFilters
Erik Skultety [Wed, 5 Oct 2016 14:48:47 +0000 (16:48 +0200)]
virlog: Introduce virLogParseFilters

Abstraction added over parsing a single filter. The method parses potentially a
set of logging filters, while adding each filter logging object to a
caller-provided array.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogParseOutputs
Erik Skultety [Wed, 5 Oct 2016 14:29:15 +0000 (16:29 +0200)]
virlog: Introduce virLogParseOutputs

Another abstraction added on the top of parsing a single logging output. This
method takes and parses the whole set of outputs, adding each single output
that has already been parsed into a caller-provided array. If the user-supplied
string contained duplicate outputs, only the last occurrence is taken into
account (all the others are removed from the list), so we silently avoid
duplicate logs.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogParseFilter
Erik Skultety [Wed, 5 Oct 2016 12:41:51 +0000 (14:41 +0200)]
virlog: Introduce virLogParseFilter

Same as for outputs, introduce a new method, that is basically the same as
virLogParseAndDefineFilter with the difference that it does not define the
filter. It rather returns a newly created object that needs to be inserted into
a list and then defined separately.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogParseOutput
Erik Skultety [Tue, 16 Aug 2016 14:27:47 +0000 (16:27 +0200)]
virlog: Introduce virLogParseOutput

Introduce a method to parse an individual logging output. The difference
compared to the virLogParseAndDefineOutput is that this method does not define
the output, instead it makes use of the virLogNewOutputTo* methods introduced
in the previous patch and just returns the virLogOutput object that has to be
added to a list of object which then can be defined as a whole via
virLogDefineOutputs. The idea remains still the same - split parsing and
defining of the logging primitives (outputs, filters).
Additionally, since virLogNewOutputTo* methods are now finally used,
ATTRIBUTE_UNUSED can be successfully removed from the methods' definitions,
since that was just to avoid compiler complaints about unused static functions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Take a special care of syslog when setting new set of log outputs
Erik Skultety [Wed, 30 Mar 2016 10:38:39 +0000 (12:38 +0200)]
virlog: Take a special care of syslog when setting new set of log outputs

Now that we're in the critical section, syslog connection can be re-opened
by issuing openlog, which is something that cannot be done beforehand, since
syslog keeps its file descriptor private and changing the tag earlier might
introduce a log inconsistency if something went wrong with preparing a new set
of logging outputs in order to replace the existing one.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogNewOutputTo* as a replacement for virLogAddOutputTo*
Erik Skultety [Fri, 15 Jul 2016 12:47:58 +0000 (14:47 +0200)]
virlog: Introduce virLogNewOutputTo* as a replacement for virLogAddOutputTo*

Continuing with the effort to split output parsing and defining, these new
functions return a logging object reference instead of defining the output.
Eventually, these functions will replace the existing ones (virLogAddOutputTo*)
which will then be dropped.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogDefineFilters
Erik Skultety [Tue, 29 Mar 2016 15:04:36 +0000 (17:04 +0200)]
virlog: Introduce virLogDefineFilters

Prepare a method that only defines a set of filters. It takes a list of
filters, preferably created by virLogParseFilters. The original set of filters
is reset and replaced by the new user-provided set of filters.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogDefineOutputs
Erik Skultety [Thu, 17 Mar 2016 14:18:06 +0000 (15:18 +0100)]
virlog: Introduce virLogDefineOutputs

Prepare a method that only defines a set of outputs. It takes a list of
outputs, preferably created by virLogParseOutputs. The original set of outputs
is reset and replaced by the new user-provided set of outputs.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogFindOutput
Erik Skultety [Wed, 30 Mar 2016 10:22:15 +0000 (12:22 +0200)]
virlog: Introduce virLogFindOutput

Outputs are a bit trickier than filters, since the user(config)-specified
set of outputs can contain duplicates. That would lead to logging the same
message twice. For compatibility reasons, we cannot just error out and forbid
the daemon to start if we find duplicate outputs which do not make sense.
Instead, we could silently take into account only the last occurrence of the
duplicate output and remove all the previous ones, so that the logger will not
try to use them when it is looping over all of its registered outputs.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogFilterNew
Erik Skultety [Fri, 8 Jul 2016 12:15:43 +0000 (14:15 +0200)]
virlog: Introduce virLogFilterNew

This method allocates a new filter object which it then returns back to caller.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Introduce virLogOutputNew
Erik Skultety [Fri, 8 Jul 2016 11:46:36 +0000 (13:46 +0200)]
virlog: Introduce virLogOutputNew

In order to later split output parsing and output defining, introduce a new
function which will create a new virLogOutput object which the parser will
insert into a list with the list being eventually defined.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Store the journald fd within the output object
Erik Skultety [Wed, 17 Aug 2016 15:20:35 +0000 (17:20 +0200)]
virlog: Store the journald fd within the output object

There is really no reason why we could not keep journald's fd within the
journald output object the same way as we do for regular file-based outputs.
By doing this we later won't have to special case the journald-based output
(due to the fd being globally shared) when replacing the existing set of outputs
with a new one. Additionally, by making this change, we don't need the
virLogCloseJournald routine anymore, plain virLogCloseFd will suffice.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Rename virLogParse* to virLogParseAndDefine*
Erik Skultety [Fri, 15 Jul 2016 10:37:05 +0000 (12:37 +0200)]
virlog: Rename virLogParse* to virLogParseAndDefine*

Right now virLogParse* functions are doing both parsing and defining of filters
and outputs which should be two separate operations. Since the naming is
apparently a bit poor this patch renames these functions to
virLogParseAndDefine* which eventually will be replaced by virLogSet*.
Additionally, virLogParse{Filter,Output} will be later (after the split) reused,
so that these functions do exactly what the their name suggests.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirlog: Remove unused macro IS_SPACE
Erik Skultety [Thu, 6 Oct 2016 07:53:53 +0000 (09:53 +0200)]
virlog: Remove unused macro IS_SPACE

During first stage of virlog.c refactor, commit 0b231195 forgot to remove the
macro definition along with its usage.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovirsh domdisplay: introduce '--all' for showing all possible graphical displays
Chen Hanxiao [Sun, 9 Oct 2016 10:34:22 +0000 (18:34 +0800)]
virsh domdisplay: introduce '--all' for showing all possible graphical displays

For one VM, it could had more than one graphical display.
Such as we coud add both vnc and spice display to a VM.

This patch introduces '--all' for showing all
possible graphical display of a active VM.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Check/ignore already disabled event
John Ferlan [Fri, 7 Oct 2016 12:28:58 +0000 (08:28 -0400)]
util: Check/ignore already disabled event

If the event is already disabled, then don't bother with setting it
disabled again.  Causes unnecessary error on systems that don't support
the feature anyway.

8 years agoutil: Clear up some perf error messages
John Ferlan [Fri, 7 Oct 2016 12:14:37 +0000 (08:14 -0400)]
util: Clear up some perf error messages

Make it clearer that the perf event is based/for the host cpu and
use the virPerfEventTypeToString to convert the type to a string

8 years agodocs: Alter descriptions of perf cpu_cycles
John Ferlan [Fri, 7 Oct 2016 11:55:51 +0000 (07:55 -0400)]
docs: Alter descriptions of perf cpu_cycles

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

Alter the descriptions to match what the cpu_cycles actually is

8 years agoqemu: fix command line building for iommu devices
Daniel P. Berrange [Mon, 3 Oct 2016 12:31:12 +0000 (13:31 +0100)]
qemu: fix command line building for iommu devices

The intel-iommu device has existed since QEMU 2.2.0, but
it was only possible to create it with -device since
QEMU 2.7.0, thanks to:

  commit 621d983a1f9051f4cfc3f402569b46b77d8449fc
  Author: Marcel Apfelbaum <marcel@redhat.com>
  Date:   Mon Jun 27 18:38:34 2016 +0300

    hw/iommu: enable iommu with -device

    Use the standard '-device intel-iommu' to create the IOMMU device.
    The legacy '-machine,iommu=on' can still be used.

The libvirt capability check & command line formatting code
is thus broken for all QEMU versions 2.2.0 -> 2.6.0 inclusive.

This fixes it to use iommu=on instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agodocs: Add PCP as monitoring application
Marko Myllynen [Fri, 7 Oct 2016 09:53:11 +0000 (11:53 +0200)]
docs: Add PCP as monitoring application

This has been announced on the list:

https://www.redhat.com/archives/libvir-list/2016-October/msg00187.html

Signed-off-by: Marko Myllynen <myllynen@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoprivate_syms: add virLogFilterListFree to libvirt_private.syms
Erik Skultety [Thu, 6 Oct 2016 07:11:28 +0000 (09:11 +0200)]
private_syms: add virLogFilterListFree to libvirt_private.syms

Commit 660468b1 forgot to add it, so let's add it now to prevent future linker
issues.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agom4: Drop PKG_PROG_PKG_CONFIG compatibility code
Andrea Bolognani [Thu, 6 Oct 2016 11:30:38 +0000 (13:30 +0200)]
m4: Drop PKG_PROG_PKG_CONFIG compatibility code

This was needed for RHEL 4 vintage distributions, which we
haven't supported for a long time now.

8 years agovirt-yajl: Fix detection of yajl requirements
Martin Kletzander [Thu, 29 Sep 2016 07:48:50 +0000 (09:48 +0200)]
virt-yajl: Fix detection of yajl requirements

Running the output of qemu -help doesn't make any sense.  We should be
looking for libvirt being mentioned in the output.  This worked by
accident, let's make it work as expected it to.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agodocs/Makefile.am: build hvsupport.html earlier
Ján Tomko [Thu, 28 Jul 2016 08:04:11 +0000 (10:04 +0200)]
docs/Makefile.am: build hvsupport.html earlier

This file requires three steps instead of two.
Move it earlier in the list of targets to avoid waiting for it.

8 years agodocs/Makefile.am: remove redundant variables
Ján Tomko [Tue, 28 Jun 2016 20:56:47 +0000 (22:56 +0200)]
docs/Makefile.am: remove redundant variables

Remove DOC_SOURCE_DIR, introduced by and
unused since commit b325d74.

PERL is already detected in configure.ac.

8 years agoqemu: monitor: Properly configure backend for UDP chardevs
Peter Krempa [Tue, 27 Sep 2016 14:01:55 +0000 (16:01 +0200)]
qemu: monitor: Properly configure backend for UDP chardevs

Since introduction of chardev hotplug the code was wrong for the UDP
case and basically created a TCP socket instead. Use proper objects and
type for UDP.

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

8 years agoqemu: monitor: Simplify construction of chardev backends
Peter Krempa [Mon, 26 Sep 2016 15:19:43 +0000 (17:19 +0200)]
qemu: monitor: Simplify construction of chardev backends

8 years agotests: qemumonitorjsontest: Do some actual testing in qemuMonitorJSONTestAttachChardev
Peter Krempa [Tue, 27 Sep 2016 07:52:50 +0000 (09:52 +0200)]
tests: qemumonitorjsontest: Do some actual testing in qemuMonitorJSONTestAttachChardev

Until now the test was rather useless since it didn't check the
arguments formatted and didn't use properly configured chardev objects.

Add the expected arguments and instrument the test to validate them.
Modify some test cases to actually add valid data.

Note that the UDP test data is currently wrong due to a bug.

8 years agotests: qemumonitorjson: Don't do multiple tests in one virTestRun
Peter Krempa [Tue, 27 Sep 2016 13:49:05 +0000 (15:49 +0200)]
tests: qemumonitorjson: Don't do multiple tests in one virTestRun

The chardev attach test would do all the tests in one virTestRun
instance. If one sub-test failed then the test would report failure
improperly and the error would be hard to debug since the error pointer
was overwritten.

8 years agotests: qemu: Add support for testing aguments on monitor verbatim
Peter Krempa [Tue, 27 Sep 2016 15:11:55 +0000 (17:11 +0200)]
tests: qemu: Add support for testing aguments on monitor verbatim

Add code that takes a string and matches it against the data passed as
arguments from qemu. This is a simpler version of
qemuMonitorTestAddItemParams.

8 years agoconf: Sanitize formatting of UDP chardev source
Peter Krempa [Mon, 26 Sep 2016 15:15:00 +0000 (17:15 +0200)]
conf: Sanitize formatting of UDP chardev source

Use much simpler logic to determine parts of the code to print.

8 years agoconf: Add a formatting macro for all the blkiotune values
John Ferlan [Mon, 19 Sep 2016 12:27:24 +0000 (08:27 -0400)]
conf: Add a formatting macro for all the blkiotune values

Rather than copy-paste - use a macro

Unfortunately due to how the RNG schema was written keeping the 'value'
and 'value'_max next to each other in the XML causes a schema failure,
so the FORMAT has to write out singly rather than optimizing to write
out both values at once

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Adjust how supportMaxOptions is used.
John Ferlan [Mon, 19 Sep 2016 21:46:07 +0000 (17:46 -0400)]
qemu: Adjust how supportMaxOptions is used.

We're about to add more options, let's avoid having multiple if-then-else
which each try to set up the qemuMonitorJSONMakeCommand call with all the
parameters it knows about.

Instead, use the fact that when a NULL is found in the argument list that
processing of the remaining arguments stops and just have call.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Convert from shorthand to longer throttling names
John Ferlan [Fri, 23 Sep 2016 12:07:53 +0000 (08:07 -0400)]
qemu: Convert from shorthand to longer throttling names

We're about to add 6 new options and it appears (from testing) one cannot
utilize both the shorthand (alias) and (much) longer names for the arguments.
So modify the command builder to use the longer name and of course alter the
test output .args to have the similarly innocuous long name.

Also utilize a macro to build that name makes it so much more visually
appealing and saves a few characters or potential cut-n-paste issues.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agotests: Add blkdeviotune-max xml2xmltest
John Ferlan [Mon, 19 Sep 2016 13:52:10 +0000 (09:52 -0400)]
tests: Add blkdeviotune-max xml2xmltest

It was missing... Also since I'm using the soft link from qemuxml2xmloutdata
to the qemuxml2argvdata file, modify the output file to have the necessary
<address> elements plus the mouse and keyboard.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoinclude: Update description for <iotune> max params
John Ferlan [Mon, 19 Sep 2016 20:49:09 +0000 (16:49 -0400)]
include: Update description for <iotune> max params

The upstream qemu commit 'dce13204' changed the wording just slightly
to add 'in bursts' essentially.  Just following that model here.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agodocs: Fix typo in libvirt-domain.h parameter description
John Ferlan [Mon, 19 Sep 2016 11:15:27 +0000 (07:15 -0400)]
docs: Fix typo in libvirt-domain.h parameter description

Change Marco to Macro

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: allow 32 slots on pcie-expander-bus, not just 1
Laine Stump [Wed, 5 Oct 2016 15:26:07 +0000 (11:26 -0400)]
qemu: allow 32 slots on pcie-expander-bus, not just 1

When I added support for the pcie-expander-bus controller in commit
bc07251f, I incorrectly thought that it only had a single slot
available. Actually it has 32 slots, just like the root complex aka
pcie-root (the part that I *did* get correct is that unlike pcie-root
a pcie-expander-bus doesn't allow any integrated endpoint devices -
only pcie-root-ports and dmi-to-pci-controllers are allowed).

8 years agovsh: Fix warnings in command line completer
Jiri Denemark [Wed, 5 Oct 2016 07:19:19 +0000 (09:19 +0200)]
vsh: Fix warnings in command line completer

GCC complained that

vsh.c: In function 'vshReadlineOptionsGenerator':
vsh.c:2622:29: warning: unused variable 'opt' [-Wunused-variable]
         const vshCmdOptDef *opt = &cmd->opts[list_index];
                             ^
vsh.c: In function 'vshReadlineParse':
vsh.c:2830:44: warning: 'opt' may be used uninitialized in this function
[-Wmaybe-uninitialized]
             completed_list = opt->completer(autoCompleteOpaque,

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Create helper qemuMonitorJSONGetBlockDevDevice
John Ferlan [Mon, 3 Oct 2016 19:04:32 +0000 (15:04 -0400)]
qemu: Create helper qemuMonitorJSONGetBlockDevDevice

This will fetch "this device" from the recently returned 'dev' and perform
common error checking for the paths that call it.

8 years agoqemu: Create helper qemuMonitorJSONGetBlockDev
John Ferlan [Mon, 3 Oct 2016 18:58:59 +0000 (14:58 -0400)]
qemu: Create helper qemuMonitorJSONGetBlockDev

This will grab the 'dev' from devices and do the common validation checks.

8 years agoqemu: Create common code for JSON "query-block" call
John Ferlan [Tue, 27 Sep 2016 13:39:21 +0000 (09:39 -0400)]
qemu: Create common code for JSON "query-block" call

Reduce some cut-n-paste code by creating common helper. Make use of the
recently added virJSONValueObjectStealArray to grab the devices list as
part of the common code (we we can Free the reply) and return devices for
each of the callers to continue to parse.

NB: This also adds error checking to qemuMonitorJSONDiskNameLookup

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoutil: Introduce virJSONValueObjectStealArray
John Ferlan [Mon, 3 Oct 2016 18:45:13 +0000 (14:45 -0400)]
util: Introduce virJSONValueObjectStealArray

Provide the Steal API for any code paths that will desire to grab the
object array and then free it afterwards rather than relying to freeing
the whole chain from the reply.

8 years agorbd: Move the encryption check in build
John Ferlan [Fri, 16 Sep 2016 12:05:10 +0000 (08:05 -0400)]
rbd: Move the encryption check in build

No sense opening a connection only to fail because we don't support the
type of build being attempted.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agorbd: Change to using heap allocated state contexts
John Ferlan [Wed, 14 Sep 2016 17:56:31 +0000 (13:56 -0400)]
rbd: Change to using heap allocated state contexts

Rather than use stack allocated state context pointers, let's allocate and
free the state context pointer.  In doing so, we'll shrink the code a bit
since many routines perform the same initialization sequence.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agorbd: Change virStorageBackendRBDCloseRADOSConn to be static void
John Ferlan [Wed, 14 Sep 2016 18:01:34 +0000 (14:01 -0400)]
rbd: Change virStorageBackendRBDCloseRADOSConn to be static void

Since none of the callers check the status, let's just alter it to
a static void.

While we're at it - scrap the local runtime variable and just do the
math in the VIR_DEBUG directly.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Allow making vcpus hotpluggable with virDomainSetVcpusFlags
Peter Krempa [Wed, 21 Sep 2016 05:57:43 +0000 (07:57 +0200)]
qemu: Allow making vcpus hotpluggable with virDomainSetVcpusFlags

Implement support for VIR_DOMAIN_VCPU_HOTPLUGGABLE so that users can
choose to make vcpus added by the API removable.

8 years agolib: Introduce VIR_DOMAIN_VCPU_HOTPLUGGABLE for virDomainSetVcpusFlags
Peter Krempa [Tue, 20 Sep 2016 12:08:55 +0000 (14:08 +0200)]
lib: Introduce VIR_DOMAIN_VCPU_HOTPLUGGABLE for virDomainSetVcpusFlags

For compatibility reasons virDomainSetVcpus needs to add vcpus as non
hotpluggable which means that the users will not be able to unplug it
after the VM has started. Add a flag that will allow to tell the API
that the unpluggable vcpus are okay.

8 years agoqemu: attach: Close monitor socket on connection failure
Peter Krempa [Mon, 3 Oct 2016 11:11:47 +0000 (13:11 +0200)]
qemu: attach: Close monitor socket on connection failure

If attaching to a qemu process fails after opening the monitor socket
libvirt does not clean up the monitor. As the monitor also holds a
reference to the domain object the qemu attach API basically leaks it.

QEMU also does not interact on a second monitor connection and thus a
further attempt to attach to it would lock up.

Prevent libvirt from leaking the monitor by explicitly closing it.

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

8 years agoqemu: Don't strictly require JSON monitor for vCPU detection
Peter Krempa [Fri, 30 Sep 2016 10:45:59 +0000 (12:45 +0200)]
qemu: Don't strictly require JSON monitor for vCPU detection

Attaching to a existing qemu process allows to get us into a situation
when qemu is new enough to have JSON monitor and new vCPU hotplug but
the json monitor is not used. The vCPU detection code would require it
though. This broke attaching to qemu processes.

Make the condition less strict and just skip the vCPU hotplug detection
if JSON monitor is not available.

Resolves one of the symptoms in:
https://bugzilla.redhat.com/show_bug.cgi?id=1378401

8 years agoDon't drop expired lease while reading custom leases file
Nehal J Wani [Fri, 30 Sep 2016 15:11:39 +0000 (15:11 +0000)]
Don't drop expired lease while reading custom leases file

Libvirt, on its own, shouldn't decide whether an expired lease should
stay in the custom leases database or not. It should rather rely on
the 'DEL' event from dnsmasq.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoNSS: Add explicit check to not report expired lease
Nehal J Wani [Fri, 30 Sep 2016 15:11:38 +0000 (15:11 +0000)]
NSS: Add explicit check to not report expired lease

The NSS module shouldn't rely on custom leases database to not have
entries for leases which have expired.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoremote: Increase bound limit for virDomainGetBlockIoTune
John Ferlan [Tue, 4 Oct 2016 11:07:20 +0000 (07:07 -0400)]
remote: Increase bound limit for virDomainGetBlockIoTune

We are about to add 6 new values to fetch. This will put us over the
current limit of 16 (we're at 13 now).

Once there are more than 16 parameters, this will affect existing clients
that attempt to fetch blockiotune config values for the domain from the
remote host since the server side has no mechanism to determine whether
the capability for the emulator exists and thus would attempt to return
all known values from the persistentDef. If attempting to fetch the
blockiotune values from a running domain, the code will check the emulator
capabilities and set maxparams (in qemuDomainGetBlockIoTune) appropriately.

On the client side of the remote connection, it uses this constant in
xdr_remote_domain_get_block_io_tune_ret and virTypedParamsDeserialize
calls, so if a remote server returns more than 16 parameters, then the
client will fail with "Unable to decode message payload".

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoremote: Fix erroneous usage of constant
John Ferlan [Tue, 4 Oct 2016 11:05:20 +0000 (07:05 -0400)]
remote: Fix erroneous usage of constant

The REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX was erroneously used in the
remoteDomainBlockStatsFlags and remoteDomainGetBlockIoTune calls. Change
the constant to be the right one.

Fortunately, all 3 are defined as 16.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoPost-release version bump to 2.4.0
John Ferlan [Tue, 4 Oct 2016 18:28:35 +0000 (14:28 -0400)]
Post-release version bump to 2.4.0

8 years agoRelease of libvirt-2.3.0
Daniel Veillard [Tue, 4 Oct 2016 16:33:26 +0000 (18:33 +0200)]
Release of libvirt-2.3.0

* docs/news.html.in: updated for release
* po/*.po*: regenerated

8 years agoRevert "conf: Skip post parse callbacks when creating copy"
Michal Privoznik [Tue, 4 Oct 2016 16:00:02 +0000 (18:00 +0200)]
Revert "conf: Skip post parse callbacks when creating copy"

This breaks vCPU hotplug, because when starting a domain, we
create a copy of domain definition (which becomes live XML) and
during the post parse callbacks we might adjust some tunings so
that vCPU hotplug is possible.

This reverts commit 581b7756af18dcf84b57d9947978725d2dfbfc18.

8 years agoRevert "domain_conf: Introduce VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE"
Michal Privoznik [Tue, 4 Oct 2016 15:58:21 +0000 (17:58 +0200)]
Revert "domain_conf: Introduce VIR_DOMAIN_DEF_PARSE_SKIP_POST_PARSE"

This breaks vCPU hotplug, because when starting a domain, we
create a copy of domain definition (which becomes live XML) and
during the post parse callbacks we might adjust some tunings so
that vCPU hotplug is possible.

This reverts commit c0f90799bc7fa4b690ead6a592806378a243873c.

8 years agoqemu: vcpu: Clear vcpu order information rather than making it invalid
Peter Krempa [Wed, 21 Sep 2016 05:59:57 +0000 (07:59 +0200)]
qemu: vcpu: Clear vcpu order information rather than making it invalid

Certain operations may make the vcpu order information invalid. Since
the order is primarily used to ensure migration compatibility and has
basically no other user benefits, clear the order prior to certain
operations and document that it may be cleared.

All the operations that would clear the order can still be properly
executed by defining a new domain configuration rather than using the
helper APIs.

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

8 years agoqemu: Fix coldplug of vcpus
Peter Krempa [Wed, 21 Sep 2016 05:46:25 +0000 (07:46 +0200)]
qemu: Fix coldplug of vcpus

virDomainDefSetVcpus was not designed to handle coldplug of vcpus now
that we can set state of vcpus individually.

Introduce qemuDomainSetVcpusConfig that properly handles state changes
of vcpus when coldplugging so that invalid configurations are not
created.

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

8 years agoqemu: process: Enforce 'vcpu' order range to <1,maxvcpus>
Peter Krempa [Fri, 16 Sep 2016 13:51:14 +0000 (15:51 +0200)]
qemu: process: Enforce 'vcpu' order range to <1,maxvcpus>

The current code that validates duplicate vcpu order would not work
properly if the order would exceed def->maxvcpus. Limit the order to the
interval described.

8 years agoqemu: process: Don't use shifted indexes for vcpu order verification
Peter Krempa [Wed, 14 Sep 2016 04:50:00 +0000 (06:50 +0200)]
qemu: process: Don't use shifted indexes for vcpu order verification

Allocate a one larger bitmap rather than shifting the indexes back to
zero.

8 years agoqemu: process: Fix off-by-one in vcpu order duplicate error message
Peter Krempa [Wed, 14 Sep 2016 03:58:33 +0000 (05:58 +0200)]
qemu: process: Fix off-by-one in vcpu order duplicate error message

The bitmap indexes for the order duplicate check are shifted to 0 since
vcpu order 0 is not allowed. The error message doesn't need such
treating though.

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

8 years agodocs: correct version requirements for <kvm><hidden='on'/></kvm>
Laine Stump [Thu, 29 Sep 2016 17:38:07 +0000 (13:38 -0400)]
docs: correct version requirements for <kvm><hidden='on'/></kvm>

When support was added for the kvm hidden='on' attribute in commit
d07116, the version requirement was listed as "2.1.0 (QEMU
only)". However, this was added when libvirt was at version 1.2.8 - it
is *QEMU* that must be at version 2.1.0 or later.

This went unnoticed for a very long time (over 2 years). Then a week
or two ago a new Windows convert in the #virt channel on OFTC was told
he needed to use this feature (to prevent nvidia drivers in a guest
from refusing to work due to being run in a virtual machine). There
was some problem with it being recognized and "someone" (it may have
been me, or may have been someone else, I don't remember) pointed out
that the documentation at

  http://www.libvirt.org/formatdomain.html

says that it requires libvirt 2.1.0. The next several days were filled
with agony as a new convert to Linux first tried to upgrade a Linux
Mint host running their "LTS" version to something newer, then tried
to install a libvirt build built for Ubuntu onto this, and later back
to the old LTS Linux Mint. After this he tried building his own
libvirt from source (with all the expected problems), and finally
switched to Fedora. In the end it was hours and hours of everybody's
lives that they will never get back. To now learn that he didn't need
to do this (his original libvirt version was 1.3.3, so whatever his
problem was, it was elsewhere) makes the pain all that much worse.

To prevent this from happening again, this simple patch changes the
version requirement for the kvm hidden attribute from "2.1.0 (QEMU
only)" to "1.2.8 (QEMU 2.1.0)".

8 years agosanlock: Properly init io_timeout
Michal Privoznik [Thu, 15 Sep 2016 11:05:34 +0000 (13:05 +0200)]
sanlock: Properly init io_timeout

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

Hold on to your hats, because this is gonna be wild.

In bd3e16a3 I've tried to expose sanlock io_timeout. What I had
not realized (because there is like no documentation for sanlock
at all) was very unusual way their APIs work. Basically, what we
do currently is:

    sanlock_add_lockspace_timeout(&ls, io_timeout);

which adds a lockspace to sanlock daemon. One would expect that
io_timeout sets the io_timeout for it. Nah! That's where you are
completely off the tracks. It sets timeout for next lockspace you
will probably add later. Therefore:

   sanlock_add_lockspace_timeout(&ls, io_timeout = 10);
   /* adds new lockspace with default io_timeout */

   sanlock_add_lockspace_timeout(&ls, io_timeout = 20);
   /* adds new lockspace with io_timeout = 10 */

   sanlock_add_lockspace_timeout(&ls, io_timeout = 40);
   /* adds new lockspace with io_timeout = 20 */

And so on. You get the picture.
Fortunately, we don't allow setting io_timeout per domain or per
domain disk. So we just need to set the default used in the very
first step and hope for the best (as all the io_timeout-s used
later will have the same value).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agom4: Check for sanlock_write_lockspace
Michal Privoznik [Thu, 15 Sep 2016 08:45:26 +0000 (10:45 +0200)]
m4: Check for sanlock_write_lockspace

Currently, we are checking for sanlock_add_lockspace_timeout
which is good for now. But in a subsequent patch we are going to
use sanlock_write_lockspace (which sets an initial value for io
timeout for sanlock). Now, there is no reason to check for both
functions in sanlock library as the sanlock_write_lockspace was
introduced in 2.7 release and the one we are currently checking
for in the 2.5 release. Therefore it is safe to assume presence
of sanlock_add_lockspace_timeout when sanlock_write_lockspace
is detected.

Moreover, the macro for conditional compilation is renamed to
HAVE_SANLOCK_IO_TIMEOUT (as it now encapsulates two functions).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolock_driver_sanlock: Avoid global driver variable whenever possible
Michal Privoznik [Thu, 15 Sep 2016 11:18:13 +0000 (13:18 +0200)]
lock_driver_sanlock: Avoid global driver variable whenever possible

Global variables are bad, we should avoid using them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Only use memory-backend-file with NUMA if needed
Martin Kletzander [Fri, 23 Sep 2016 09:31:30 +0000 (11:31 +0200)]
qemu: Only use memory-backend-file with NUMA if needed

If this reminds you of a commit message from around a year ago, it's
41c2aa729f0af084ede95ee9a06219a2dd5fb5df and yes, we're dealing with
"the same thing" again.  Or f309db1f4d51009bad0d32e12efc75530b66836b and
it's similar.

There is a logic in place that if there is no real need for
memory-backend-file, qemuBuildMemoryBackendStr() returns 0.  However
that wasn't the case with hugepage backing.  The reason for that was
that we abused the 'pagesize' variable for storing that information, but
we should rather have a separate one that specifies whether we really
need the new object for hugepage backing.  And that variable should be
set only if this particular NUMA cell needs special treatment WRT
hugepages.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>