Commit Graph

34901 Commits

Author SHA1 Message Date
Pavel Mores
5be0d28b3e fixed handling of sourceless disks in 'domblkinfo' cmd
virDomainGetBlockInfo() returns error if called on a disk with no
source (a sourceless disk might be a removable media drive with no
media in it, for instance an empty CDROM or floppy drive).

So far this caused the virsh domblkinfo --all command to abort and
ignore any remaining (not yet displayed) disk devices.  This patch
fixes the problem by first checking for existence of a <source>
element in the corresponding XML.  If none is found, we avoid calling
virDomainGetBlockInfo() altogether as we know it's bound to fail in
that case.

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

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-10-07 14:13:06 +02:00
Peter Krempa
2de75faa28 tests: qemuxml2argv: Make use of versioned cpu-tsc-frequency and cpu-host-model-cmt tests
Commit fb973cfbb4 added versioned test outputs for the above mentioned
tests but didn't actually enable them. Fix that mistake and fix the
output of the tsc-frequency test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-07 13:46:38 +02:00
Peter Krempa
b86946c269 tests: qemuxml2argv: Remove unused output of 'mlock-on' legacy test
The test data was modernized to use actual caps but commit 4dadcaa98e
forgot to delete this test data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-07 13:46:38 +02:00
Peter Krempa
df24cba98f tests: qemuxml2argv: Remove unused data for s390 keywrap
The last use was removed in 7b604379ba when we deleted the old
commandline parser.

The argv generator tests are provided by:
machine-aeskeywrap-on-caps
machine-aeskeywrap-on-cap
machine-aeskeywrap-off-caps
machine-aeskeywrap-off-cap
machine-deakeywrap-on-caps
machine-deakeywrap-on-cap
machine-deakeywrap-off-caps
machine-deakeywrap-off-cap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-07 13:46:38 +02:00
Peter Krempa
1c58616b02 tests: qemuxml2argv: Remove unused data for 'pseries-disk'
The last use was removed in 7b604379ba when we deleted the old
commandline parser. The same functionality is tested by many tests for
pseries guests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-07 13:46:38 +02:00
Peter Krempa
c42a779df8 tests: qemuxml2argv: Remove unused data for 'serial-pty'
The last use was removed in 7b604379ba when we deleted the old
commandline parser. The same functionality is tested by
'serial-pty-chardev'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-07 13:46:37 +02:00
Daniel P. Berrangé
5c3575206e build: drop the pthread gnulib module
This was fixing a problem with old versions of mingw which had a
pthread.h that polluted the namespace with random symbols. This is no
longer relevant on our mingw platform targets.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
dcc0e54b25 build: drop the perror gnulib module
This fixes a problem on mingw where it doesn't know how to report
certain errnos defined by POSIX, but not used on Windows. These are
not a real problem for libvirt.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
019fc5c85b build: drop the gitlog-to-changelog gnulib module
The use of this script was discontinued when we stopped providing a full
ChangeLog in the dist with:

  commit ce97c33a79
  Author: Andrea Bolognani <abologna@redhat.com>
  Date:   Mon Apr 1 17:33:03 2019 +0200

    maint: Stop generating ChangeLog from git

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
93e22664bd build: drop the stdarg gnulib module
gnulib fixes a portability problem on AIX which is a platform we have
never targetted.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
80830cb34d Revert "build: use autobuild module to make build logs nicer"
This reverts commit 83aca30f1e.

While the motivation of the original commit is fine, we are intending to
drop autoconf in favour of meson, and similarly wish to drop use of
gnulib. Removing this feature is part of that conversion work.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
cc7cc5b092 util: drop the stpcpy gnulib module
stpcpy returns a pointer to the end of the string just copied
which in theory makes it easier to then copy another string
after it. We only use stpcpy in one place though and that
is trivially rewritten to avoid stpcpy with no loss in code
clarity or efficiency.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
a45fa8000a build: drop the mktempd gnulib module
The mktempd module in gnulib provides an equivalent to 'mktemp -d' on
platforms which lack this shell command. All platforms on which libvirt
runs the affected tests have 'mktemp -d' support, so the gnulib module
is not required.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
a88cfcf64f build: drop the inet_pton gnulib module
All use of this function was purged a long time ago in favour
of getaddrinfo

  commit a8ae7d19f4
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Oct 21 11:13:05 2010 +0100

    Remove all use of inet_pton and inet_ntop

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
de3c1d2f53 build: drop the getopt-posix gnulib module
The getopt-posix module fixes a problem with optind being incorrectly
set after a failed option parse. It was also previously used to allow
the bhyve driver to access a private internal reentrant getopt impl.
None of this matters to libvirt code any more.

