Commit Graph

31325 Commits

Author SHA1 Message Date
Andrea Bolognani
2569ba1338 spec: Drop support for Fedora 27
In accordance with our platform support policy, now that
Fedora 29 is out we no longer support building on Fedora 27.

This allows us to remove a few version checks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-11-08 14:01:07 +01:00
Jiri Denemark
e47949357b qemu: Don't ignore resume events
Since commit v4.7.0-302-ge6d77a75c4 processing RESUME event is mandatory
for updating domain state. But the event handler explicitly ignored this
event in some cases. Thus the state would be wrong after a fake reboot
or when a domain was rebooted after it crashed.

BTW, the code to ignore RESUME event after SHUTDOWN didn't make sense
even before making RESUME event mandatory. Most likely it was there as a
result of careless copy&paste from qemuProcessHandleStop.

The corresponding debug message was clarified since the original state
does not have to be "paused" only and while we have a "resumed" event,
the state is called "running".

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2018-11-08 09:08:58 +01:00
John Ferlan
4608af30f9 tests: Use correct function name in error path
Commit id 5eb61e6846 neglected to change the name in the wrong value
output to virCgroupGetPercpuStats from virCgroupGetMemoryUsage.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-11-07 18:18:42 -05:00
Julio Faracco
879fde3272 lxc: Clang is complaining about possible NULL pointer.
The array "mount" inside lxc_container is not being checked before for
loop. Clang syntax scan is complaining about this segmentation fault.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-11-07 16:22:16 -05:00
John Ferlan
8f0f8425d7 qemu: Narrow the shutdown reconnection failure reason window
The current qemuProcessReconnect logic paints a broad brush
determining that the shutdown reason must be crashed if it was
determined that the domain was started with -no-shutdown; however,
there's many other ways to get to the error label, so let's narrow
our reasoning window for using VIR_DOMAIN_SHUTOFF_CRASHED to the
period where we essentially know we've tried to create to the
monitor and before we were successful in opening the connection.

Failures that occur outside that window would thus be considered
as VIR_DOMAIN_SHUTOFF_UNKNOWN, at least for now.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-07 07:41:47 -05:00
John Ferlan
296e05b54b qemu: Restore lost shutdown reason
When qemuProcessReconnectHelper was introduced (commit d38897a5d)
reconnection failure used VIR_DOMAIN_SHUTOFF_FAILED; however, that
was changed in commit bda2f17d to either VIR_DOMAIN_SHUTOFF_CRASHED
or VIR_DOMAIN_SHUTOFF_UNKNOWN.

When QEMU_CAPS_NO_SHUTDOWN checking was removed in commit fe35b1ad6
the conditional state was just left at VIR_DOMAIN_SHUTOFF_CRASHED.

So introduce qemuDomainIsUsingNoShutdown which will manage the
condition when the domain was started with -no-shutdown so that
when/if reconnection failure occurs we can restore the decision
point used to determine whether CRASHED or UNKNOWN is provided.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-07 07:41:41 -05:00
Jim Fehlig
8496c17c53 libxl: Properly dispose libxl_domain_config object
V2 of the libxl soft reset patch, which was pushed as commit da4b0fd9,
dropped the hunk that disposed of the libxl_domain_config object. Add
the missing hunk to properly dispose the object.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-11-06 15:21:19 -07:00
Jim Fehlig
da4b0fd9d3 libxl: add support for soft reset
The pvops Linux kernel implements machine_ops.crash_shutdown as

static void xen_hvm_crash_shutdown(struct pt_regs *regs)
{
        native_machine_crash_shutdown(regs);
        xen_reboot(SHUTDOWN_soft_reset);
}

but currently the libxl driver does not handle the soft reset
shutdown event. As a result, the guest domain never proceeds
past xen_reboot(), making it impossible for HVM domains to save
a crash dump using kexec.

This patch adds support for handling the soft reset event by
calling libxl_domain_soft_reset() and re-enabling domain death
events, which is similar to the xl tool handling of soft reset
shutdown event.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-06 09:10:27 -07:00
Jim Fehlig
82452a5d7f libxl: Remove some goto labels in libxlDomainShutdownThread
There are too many goto labels in libxlDomainShutdownThread. Convert the
'destroy' and 'restart' labels to helper functions, leaving only the
commonly used pattern of 'endjob' and 'cleanup' labels.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-06 09:08:14 -07:00
Jim Fehlig
14d03b27bf libxl: remove redundant calls to virObjectEventStateQueue
In libxlDomainShutdownThread, virObjectEventStateQueue is needlessly
called in the destroy and restart labels. The cleanup label aready
queues whatever event was created based on libxl_shutdown_reason.
There is no need to handle destroy and restart differently.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-06 09:06:45 -07:00
Ján Tomko
e08e792493 qemuBuildChrChardevStr: increase scope of qemuBuildChrChardevStr
Make it avaiable to other chardev types.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-11-06 15:03:18 +01:00
Ján Tomko
4b8faeb9fe qemuBuildChrChardevStr: split attribute formatting
Remove repetition of the 'socket' device and its alias.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-11-06 15:03:18 +01:00
Ján Tomko
7c94eebfe2 qemuProcessPrepareDomain: pass xmlopt when creating monConfig
Pass the driver's xmlopt to allocate the chardev source private
data correctly.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-11-06 14:22:24 +01:00
Ján Tomko
912b8a5970 check-spacing: do not kill C++-style comments
Our HACKING guide forbids these.
There's no point in exempting these from the spacing check
if their existence is against our coding style.

