Commit Graph

31865 Commits

Author SHA1 Message Date
Peter Krempa
9ed9124d0d qemu: process: refresh block jobs on reconnect
Block job state was widely untracked by libvirt across restarts which
was allowed by a stateless block job finishing handler which discarded
disk state and redetected it. This is undesirable since we'll need to
track more information for individual blockjobs due to -blockdev
integration requirements.

In case of legacy blockjobs we can recover whether the job is present at
reconnect time by querying qemu. Adding tracking whether a job is
present will allow simplification of the non-shared-storage cancellation
code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
5918df1e62 qemu: migration: Properly note that non-shared-storage migration uses a blockjob
Internally we do a 'block-copy' to accomodate non-shared storage
migration but the code did not fill in that the block job was active on
the disk when starting the copy job. Since we handle block jobs finishes
regardless of having it registered it's not a problem but soon will
become one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
232ab2f200 qemu: blockjob: Split out handling of completed jobs
qemuBlockJobEventProcessLegacy was getting too big. Remove handling of
completed jobs in a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
246303dc5b qemu: blockjob: Rename qemuBlockJobEventProcess to qemuBlockJobEventProcessLegacy
This will handle blockjob finalizing for the old approach so rename it
accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
2a1248badd qemu: process: Consolidate error paths in qemuProcessHandleBlockJob
'cleanup' label was accessed only from a jump to 'error'. Consolidate
everyting into 'cleanup'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
89a877b312 qemu: Consolidate disk blockjob variables into a structure
Struct qemuDomainDiskPrivate was holding multiple variables connected to
a disk block job. Consolidate them into a new struct qemuBlockJobData.

This will also allow simpler extensions to the block job mechanisms.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
f5eadd1d92 qemu: blockjob: Remove header dependency on qemu_domain.h
The blockjob module uses 'qemuDomainAsyncJob' in it's public headers.
As I plan adding a new structure containing job data which will need to
be included in "qemu_domain.h" it's necessary to break the circular
dependency.

Convert 'qemuDomainAsyncJob' type to 'int' as it's an enum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
f2bc59e48e qemu: blockjob: Rename public APIs
All the public APIs of the qemu_blockjob module operate on a 'disk'.
Since I'll be adding APIs which operate on a job later let's rename the
existing ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
359dc694f7 qemu: blockjob: Unexport qemuBlockJobEventProcess
The function is now only called locally. Some code movement was
necessary to avoid forward declarations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
c3ec4b8d6a qemu: processBlockJobEvent: Use qemuBlockJobUpdate to process block job events
Replace use of qemuBlockJobEventProcess with the general helper. A small
tweak is required to pass in the 'type' and 'status' of the job via the
appropriate private data variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
b618a45b0f qemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local disks
The event reports the disk path to identify the disk which makes sense
only for local disks. Additionally network backed disks like NBD don't
need to have a path so the callback would return NULL.

Report VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for non-empty local disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Peter Krempa
56557b4898 qemu: blockjob: Extract emitting of libvirt events
Put the emitting of VIR_DOMAIN_EVENT_ID_BLOCK_JOB and
VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 into a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-17 17:12:50 +01:00
Ján Tomko
926cb125a4 qemu: fill out usage-specific TLS settings after parsing
Instead of copying the default default values upfront
and then wondering whether the user has given us a new default,
leave the per-usage TLS certdirs and secrets empty during
parsing and only fill them afterwards if they weren't provided
by the user.

This means that instead of looking whether the specific certdir
paths match the default default, the Validate function (which
is called in between parsing and setting the defaults) can error
out for missing directories if the value is present, because
it must've come from the user.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-17 15:53:20 +01:00
Ján Tomko
5ce02870c4 qemu.conf: fill out TLS verify attributes after parsing
Introduce a set of bool variables with the 'present' suffix
to track whether the value was actually specified.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-17 15:53:20 +01:00
Ján Tomko
10ee1270ff qemu: group swtpm entry in augeas file
They are meant to be together.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-17 15:53:20 +01:00
Ján Tomko
361f772f6f qemu: fix double space in augeas file
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-17 15:53:20 +01:00
Andrea Bolognani
1b3ea6daaf src: Don't use double-colon rules
According to the GNU Make manual, "double-colon rules are
somewhat obscure and not often very useful". Looking at
the few instances we have in libvirt, that certainly seems
to be the case, so just drop them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-16 10:19:48 +01:00
Ján Tomko
900aae2c77 qemu: remove comments for qemuDomainSecret.*Destroy functions
These all contain the same copy and pasted '@disk' error,
and only repeat the list of arguments.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-01-16 08:34:01 +01:00
Ján Tomko
ca13c64868 maint: Post-release version bump to 5.1.0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-01-16 08:28:49 +01:00
Daniel Veillard
1fb8766421 Release of libvirt-5.0.0
* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
2019-01-15 20:29:40 +01:00
Ján Tomko
0ca65b7b61 virnetdevip: Avoid cast align warning
Commit 7282f455a got rid of the VIR_WARNINGS_NO_CAST_ALIGN macro
when refactoring the code and broke the build with clang.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-01-15 13:00:52 +01:00
Andrea Bolognani
7ea55e04c3 news: Update for 5.0.0 release
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-01-15 10:27:32 +01:00
Michal Privoznik
fc3990c7e6 qemu: Temporary disable owner remembering
Turns out, that there are few bugs that are not that trivial to
fix (e.g. around block jobs). Instead of rushing in not
thoroughly tested fixes disable the feature temporarily for the
release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-01-15 09:45:22 +01:00
Daniel P. Berrangé
1851233d31 po: refresh translations from zanata
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-14 18:10:21 +00:00
Laine Stump
85f223a8f2 util: make forgotten changes suggested during review of commit d40b820c
I had intended to make these changes to commit d40b820c before
pushing, but forgot about it during the day between the initial review
and ACK.