This partially reverts

  commit b436a8ae5c
  Author: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
  Date:   Thu Jun 9 00:50:35 2016 +0000

    gnulib: add getopt module

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
6894ba88b8 bhyve: stop using private gnulib _getopt_internal_r func
The _getopt_internal_r func is not intended for public use, it is an
internal function shared between the gnulib getopt and argp modules.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Fabiano Fidêncio
371cff5789 qemu: capabilities: Fill in bochs-display info
086c19d69 added bochs-display capability but didn't fill in the info for
domain capabilities.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-07 11:40:48 +02:00
Collin Walling
47a1edaa46 qemu_driver: hook up query-cpu-model-comparison
This command is hooked into the virsh hypervisor-cpu-compare command.
As such, the CPU model XML provided to the command will be compared
to the hypervisor CPU contained in the QEMU capabilities file for the
appropriate QEMU binary (for s390x, this CPU definition can be observed
via virsh domcapabilities).

QMP will report that the XML CPU is either identical to, a subset of,
or incompatible with the hypervisor CPU. s390 can also report that
the XML CPU is a "superset" of the hypervisor CPU. This response is
presented as incompatible, as this CPU model would not be able to run
on the hypervisor.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Message-Id: <1568924706-2311-15-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:10:17 +02:00
Collin Walling
d11c4ddbfb cpu_conf: xml to cpu definition parse helper
Implement an XML to virCPUDefPtr helper that handles the ctxt
prerequisite for virCPUDefParseXML.

This does not alter any functionality.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Message-Id: <1568924706-2311-14-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:10:17 +02:00
Collin Walling
adb689bc2a qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON
This capability enables comparison of CPU models via QMP.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Message-Id: <1568924706-2311-13-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:10:17 +02:00
Collin Walling
8b28fd74a0 qemu_monitor: implement query-cpu-model-comparison
Interfaces with QEMU to compare CPU models. The command takes two CPU
models, A and B, that are given a model name and an optional list of
CPU features. Through the query-cpu-model-comparison command issued
via QMP, a result is produced that contains the comparison evaluation
string (identical, superset, subset, incompatible).

The list of properties (aka CPU features) that is returned from the QMP
response is ignored.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Message-Id: <1568924706-2311-12-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:10:17 +02:00
Collin Walling
aa797c6625 qemu_driver: expand cpu features after baseline
Perform a full CPU model expansion on the result of the baselined
model name when the features flag is present.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-11-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:10:17 +02:00
Collin Walling
09d23faac1 qemu_driver: hook up query-cpu-model-baseline
This command is hooked into the virsh hypervisor-cpu-baseline command.
The CPU models provided in the XML sent to the command will be baselined
via the query-cpu-model-baseline QMP command. The resulting CPU model
will be reported.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Message-Id: <1568924706-2311-10-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:10:11 +02:00
Collin Walling
db8bd39f6b qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_BASELINE
This capability enables baselining of CPU models via QMP.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Message-Id: <1568924706-2311-9-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
b0b582263d qemu_monitor: implement query-cpu-model-baseline
Interfaces with QEMU to baseline CPU models. The command takes two
CPU models, A and B, that are given a model name and an optional list
of CPU features. Through the query-cpu-model-baseline command issued
via QMP, a result is produced that contains a new baselined CPU model
that is guaranteed to run on both A and B.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Message-Id: <1568924706-2311-8-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
a9e723c885 qemu_monitor: make qemuMonitorJSONParseCPUModelData command-agnostic
Modify the error messages in qemuMonitorJSONParseCPUModelData to print
the command name provided to the function.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-7-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
afd222684e qemu_monitor: allow cpu props to be optional
Some older s390 CPU models (e.g. z900) will not report props as a
response from query-cpu-model-expansion. As such, we should make the
props field optional when parsing the return data from the QMP response.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-6-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
708f48525a qemu_monitor: add features to CPU model for QMP command
query-cpu-model-baseline/comparison will accept a list of features
as part of the command. Since CPUs may be defined with CPU feature
policies, let's parse it to the appropriate boolean that the QMP
command expects.