Note that the non-usage of these comments itself is not enforced
by syntax check, probably because of the need to implement a C parser.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-11-06 14:14:41 +01:00
Ján Tomko
90dba47a07 syntax-check: revert indentation checks
Recent patches added indentation checks that discovered some cosmetic
issues at the cost of making this check last as long as the rest of
syntax-check combined on my system. Also, they're moving closer
to us implementing yet another C parser (docs/apibuild.py being the
other one).

Revert the following commits:
commit 11e1f11dd3
    syntax-check: Check for incorrect indentation in function body
commit 2585a79e32
    build-aux:check-spacing: Introduce a new rule to check misaligned stuff in parenthesises
commit a033182f04
    build-aux:check-spacing: Add wrapper function of CheckCurlyBrackets
commit 6225626b6f
    build-aux:check-spacing: Add wrapper function of CheckWhiteSpaces
commit c3875129d9
    build-aux:check-spacing: Add wrapper function of KillComments
commit e995904c56
    build-aux:check-spacing: Add wrapper function of CheckFunctionBody
commit 11e1f11dd3
    syntax-check: Check for incorrect indentation in function body

This brings the speed of the script to a tolerable level and lets it
focus on the more visible issues.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-11-06 14:08:23 +01:00
John Ferlan
4f1107614d docs: Enhance polkit documentation to describe secondary connection
https://bugzilla.redhat.com/show_bug.cgi?id=1631606

Since commit 8259255 usage of a primary connection driver for
a virConnect has been modified to open (virConnectOpen) and use
a connection to the specific driver in order to handle the API
calls to/for that driver. This causes some confusion and issues
for ACL polkit rule scripts to know exactly which driver by
name will be used.

Add some documentation describing the processing of the primary
and secondary connection as well as the list of the connect_driver
names used for each driver.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-05 07:13:22 -05:00
John Ferlan
ccc72d5cbd access: Modify the VIR_ERR_ACCESS_DENIED to include driverName
https://bugzilla.redhat.com/show_bug.cgi?id=1631606

Changes made to manage and utilize a secondary connection
driver to APIs outside the scope of the primary connection
driver have resulted in some confusion processing polkit rules
since the simple "access denied" error message doesn't provide
enough of a clue when combined with the "authentication failed:
access denied by policy" as to which connection driver refused
or failed the ACL check.

In order to provide some context, let's modify the existing
"access denied" error returne from the various vir*EnsureACL
API's to provide the connection driver name that is causing
the failure. This should provide the context for writing the
polkit rules that would allow access via the driver.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-05 07:13:03 -05:00
Nikolay Shirokovskiy
67125e0d33 nwfilter: Instantiate active filter bindings during driver init
Commit 57f5621f modified nwfilterInstantiateFilter to detect when
a filter binding was already present before attempting to add the
new binding and instantiate it. Additionally, the change to
nwfilterStateInitialize to call virNWFilterBindingObjListLoadAllConfigs
(from commit c21679fa3f) to load active domain filter bindings, but
not instantiate them eventually leads to a problem for the QEMU
driver reconnection logic after a daemon restart where the filter
bindings would no longer be instantiated.

Subsequent commit f14c37ce4c replaced the nwfilterInstantiateFilter
with virDomainConfNWFilterInstantiate which uses @ignoreExists to
detect presence of the filter and still did not restore the filter
instantiation call when making the new nwfilter bindings logic active.

Thus in order to instantiate any active domain filter, we will call
virNWFilterBuildAll with 'false' to indicate the need to go through
all the active bindings calling virNWFilterInstantiateFilter to
instantiate the filter bindings.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-11-05 07:10:47 -05:00
John Ferlan
29183778af nodedev: Document the udevEventHandleThread
Commit cdbe1332 neglected to document the API. So let's add some
details about the algorithm and why it was used to help future
readers understand the issues encountered.