Neither change is significant - just returning immediately when
virNetDevGetName() fails (instead of logging a debug message first)
and eliminating a comment that adds to confusion rather than
eliminating it. Still, the changes should be made to be more
consistent with nearly identical code just a few lines up (added in
commit 7282f455)

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-14 09:43:55 -05:00
Andrea Bolognani
0f17023ac7 news: Move entry for libvirt picking DRI devices
The entry, introduced by commit 3934beb857, ended up
inside a comment instead of the XML document proper, and
as such didn't show up in the generated files.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-01-14 14:32:53 +01:00
Laine Stump
d40b820c5d util: check accept_ra for all nexthop interfaces of multipath routes
When checking the setting of accept_ra, we have assumed that all
routes have a single nexthop, so the interface of the route would be
in the RTA_OIF attribute of the netlink RTM_NEWROUTE message. But
multipath routes don't have an RTA_OIF; instead, they have an
RTA_MULTIPATH attribute, which is an array of rtnexthop, with each
rtnexthop having an interface. This patch adds a loop to look at the
setting of accept_ra of the interface for every rtnexthop in the
array.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-11 12:06:39 -05:00
John Ferlan
f30ac207ad qemu: Filter non SCSI hostdevs in qemuHostdevPrepareSCSIDevices
When commit 1d94b3e7 added code to walk the [n]hostdevs list looking
to add shared hostdevs, it should've filtered any hostdevs that were
not SCSI hostdev's.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-11 08:52:10 -05:00
Laine Stump
7282f455aa util: use nlmsg_find_attr() instead of an open-coded loop
This is about the same number of code lines, but is simpler, and more
consistent with what will be added to check another attribute in a
coming patch.

As a side effect, it

Resolves: https://bugzilla.redhat.com/1583131

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 12:37:09 -05:00
Laine Stump
37bb6facfc util: add a function to insert new interfaces to IPv6CheckForwarding list
This same operation needs to be done in multiple places, so move the
inline code into a separate function.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 12:36:40 -05:00
Laine Stump
0ea259b6bf util: remove const specifier from nlmsghdr arg to virNetlinkDumpCallback()
This is problematic if a callback function wants to send the nlmsghdr
to a library function that has no "const" in its prototype
(e.g. nlmsg_find_attr())

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 12:35:43 -05:00
Andrea Bolognani
6ee53e54dc apparmor: Move static data out of examples/
These files need to be installed on the system for apparmor
support to work, so they don't belong with examples.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 16:48:12 +01:00
Andrea Bolognani
50d5cb0df3 src: Simplify installing/uninstalling data
Instead of defining targets conditionally and depending on
them unconditionally, define a couple of variables and
conditionally add targets to them.

In addition to removing a bunch of useless code, this has
the nice effect of no longer requiring the main Makefile.am
to have any knowledge about the contents of the various
snippets it includes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 16:48:12 +01:00
Andrea Bolognani
ab575b7b77 src: Only install SysV init scripts when libvirtd is built
This is consistent with the way we already handle
configuration for other init systems such as upstart and
systemd.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 16:48:12 +01:00
Andrea Bolognani
a520981740 src: Define initdir
Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 16:48:12 +01:00
Jiri Denemark
511df17aec cpu_map: Add support for arch-capabilities feature
The feature was added to QEMU in 3.1.0 and it is currently blocking
migration, which is expected to change in the future. Luckily 3.1.0 is
new enough to give us migratability hints on each feature via
query-cpu-model-expension, which means we don't need to use the
"migratable" attribute on the CPU map XML.