A feature that is set to required, force, or if it is a hypervisor
CPU feature (-1), then set the property value to true. Otherwise
(optional, disabled) set the value to false.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-5-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
67a4dcc151 qemu_monitor: use cpu def instead of char for expansion
When expanding a CPU model via query-cpu-model-expansion, any features
that were a part of the original model are discarded. For exmaple,
when expanding modelA with features f1, f2, a full expansion may reveal
feature f3, but the expanded model will not include f1 or f2.

Let's pass a virCPUDefPtr to the expansion function in preparation for
taking features into consideration.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-4-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
0a0be9b34d qemu_monitor: expansion cleanups
With refactoring most of the expansion function, let's take care of
some additional cleanups.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-3-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Collin Walling
3bfa3f11e6 qemu_monitor: refactor cpu model expansion
Refactor some code in qemuMonitorJSONGetCPUModelExpansion to be later
used for the comparison and baseline functions.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <1568924706-2311-2-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-10-07 10:09:49 +02:00
Peter Krempa
ba17721db1 maint: Post-release version bump to 5.9.0
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2019-10-07 08:00:47 +02:00
Daniel Veillard
d20983ff63 Release of libvirt-5.8.0
* docs/news.xml: updated for the release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
2019-10-05 09:45:29 +02:00
Pavel Mores
2346b2f656 remove a now redundant call to virDiskNameToIndex()
Parseability of disk name is now checked in qemuDomainDeviceDefValidateDisk().

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-02 13:59:01 +02:00
Pavel Mores
ca437d0603 qemu: Refuse partitions in disk targets
The way in which the qemu driver generates aliases for disks involves
ignoring the partition number part of a target dev name.  This means that
all partitions of a block device and the device itself all end up with the
same alias.  If multiple such disks are specified in XML, the resulting
name clash makes qemu invocation fail.

Since attaching partitions to qemu VMs doesn't seem to make much sense
anyway, disallow partitions in target specifications altogether.

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

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-02 13:54:06 +02:00
Daniel P. Berrangé
509a1d9da4 remote: don't pull anonymous enums into rpc protocol structs
The VIR_TYPED_PARAM_* enum fields are defined in libvirt-common.h, not
in the remote protcol, so shouldn't be part of the protocol structs
output check. This avoids similar problems hitting when we add use of
glib, which has other such anonymous enums.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-01 14:27:15 +01:00
Daniel P. Berrangé
557ac8cbf5 docs: attempt to document the general libvirt dev strategy
There are various ideas / plans floating around for future libvirt work,
some of which is actively in progress. Historically we've never captured
this kind of information anywhere, except in mailing list discussions.
In particular guidelines in hacking.html.in don't appear until a policy
is actively applied.

This patch attempts to fill the documentation gap, by creating a new
"strategy" page which outlines the general vision for some notable
future changes. The key thing to note is that none of the stuff on this
page is guaranteed, plans may change as new information arises. IOW this
is a "best guess" as to the desired future.

This doc has focused on three areas, related to the topic of language
usage / consolidation

 - Use of non-C languages for the library, daemons or helper tools
 - Replacement of autotools with meson
 - Use of RST and Sphinx for documentation (website + man pages)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-01 13:08:01 +01:00
Daniel P. Berrangé
76d31244c5 rpc: fix escaping of shell path for netcat binary
Consider having a nc binary in the path with a space in its name,
for example '/tmp/fo o/nc'

This results in libvirt running SSH with the following arg value

  "'if ''/tmp/fo o/nc'' -q 2>&1 | grep \"requires
    an argument\" >/dev/null 2>&1; then ARG=-q0;
    else ARG=;fi;''/tmp/fo o/nc'' $ARG -U
    /var/run/libvirt/libvirt-sock'"

The use of the single quote escaping was introduced by

  commit 6ac6238de3
  Author: Guido Günther <agx@sigxcpu.org>
  Date:   Thu Oct 13 21:49:01 2011 +0200

    Use virBufferEscapeShell in virNetSocketNewConnectSSH

    to escape the netcat command since it's passed to the shell. Adjust
    expected test case output accordingly.

While the intention of this change was good, the result is broken as it
is still underquoted.

On the SSH server side, SSH itself runs the command via the shell.
Our command is then invoking the shell again. Thus we see