NB: Management of the processing udev device notification is a
delicate balance between the udev process, the scheduler, and when
exactly the data from/for the socket is received. The balance is
particularly important for environments when multiple devices are
added into the system more or less simultaneously such as is done
for mdev or SRIOV. In these cases old libudev blocking on the udev
recv() occurs more frequently. It's expected that future devices
will follow similar algorithms. Even though the algorithm does
present some challenges for older OS's (such as Centos 6), trying
to rewrite the algorithm to fit both models would be more complex
and involve pulling the monitor object out of the private data
lockable object and would need to be guarded by a separate lock.
Devising such an algorithm to work around issues with older OS's
at the expense of more modern OS algorithms in newer event processing
code may result in unexpected issues, so the choice is to encourage
use of newer OS's with newer udev event processing code.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-11-05 07:05:45 -05:00
Michal Privoznik
4de4e4bc99 qemu: Dissolve qemuBuildVhostuserCommandLine in qemuBuildInterfaceCommandLine
https://bugzilla.redhat.com/show_bug.cgi?id=1524230

The qemuBuildVhostuserCommandLine builds command line for
vhostuser type interfaces. It is duplicating some code of the
function it is called from (qemuBuildInterfaceCommandLine)
because of the way it's called. If we merge it into the caller
not only we save a few lines but we also enable checks that we
would have to duplicate otherwise (e.g. QoS availability).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-11-05 08:52:56 +01:00
Michal Privoznik
e7b7b61768 qemuBuildInterfaceCommandLine: Reorder VIR_FREE
When we have variables A, B, C then there are two ways to free
them. Either in the order they are declared or the reversed one.
Any other ordering is confusing. In this commit I'm reordering
calls to VIR_FREE in the reversed order.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-11-05 08:52:56 +01:00
Michal Privoznik
18f90481cd Post-release version bump to 4.10.0
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-11-05 08:52:17 +01:00
Daniel Veillard
7a10a6a598 Libvirt release 4.9.0
* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
2018-11-04 17:55:00 +01:00
Andrea Bolognani
48080527d6 news: Update for 4.9.0 release
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
2018-11-02 16:28:09 +01:00
Daniel P. Berrangé
5a128712bc rpc: fix handling of SSH auth failure code
The result of libssh2_userauth_password is being assigned to 'ret' in
one branch and 'rc' in the other branch. Checks are all done against the
'ret' variable, so one branch never does the correct check.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-10-30 16:31:52 +00:00
Boris Fiuczynski
a017bae1ae news: Update news for vfio-ap support
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Chris Venteicher <cventeic@redhat.com>
2018-10-29 12:45:54 -04:00
Boris Fiuczynski
1170864198 qemu: vfio-ap device support
Adjusting domain format documentation, adding device address
support and adding command line generation for vfio-ap.
Since only one mediated hostdev with model vfio-ap is supported a check
disallows to define domains with more than one such hostdev device.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Chris Venteicher <cventeic@redhat.com>
2018-10-29 12:45:54 -04:00
Boris Fiuczynski
dc788d2540 qemu: add vfio-ap capability
Introduce vfio-ap capability.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Chris Venteicher <cventeic@redhat.com>
2018-10-29 12:45:54 -04:00
Pavel Hrdina
58fcdbf263 docs: fix repology link for qemu-kvm package
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-10-23 16:16:36 +01:00
Martin Kletzander
1d3e2dff52 docs: Fix minimum supported version
We already have that in the code (commit c1bc9c662b), we just forgot to
mention that in the docs.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2018-10-23 10:45:07 +01:00
Martin Kletzander
62bac69542 util: Fix typo vcups -> vcpus
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2018-10-22 14:37:54 +01:00
Jie Wang
58cfd0a135 qemu: Fix IOThread pids lost after qemuProcessReconnect
IOThread pids info will lost after libvirtd restart, then
if we call pinIOThread, sched_setaffinity will be called with
pid 0, not IOThread pid. So pinIOThread cannot work normally.

Signed-off-by: Jie Wang <wangjie88.huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-10-19 14:01:58 -04:00
Eric Blake
ffac10c971 qemu: Avoid memleak on failure to format blockjobs
virXMLFormatElement() frees attrBuf on success, but not necessarily
on failure. Most other callers of this function take the time to
reset attrBuf afterwords, but qemuDomainObjPrivateXMLFormatBlockjobs()
was relying on it succeeding, and could thus result in a memory leak.

Signed-off-by: Eric Blake <eblake@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-10-19 10:33:19 -05:00
Michal Privoznik
c0790e3a09 virfile: Take symlink into account in virFileIsSharedFixFUSE
https://bugzilla.redhat.com/show_bug.cgi?id=1640465

