]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agosrc: Treat PID as signed
Michal Privoznik [Thu, 6 Oct 2016 14:54:41 +0000 (16:54 +0200)]
src: Treat PID as signed

This initially started as a fix of some debug printing in
virCgroupDetect. However it turned out that other places suffer
from the similar problem. While dealing with pids, esp. in cases
where we cannot use pid_t for ABI stability reasons, we often
chose an unsigned integer type. This makes no sense as pid_t is
signed.
Also, new syntax-check rule is introduced so we won't repeat this
mistake.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirsh: Be explicit that vol-resize is an offline operation.
Ivan Baldo [Tue, 11 Oct 2016 20:13:57 +0000 (17:13 -0300)]
virsh: Be explicit that vol-resize is an offline operation.

It is stated in the manual already, so let's mention the same thing in
the description to avoid causing problems.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotestNodeGetCellsFreeMemory: Fix off by one error
Michal Privoznik [Thu, 15 Sep 2016 15:42:36 +0000 (17:42 +0200)]
testNodeGetCellsFreeMemory: Fix off by one error

Consider the following scenario:

  virsh # freecell --all
      0:       2048 KiB
      1:       4096 KiB
  --------------------
  Total:       6144 KiB

  virsh # freecell 0
  0: 2048 KiB

  virsh # freecell 1
  1: 4096 KiB

And now before this change:

  virsh # freecell 2

After this change:

  virsh # freecell 2
  error: invalid argument: Range exceeds available cells

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotestOpenDefault: Rename loop variable
Michal Privoznik [Thu, 15 Sep 2016 15:10:15 +0000 (17:10 +0200)]
testOpenDefault: Rename loop variable

We have inclination to calling our loop variables i, j, k, not u.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirsh: Fix typos in manpage
Nitesh Konkar [Mon, 10 Oct 2016 14:07:14 +0000 (19:37 +0530)]
virsh: Fix typos in manpage

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agovirsh: Fix commas in manpage to enhance readability.
Nitesh Konkar [Mon, 10 Oct 2016 14:07:13 +0000 (19:37 +0530)]
virsh: Fix commas in manpage to enhance readability.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoqemu_command: add support to use virtio as secondary video device
Pavel Hrdina [Mon, 10 Oct 2016 18:19:06 +0000 (20:19 +0200)]
qemu_command: add support to use virtio as secondary video device

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: introduce enum of secondary models for video device
Pavel Hrdina [Wed, 12 Oct 2016 15:39:02 +0000 (17:39 +0200)]
qemu_command: introduce enum of secondary models for video device

There are two video devices with models without VGA compatibility mode.
They are primary used as secondary video devices, but in some cases it
is required to use them also as primary video devices.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: cleanup qemuBuildVideoCommandLine
Pavel Hrdina [Tue, 11 Oct 2016 15:20:39 +0000 (17:20 +0200)]
qemu_command: cleanup qemuBuildVideoCommandLine

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: properly detect which model to use for video device
Pavel Hrdina [Fri, 30 Sep 2016 12:41:37 +0000 (14:41 +0200)]
qemu_command: properly detect which model to use for video device

This improves commit 706b5b6277 in a way that we check qemu capabilities
instead of what architecture we are running on to detect whether we can
use *virtio-vga* model or not.  This is not a case only for arm/aarch64.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_capabilities: check for existence of virtio-vga
Pavel Hrdina [Tue, 11 Oct 2016 12:07:58 +0000 (14:07 +0200)]
qemu_capabilities: check for existence of virtio-vga

Commit 21373feb added support for primary virtio-vga device but it was
checking for virtio-gpu.  Let's check for existence of virtio-vga if we
want to use it.

Virtio video device is currently represented by three different models
*virtio-gpu-device*, *virtio-gpu-pci* and *virtio-vga*.  The first two
models are tied together and if virtio video devices is compiled in they
both exist.  However, the *virtio-vga* model doesn't have to exist on
some architectures even if the first two models exist.  So we cannot
group all three together.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: pass only video device to qemuBuildVgaVideoCommand
Pavel Hrdina [Tue, 11 Oct 2016 15:56:41 +0000 (17:56 +0200)]
qemu_command: pass only video device to qemuBuildVgaVideoCommand

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: separate code for video device via -vga attribute
Pavel Hrdina [Tue, 11 Oct 2016 15:55:32 +0000 (17:55 +0200)]
qemu_command: separate code for video device via -vga attribute

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: always check capabilities for video devices
Pavel Hrdina [Mon, 10 Oct 2016 15:51:38 +0000 (17:51 +0200)]
qemu_process: always check capabilities for video devices

Before this patch we've checked qemu capabilities for video devices
only while constructing qemu command line using "-device" option.

Since we support qemu only if "-device" option is present we can use
the same capabilities to check also video devices while using "-vga"
option to construct qemu command line.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: move video validation out of qemu_command
Pavel Hrdina [Tue, 11 Oct 2016 15:53:50 +0000 (17:53 +0200)]
qemu_process: move video validation out of qemu_command