$ virsh -c qemu+ssh://root@domokun/system?netcat=%2Ftmp%2Ffo%20o%2Fnc list
error: failed to connect to the hypervisor
error: End of file while reading data: sh: /tmp/fo: No such file or directory: Input/output error

With the second level of escaping added we can now successfully use a nc
binary with a space in the path.

The original test case added was misleading as it illustrated using a
binary path of 'nc -4' which is not a path, it is a command with a
separate argument, which is getting interpreted as a path.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-01 12:57:07 +01:00
Daniel P. Berrangé
c76dc0ea39 admin: fix memory leak of typed parameters getting client info
In the error code path, the temporary parameters are not freed.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-01 12:55:59 +01:00
Michal Privoznik
2f163204ff qemu_capabilities: Put only unique FW images into domcaps
In the domain capabilities XML there are FW image paths printed.
There are two sources for the image paths (in order of
preference):

  1) firmware descriptor files - as returned by
  qemuFirmwareGetSupported()

  2) a compile time list of FW:NRAM pairs which can be overridden
  in qemu.conf

If either of those contains a duplicate FW image path (which is
a valid use case) it is printed twice in the capabilities XML.
While it's technically not a bug, it doesn't look good.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-10-01 09:19:23 +02:00
Peter Krempa
808fa349f3 qemu: checkpoint: Don't update current checkpoint until we are done
Similarly to the snapshot code there's no reason to modify current
checkpoint until we are done creating the new one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-01 07:08:15 +02:00
Peter Krempa
391728befd qemu: snapshot: Don't update current snapshot until we're done
Since commit f105627992 we store whether a snapshot is current globally
rather than locally in the snapshot object.

This means that we don't have to unset the current snapshot prior to
taking/reverting the snapshot and we can do it only when everything is
done successfully.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-10-01 07:08:15 +02:00
Luyao Zhong
cd62dbc03b clarify the xml example for NVDIMM more clealy
The NVDIMM backend file can be a normal file or a real device file,
Current xml example and explainations may mislead users. So add more
info about the NVDIMM related elements and update the xml examples.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-09-30 16:28:18 +02:00
Chris Coulson
d660dd95ea security: AppArmor profile fixes for swtpm
The AppArmor profile generated by virt-aa-helper is too strict for swtpm.
This change contains 2 small fixes:
- Relax append access to swtpm's log file to permit write access instead.
Append access is insufficient because the log is opened with O_CREAT.
- Permit swtpm to acquire a lock on its lock file.

Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-09-30 15:15:11 +02:00
Daniel P. Berrangé
6ffb8fff9e qemu: sanity check vhost user FD before passing to QEMU
Ensure that the FD we're passing to QEMU is actually open, so we get a
sane error message upfront instead of telling QEMU to use a closed FD.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-09-30 13:08:43 +01:00
Daniel P. Berrangé
227925a2e5 qemu: ensure vhostuser FD is initialized to -1
The video private data was not initializing the vhostuser FD
causing us to attempt to close FD 0 many times over.

Fixes

  commit ca60ecfa8c
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Mon Sep 23 14:44:36 2019 +0400

      qemu: add qemuDomainVideoPrivate

Since the test suite does not invoke qemuExtDevicesStart(), no
vhost_user_fd will be present when generating test XML. To deal
with this we can must a fake FD number. While the current XML
is using FD == 0, we pick a very interesting number that's unlikely
to be a real FD, so that we're more likely to see any mistakes
closing the invalid FD.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-09-30 13:08:43 +01:00
Peter Krempa
7a46bd5202 qemu: monitor: unexport qemuMonitorJSONTransactionAdd
Now it's not used outside of qemu_monitor_json.c.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-09-30 13:12:56 +02:00
Peter Krempa
161478f4c4 qemu: checkpoint: Replace open-coded transaction action generators
Use the generators provided by the monitor code instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-09-30 13:12:56 +02:00
Peter Krempa
043c09b4f8 qemu: block: Replace snapshot transaction action generator
Use the new generator residing in the monitor code rather than directly
using qemuMonitorJSONTransactionAdd.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-09-30 13:12:56 +02:00
Peter Krempa
bacbd0f2ee tests: qemumonitor: Add testing for the 'transaction' command and generators
Validate all the commands against the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2019-09-30 13:12:56 +02:00