Weirdly enough, there can be symlinks in the path we are trying
to fix. If it is the case our clever algorithm that finds matches
against mount table won't work. Canonicalize path at the
beginning then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-10-19 13:15:54 +02:00
Michal Privoznik
f4966b8522 virFileInData: Preserve errno on error
The virFileInData() function should return to the caller if the
current position the passed file is in is a data section or a
hole (and also how long the current section is). At any rate,
upon return from this function (be it successful or not) the
original position in the file is restored. This may mess up with
errno which might have been set earlier. Save the errno into a
local variable so it can be restored for the caller's sake.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2018-10-19 13:07:49 +02:00
Bjoern Walk
808e27a109 qemu: qemuProcessInit: Drop unused config variable
The QEMU @cfg config variable is unused in context of qemuProcessInit,
let's drop it.

Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-10-18 11:37:55 +02:00
Nikolay Shirokovskiy
49825dcf31 nwfilter: Fix learning address thread shutdown
If the learning thread is configured to learn on all ethernet frames
(which is hardcoded) then chances are high that there is a packet on
every iteration of inspecting frames loop. As result we will hang on
shutdown because we don't check threadsTerminate if there is packet.

Let's just check termination conditions on every iteration. Since
we'll check each iteration, the check after pcap_next essentially
is unnecessary since on failure we'd loop back to the top and timeout
and then fail.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-10-17 17:06:04 -04:00
Wang Huaqiang
b05eeacbfd util: Fix a typo in comments of virresctrl.c
Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-10-17 13:52:07 +02:00
Han Han
80c8237679 conf: Fix typos in pcie controllers' name
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-10-17 10:47:50 +02:00
Michal Privoznik
641a95c9b6 qemu: Put format=raw onto cmd line for SCSI passthrough
https://bugzilla.redhat.com/show_bug.cgi?id=1632833

When doing a SCSI passthrough we don't put format= onto the
command line. This causes qemu to probe the format automatically
which ends up in a warning in the domain log and possible qemu
disabling writes to the first block (according to the warning
message).

Based-on-work-of: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-10-17 09:16:20 +02:00
Wang Huaqiang
3a1cdb06fd conf: Fix bug in finding alloc through matching vcpus
The @alloc object returned by virDomainResctrlVcpuMatch is not
properly referenced and un-referenced in virDomainCachetuneDefParse.

This patch fixes this problem.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-10-15 11:03:23 -04:00
Ján Tomko
4c64768e8f tests: use real capabilities for net-vhostuser
Commit ed5aa85f37
    qemu: don't use chardev FD passing for vhostuser backend
altered the legacy DO_TEST macro.

Run the test against capabilities of QEMU 2.5.0 (which did not
support QEMU_CAPS_CHARDEV_FD_PASS) as well as the latest version.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
ccad7b5888 tests: add virtio-rng-egd-unix
Test RNG devices connected to EGD via UNIX sockets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
818e9a3b90 tests: add usb-redir-unix
Test USB redirdevs backed by UNIX sockets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
91750d8564 tests: add console-virtio-unix
Test a virtio console backed by a UNIX socket.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
8e0266d5bb tests: add channel-unix-guestfwd
Test guestfwd channels backed by UNIX sockets.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
9ed91bed4e tests: add parallel-unix-chardev
Test creating a parallel port backed by a UNIX socket.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Ján Tomko
a7a2b06702 tests: add smartcard-passthrough-unix
Test CCID smartcard passthrough from a unix listen socket.
Use the capabilities of QEMU 2.5.0 which did not support
chardev FD passing and the latest one, which (at the time
of this commit) it does.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-10-15 13:13:29 +02:00
Peter Krempa
6e7e965dcd util: storage: Properly parse URIs with missing trailing slash
The URI parser used by libvirt does not populate uri->path if the
trailing slash is missing. The code virStorageSourceParseBackingURI
would then not populate src->path.

As only NBD network disks are allowed to have the 'name' field in the
XML defining the disk source omitted we'd generate an invalid XML which
we'd not parse again.

Fix it by populating src->path with an empty string if the uri is
lacking slash.

As pointed out above NBD is special in this case since we actually allow
it being NULL. The URI path is used as export name. Since an empty
export does not make sense the new approach clears the src->path if the
trailing slash is present but nothing else.

Add test cases now to cover all the various cases for NBD and non-NBD
uris as there was to time only 1 test abusing the quirk witout slash for
NBD and all other URIs contained the slash or in case of NBD also the
export name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-10-12 16:41:48 +02:00
Peter Krempa
4471f7704c util: storage: Rename '@path' argument of virStorageSourceParseBackingURI
The name is misleading. Change it to 'uristr' so that 'path' can be
reused in the proper context later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2018-10-12 16:41:48 +02:00