Runtime validation that depend on qemu capabilities should be moved
into qemuProcessStartValidateXML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_domain: move video validation out of qemu_command
Pavel Hrdina [Tue, 11 Oct 2016 15:48:59 +0000 (17:48 +0200)]
qemu_domain: move video validation out of qemu_command

All definition validation that doesn't depend on qemu capabilities
and was allowed previously as valid definition should be placed into
qemuDomainDefValidate.

The check whether video type is supported or not was based on an enum
that translates type into model.  Use switch to ensure that if new
video type is added, it will be properly handled.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_capabilities: detect properties for virtio-gpu-device
Pavel Hrdina [Mon, 10 Oct 2016 15:56:35 +0000 (17:56 +0200)]
qemu_capabilities: detect properties for virtio-gpu-device

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_capabilities: rename QEMU_CAPS_VIRTIO_GPU_VIRGL
Pavel Hrdina [Tue, 11 Oct 2016 12:06:53 +0000 (14:06 +0200)]
qemu_capabilities: rename QEMU_CAPS_VIRTIO_GPU_VIRGL

We generally uses QEMU_CAPS_DEVICE_$NAME to probe for existence of some
device and QEMU_CAPS_$NAME_$PROP to probe for existence of some property
of that device.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_capabilities: mark QEMU_CAPS_VGA_QXL capability as deprecated
Pavel Hrdina [Tue, 11 Oct 2016 15:46:39 +0000 (17:46 +0200)]
qemu_capabilities: mark QEMU_CAPS_VGA_QXL capability as deprecated

If QEMU in question supports QMP, this capability is set if
QEMU_CAPS_DEVICE_QXL was set based on existence of "-device qxl". If
libvirt needs to parse *help*, because there is no QMP support, it
checks for existence of "-vga qxl", but it also parses output of
"-device ?" and sets QEMU_CAPS_DEVICE_QXL too.

Now that libvirt supports only QEMU that has "-device" implemented it's
safe to drop this capability and stop using it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_capabilities: join capabilities for qxl and qxl-vga devices
Pavel Hrdina [Tue, 11 Oct 2016 15:42:37 +0000 (17:42 +0200)]
qemu_capabilities: join capabilities for qxl and qxl-vga devices

This patch simplifies QEMU capabilities for QXL video device.  QEMU
exposes this device as *qxl-vga* and *qxl* and they are both the same
device with the same set of parameters, the only difference is that
*qxl-vga* includes VGA compatibility.

Based on QEMU code they are tied together so it's safe to check only for
presence of only one of them.

This patch also removes an invalid test case "video-qxl-sec-nodevice"
where there is only *qxl-vga* device and *qxl* device is not present.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agotests: fix some QXL capability combinations that don't make sense
Pavel Hrdina [Wed, 21 Sep 2016 16:26:21 +0000 (18:26 +0200)]
tests: fix some QXL capability combinations that don't make sense

If one of QEMU_CAPS_DEVICE_QXL_VGA or QEMU_CAPS_DEVICE_QXL is set the
other one will always be set as well because both devices are tied
together in QEMU.

The change of args files is caused by the presence of capability
QEMU_CAPS_DEVICE_VIDEO_PRIMARY which means it's safe to use
"-device qxl-vga" instead of "-vga qxl", see commit (e3f2686b) and
by the fact that if QEMU_CAPS_VGA_QXL is set QEMU_CAPS_DEVICE_QXL_VGA
and QEMU_CAPS_DEVICE_QXL would be set too (since we support only qemu
with "-device" option).

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_command: remove xenner leftover from video device code
Pavel Hrdina [Tue, 11 Oct 2016 15:37:45 +0000 (17:37 +0200)]
qemu_command: remove xenner leftover from video device code

Qemu supports *xen* video device only with XEN and this code was part
of xenner code.  We dropped support for xenner in commit de9be0a.

Before this patch if you used 'xen' video type you ended up with
domain without any video device at all.  Now we don't allow to start
such domain.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: move qemuProcessStartValidateGraphics to correct place
Pavel Hrdina [Mon, 10 Oct 2016 17:55:17 +0000 (19:55 +0200)]
qemu_process: move qemuProcessStartValidateGraphics to correct place

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovirsh: vcpuinfo: Report proper vcpu numbers and data for offline VMs
Peter Krempa [Tue, 11 Oct 2016 16:03:50 +0000 (18:03 +0200)]
virsh: vcpuinfo: Report proper vcpu numbers and data for offline VMs

If the VM is offline virsh attempted to at least report the pinning
information for the VM. This would not work properly now that the vcpus
can be sparse. Fix it by getting the vcpu states from the XML.

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

8 years agovirsh: Extract fallback handling in cmdVcpuinfo
Peter Krempa [Thu, 29 Sep 2016 14:37:35 +0000 (16:37 +0200)]
virsh: Extract fallback handling in cmdVcpuinfo

Put it into a separate function so that more fallback handling can be
added without making a mess.

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.