The kernel calls this feature arch_capabilities and RHEL/CentOS 7.* use
arch-facilities. Apparently some CPU test files were gathered with the
RHEL version of QEMU. Let's update the test files to avoid possible
confusion about the correct naming.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-10 16:39:57 +01:00
Michal Privoznik
2ebcff3a74 qemu: Don't enable seclabel remembering for session mode
The session daemon is unable to set XATTRs in 'trusted'
namespace because it doesn't run as privileged process.
Therefore, when creating the default qemu config enable
rememberOwner only when running as privileged process.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-10 16:15:42 +01:00
Andrea Bolognani
7fb5e319d9 remote: Define sasldir
Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 13:40:41 +01:00
Andrea Bolognani
72e5285aa3 remote: Define sysctldir
Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 13:40:41 +01:00
Andrea Bolognani
2745f0e08e remote: Define polkit{actions,rules}dir
Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 13:40:41 +01:00
Andrea Bolognani
7f65248ce5 remote: Move polkitdir definition
No need to have two conditional blocks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-10 13:25:38 +01:00
Ján Tomko
7cfd1fbb13 qemu: require reply from guest agent in qemuAgentGetInterfaces
Since its introduction in commit 0977b8aa07 (released in v1.2.14)
qemuAgentGetInterfaces calls qemuAgentCommand with needReply=false,
which allows qemuAgentCommand to return 0 even when it did not get
any reply from the agent.

Set needReply to true, since we dereference it right after.

This can be hit if libvirt is waiting for an event from the agent
(e.g. shutdown) and the agent cannot reply in time (e.g. due to
the guest being shut down), as reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=1663051

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-01-10 12:09:48 +01:00
Michal Privoznik
c39a0993dc src/qemu: Fix indentation in Makefile.inc.am
Three lines are a bit off there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-01-09 17:56:09 +01:00
Daniel P. Berrangé
c10a6d50a4 lxc: allow empty path in URI for historical compatibility
The use of 'lxc://' was mistakenly broken in:

  commit 4c8574c85c
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Mar 28 12:49:29 2018 +0100

    driver: ensure NULL URI isn't passed to drivers with whitelisted URIs

Allow it again for historical compatibility.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-01-09 14:10:00 +00:00
Michal Privoznik
f886271410 qemu: Use ULL instead of uint64_t for RDMA GID event
In the previous commit we are using uint64_t for storing subnet
prefix and interface id that qemu reports in
RDMA_GID_STATUS_CHANGED event. We also report them in some debug
messages. This poses a problem because uint64_t can be UL or ULL
depending on the host architecture and hence we wouldn't know
which format to use. Switch to ULL which is big enough and
doesn't suffer from the issue.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-01-09 11:31:58 +01:00
Yuval Shaia
ed357cef18 qemu: Process RDMA GID state change event
This event is emitted on the monitor when a GID table in pvrdma device
is modified and the change needs to be propagate to the backend RDMA
device's GID table.

The control over the RDMA device's GID table is done by updating the
device's Ethernet function addresses.
Usually the first GID entry is determine by the MAC address, the second
by the first IPv6 address and the third by the IPv4 address. Other
entries can be added by adding more IP addresses. The opposite is the
same, i.e. whenever an address is removed, the corresponding GID entry
is removed.

The process is done by the network and RDMA stacks. Whenever an address
is added the ib_core driver is notified and calls the device driver's
add_gid function which in turn update the device.

To support this in pvrdma device we need to hook into the create_bind
and destroy_bind HW commands triggered by pvrdma driver in guest.
Whenever a changed is made to the pvrdma device's GID table a special
QMP messages is sent to be processed by libvirt to update the address of
the backend Ethernet device.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-01-09 10:26:29 +01:00
Eric Blake
45b439c3af examples: Work around lack of mingw localtime_r()
mingw lacks localtime_r(); we were getting it from gnulib. But since
commit acf522e8 stopped linking examples against gnulib, we are
getting a build failure. Keep the examples standalone, and work
around mingw by using the non-reentrant localtime() (safe since our
examples are single-threaded), and add a necessary exemption to our
syntax check.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-08 14:47:21 -06:00
Eric Blake
414afc8dbe examples: Work around lack of mingw sigaction()
mingw lacks sigaction(); we were getting it from gnulib. But since
commit acf522e8 stopped linking examples against gnulib, we are
getting a build failure. Keep the examples standalone, and work
around mingw by using signal() instead.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-08 14:47:04 -06:00
Eric Blake
358b6b593e examples: Work around mingw printf() weakness
mingw lacks %lld and %zu support in printf(); we were getting it
from gnulib. But since commit acf522e8 stopped linking examples
against gnulib, we are getting a build failure due to -Wformat
flagging these strings. Keep the examples standalone, and work
around mingw by using manual casts to types we can portably print.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2019-01-08 14:46:35 -06:00
Andrea Bolognani
4abd8d01cd syntax-check: Simplify and fix unmarked_diagnostics
The check was concerning itself with whitespace where it
didn't need to, and used some confusing escaping for one
of its regular expressions - which GNU sed was fine with,
but FreeBSD's sed didn't like one bit.

Switch to extended regular expressions (which, incidentally,
were already in use in the same rule when calling grep) and
remove all whitespace handling.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-01-08 17:19:06 +01:00