]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
4 years agoutil: remove OOM error log from virGetHostnameImpl()
Laine Stump [Fri, 19 Jun 2020 02:33:28 +0000 (22:33 -0400)]
util: remove OOM error log from virGetHostnameImpl()

The strings allocated in virGetHostnameImpl() are all allocated via
g_strdup(), which will exit on OOM anyway, so the call to
virReportOOMError() is redundant, and removing it allows slight
modification to the code, in particular the cleanup label can be
eliminated.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: eliminate useless error label in virDomainFeaturesDefParse()
Laine Stump [Fri, 19 Jun 2020 03:00:47 +0000 (23:00 -0400)]
conf: eliminate useless error label in virDomainFeaturesDefParse()

The error: label in this function just does "return -1", so replace
all the "goto error" in the function with "return -1".

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: use proper arg type when calling virNetDevSetOnline()
Laine Stump [Wed, 24 Jun 2020 17:12:56 +0000 (13:12 -0400)]
network: use proper arg type when calling virNetDevSetOnline()

The 2nd arg to this function is a bool, not an int.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: make networkDnsmasqXmlNsDef private to bridge_driver.c
Laine Stump [Wed, 24 Jun 2020 02:52:58 +0000 (22:52 -0400)]
network: make networkDnsmasqXmlNsDef private to bridge_driver.c

This struct isn't used anywhere else.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: fix memory leak in networkBuildDhcpDaemonCommandLine()
Laine Stump [Fri, 19 Jun 2020 21:40:17 +0000 (17:40 -0400)]
network: fix memory leak in networkBuildDhcpDaemonCommandLine()

hostsfilestr was not being freed. This will be turned into g_autofree
in an upcoming patch converting a lot more of the same file to using
g_auto*, but I wanted to make a separate patch for this first so the
other patch is simpler to review (and to make backporting easier).

The leak was introduced in commit 97a0aa246799c97d0a9ca9ecd6b4fd932ae4756c

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agouse g_autoptr for all xmlBuffers
Laine Stump [Thu, 18 Jun 2020 23:16:33 +0000 (19:16 -0400)]
use g_autoptr for all xmlBuffers

AUTOPTR_CLEANUP_FUNC is set to xmlBufferFree() in util/virxml.h (This
is actually new - added accidentally (but fortunately harmlessly!) in
commit 257aba2dafe. I had added it along with the hunks in this patch,
then decided to remove it and submit separately, but missed taking out
the hunk in virxml.h)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf, vmx: check for OOM after calling xmlBufferCreate()
Laine Stump [Thu, 18 Jun 2020 16:49:09 +0000 (12:49 -0400)]
conf, vmx: check for OOM after calling xmlBufferCreate()

Although libvirt itself uses g_malloc0() and friends, which exit when
there isn't enouogh memory, libxml2 uses standard malloc(), which just
returns NULL on OOM - this means we must check for NULL on return from
any libxml2 functions that allocate memory.

xmlBufferCreate(), for example, might return NULL, and we don't always
check for it. This patch adds checks where it isn't already done.

(NB: Although libxml2 has a provision for changing behavior on OOM (by
calling xmlMemSetup() to change what functions are used to
allocating/freeing memory), we can't use that, since parts of libvirt
code end up in libvirt.so, which is linked and called directly by
applications that may themselves use libxml2 (and may have already set
their own alternate malloc()), e.g. drivers like esx which live totally
in the library rather than a separate process.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonews.html: Add 3 new features
Yanqiu Zhang [Thu, 2 Jul 2020 09:06:46 +0000 (09:06 +0000)]
news.html: Add 3 new features

Add 'virtio packed' in 6.3.0, 'virDomainGetHostnameFlags' and
'Panic Crashloaded event' for 6.1.0.

Signed-off-by: Yanqiu Zhang <yanqzhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agovirConnectGetAllDomainStats: Document two vcpu stats
Michal Privoznik [Mon, 29 Jun 2020 12:55:54 +0000 (14:55 +0200)]
virConnectGetAllDomainStats: Document two vcpu stats

When introducing vcpu.<num>.wait (v1.3.2-rc1~301) and
vcpu.<num>.halted (v2.4.0-rc1~36) the documentation was
not written.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agodocs: Update CI documentation
Andrea Bolognani [Thu, 2 Jul 2020 13:02:38 +0000 (15:02 +0200)]
docs: Update CI documentation

We're no longer using either Travis CI or the Jenkins-based
CentOS CI, but we have started using Cirrus CI.

Mention the libvirt-ci subproject as well, as a pointer for those
who might want to learn more about our CI infrastructure.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agocirrus: Generate jobs dynamically
Andrea Bolognani [Mon, 29 Jun 2020 17:00:36 +0000 (19:00 +0200)]
cirrus: Generate jobs dynamically

Instead of having static job definitions for FreeBSD and macOS,
use a generic template for both and fill in the details that are
actually different, such as the list of packages to install, in
the GitLab CI job, right before calling cirrus-run.

The target-specific information are provided by lcitool, so that
keeping them up to date is just a matter of running the refresh
script when necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agomaint: Post-release version bump to 6.6.0
Michal Privoznik [Fri, 3 Jul 2020 07:32:30 +0000 (09:32 +0200)]
maint: Post-release version bump to 6.6.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoRelease of libvirt-6.5.0
Daniel Veillard [Fri, 3 Jul 2020 06:49:25 +0000 (08:49 +0200)]
Release of libvirt-6.5.0

* NEWS.rst: updated with date of release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
4 years agoNEWS: Update for libvirt 6.5.0
Andrea Bolognani [Thu, 2 Jul 2020 12:41:18 +0000 (14:41 +0200)]
NEWS: Update for libvirt 6.5.0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: add access check for hooks to fix running as non-root
Daniel P. Berrangé [Wed, 1 Jul 2020 16:36:51 +0000 (17:36 +0100)]
util: add access check for hooks to fix running as non-root

Since feb83c1e710b9ea8044a89346f4868d03b31b0f1 libvirtd will abort on
startup if run as non-root

  2020-07-01 16:30:30.738+0000: 1647444: error : virDirOpenInternal:2869 : cannot open directory '/etc/libvirt/hooks/daemon.d': Permission denied

The root cause flaw is that non-root libvirtd is using /etc/libvirt for
its hooks. Traditionally that has been harmless though since we checked
whether we could access the hook file and degraded gracefully. We need
the same access check for iterating over the hook directory.

Long term we should make it possible to have an unprivileged hook dir
under $HOME.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirnettlshelpers: Update private key
Michal Privoznik [Wed, 1 Jul 2020 07:47:48 +0000 (09:47 +0200)]
virnettlshelpers: Update private key

With the recent update of Fedora rawhide I've noticed
virnettlssessiontest and virnettlscontexttest failing with:

  Our own certificate servercertreq-ctx.pem failed validation
  against cacertreq-ctx.pem: The certificate uses an insecure
  algorithm

This is result of Fedora changes to support strong crypto [1]. RSA
with 1024 bit key is viewed as legacy and thus insecure. Generate
a new private key then. Moreover, switch to EC which is not only
shorter but also not deprecated that often as RSA. Generated
using the following command:

  openssl genpkey --outform PEM --out privkey.pem \
  --algorithm EC --pkeyopt ec_paramgen_curve:P-384 \
  --pkeyopt ec_param_enc:named_curve

1: https://fedoraproject.org/wiki/Changes/StrongCryptoSettings2

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: Fix 'Offline migration' description
Daniel Henrique Barboza [Tue, 30 Jun 2020 19:43:43 +0000 (16:43 -0300)]
docs: Fix 'Offline migration' description

'transfers inactive the definition of a domain' seems odd.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoUpdate translation files
Weblate [Mon, 29 Jun 2020 15:46:43 +0000 (17:46 +0200)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Mon, 29 Jun 2020 15:46:21 +0000 (17:46 +0200)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10318 of 10318 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/uk/

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agotools: fix misleading comments about command names
Daniel P. Berrangé [Wed, 13 May 2020 15:31:28 +0000 (16:31 +0100)]
tools: fix misleading comments about command names

The srv-XXX commands were renamed to server-XXX, with the old
name being a undocumented back compat alias only.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: Run all jobs, for all branches, all the time
Andrea Bolognani [Fri, 26 Jun 2020 18:11:58 +0000 (20:11 +0200)]
ci: Run all jobs, for all branches, all the time

After recent changes (increasing the parallelism of the pipeline
by reducing the number of stages, introducing FreeBSD builds that
take longer than any other job), the difference between running
the full pipeline or a reduced one has basically disappeared: in
both cases, the completion time is around 25-35 minutes depending
on whether containers need to be rebuilt and how many shared
runners are available.

Reduce the complexity of our .gitlab-ci.yml and make things
simpler for contributors by simply always running all jobs.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoTranslated using Weblate (French)
Daniel P. Berrangé [Mon, 29 Jun 2020 13:57:51 +0000 (15:57 +0200)]
Translated using Weblate (French)

Currently translated at 11.8% (1221 of 10318 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/fr/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4 years agoTranslated using Weblate (Bengali (India))
Akarshan Biswas [Mon, 29 Jun 2020 13:57:48 +0000 (15:57 +0200)]
Translated using Weblate (Bengali (India))

Currently translated at 21.6% (2223 of 10291 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/bn_IN/

Signed-off-by: Akarshan Biswas <akarshan.biswas@gmail.com>
4 years agoUpdate translation files
Weblate [Mon, 29 Jun 2020 13:57:44 +0000 (15:57 +0200)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (French)
Julien Humbert [Mon, 29 Jun 2020 13:57:37 +0000 (15:57 +0200)]
Translated using Weblate (French)

Currently translated at 11.8% (1223 of 10291 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/fr/

Signed-off-by: Julien Humbert <julroy67@gmail.com>
Translated using Weblate (French)

Currently translated at 11.6% (1201 of 10291 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/fr/

Signed-off-by: Julien Humbert <julroy67@gmail.com>
4 years agopo: refresh pot file in prep for new release
Daniel P. Berrangé [Mon, 29 Jun 2020 13:17:28 +0000 (14:17 +0100)]
po: refresh pot file in prep for new release

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodomain_conf: Remove zPCI validation from formatter
Michal Privoznik [Sat, 27 Jun 2020 07:09:39 +0000 (09:09 +0200)]
domain_conf: Remove zPCI validation from formatter

In 076591009ad a validation code was added to
virDomainDeviceInfoFormat() which reports an error if zPCI
address entered in was incomplete. But, there are two problems
with this approach.

The first problem is the placement of the code - it doesn't
belong into XML formatter rather than XML validator.

The second one is that at the point of formatting XML the post
parse callback has run and thus filled in required info.
Therefore this check can never do something useful and instead of
moving it into validator, it's removed completely.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu_validate: Fix how qemuValidateDomainDeviceDefZPCIAddress() is called
Michal Privoznik [Sat, 27 Jun 2020 08:49:37 +0000 (10:49 +0200)]
qemu_validate: Fix how qemuValidateDomainDeviceDefZPCIAddress() is called

To make the code future proof, the rest of the
qemuValidateDomainDeviceDefAddress() has to be executed (even
though there is nothing there yet) instead of returning directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemuhotplugtest: Free monitor iff successfully initialized
Michal Privoznik [Sat, 27 Jun 2020 07:20:21 +0000 (09:20 +0200)]
qemuhotplugtest: Free monitor iff successfully initialized

If initializing test monitor in testQemuHotplugCpuPrepare()
fails, the control jumps to error label where
testQemuHotplugCpuDataFree() is called. But since the data->mon
is NULL due to aforementioned failure,
qemuMonitorTestGetMonitor() dereferences a NULL pointer leading
to a SIGSEGV.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agodomain_conf.c: skip checking ZPCI address is incomplete if not present
Daniel Henrique Barboza [Fri, 26 Jun 2020 21:49:00 +0000 (18:49 -0300)]
domain_conf.c: skip checking ZPCI address is incomplete if not present

Commit 076591009ad1 ("conf: fix zPCI address auto-generation on
s390") is doing a check for virZPCIDeviceAddressIsIncomplete()
prior to checking if the device has a ZPCI address at all. This
results in errors like these when starting libvirt:

  error : virDomainDeviceInfoFormat:7527 : internal error:
  Missing uid or fid attribute of zPCI address

Fix it by moving virZPCIDeviceAddressIsIncomplete() after the
check done by virZPCIDeviceAddressIsPresent().

Fixes: 076591009ad11ec108521b52a4945d0f895fa160
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agonews: document zPCI addressing changes
Shalini Chellathurai Saroja [Fri, 26 Jun 2020 08:59:41 +0000 (10:59 +0200)]
news: document zPCI addressing changes

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agotests: add test with PCI and CCW device
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:18 +0000 (10:25 +0200)]
tests: add test with PCI and CCW device

Add test with a ZPCI host device and a CCW memballoon device to ensure
that CCW address remains the default address assigned.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agotests: qemu: add more tests for ZPCI on S390
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:17 +0000 (10:25 +0200)]
tests: qemu: add more tests for ZPCI on S390

1. Test for auto-generating uids while specifying valid fids
2. Test for auto-generating fids while specifying valid uids
3. Test for parse error while specifying a valid fid and an invalid
   uid
4. Test for parse error while specifying two ZPCI devices with same
   uid and fid addresses
5. Test for parse error when both uid and fid are set to zero
6. Test for error while specifying uid and not providing ZPCI
   capability.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu: move ZPCI uid validation into device validation
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:16 +0000 (10:25 +0200)]
qemu: move ZPCI uid validation into device validation

The ZPCI device validation is specific to qemu. So, let us move the
ZPCI uid validation out of domain xml parsing into qemu domain device
validation.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoconf: fix zPCI address auto-generation on s390
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:15 +0000 (10:25 +0200)]
conf: fix zPCI address auto-generation on s390

Let us fix the issues with zPCI address validation and auto-generation
on s390.

Currently, there are two issues with handling the ZPCI address
extension. Firstly, when the uid is to be auto-generated with a
specified fid, .i.e.:

    ...
    <address type='pci'>
        <zpci fid='0x0000001f'/>
    </address>
    ...

we expect uid='0x0001' (or the next available uid for the domain).
However, we get a parsing error:

    $ virsh define zpci.xml
    error: XML error: Invalid PCI address uid='0x0000', must be > 0x0000
    and <= 0xffff

Secondly, when the uid is specified explicitly with the invalid
numerical value '0x0000', we actually expect the parsing error above.
However, the domain is being defined and the uid value is silently
changed to a valid value.

The first issue is a bug and the second one is undesired behaviour, and
both issues are related to how we (in-band) signal invalid values for
uid and fid. So let's fix the XML parsing to do validation based on what
is actually specified in the XML.

The first issue is also related to the current code behaviour, which
is, if either uid or fid is specified by the user, it is incorrectly
assumed that both uid and fid are specified. This bug is fixed by
identifying when the user specified ZPCI address is incomplete and
auto-generating the missing ZPCI address.

Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoconf: use g_autofree to ensure automatic cleanup
Shalini Chellathurai Saroja [Thu, 18 Jun 2020 08:25:14 +0000 (10:25 +0200)]
conf: use g_autofree to ensure automatic cleanup

Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agolxc: replace use of term 'slave' filesystem mount setup
Daniel P. Berrangé [Wed, 17 Jun 2020 10:57:31 +0000 (11:57 +0100)]
lxc: replace use of term 'slave' filesystem mount setup

Refer to the notion of mount propagation instead which describes
the actual behaviour more clearly.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: remove use of the term 'slave' in Jenkins agent docs
Daniel P. Berrangé [Wed, 17 Jun 2020 11:21:58 +0000 (12:21 +0100)]
docs: remove use of the term 'slave' in Jenkins agent docs

Jenkins replaced use of the term 'slave' with 'agent' when
describing its architecture.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: update link to the libvirt jenkins plugin
Daniel P. Berrangé [Wed, 17 Jun 2020 17:53:15 +0000 (18:53 +0100)]
docs: update link to the libvirt jenkins plugin

The wiki page we currently link to is just a redirect for
back compat.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agolxc: remove use of the terms 'master' and 'slave' in PTY setup
Daniel P. Berrangé [Wed, 17 Jun 2020 10:56:58 +0000 (11:56 +0100)]
lxc: remove use of the terms 'master' and 'slave' in PTY setup

The two sides of a PTY can be referred to as primary and secondary
TTYs.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: remove use of the terms 'master' and 'slave' when iterating CPUs
Daniel P. Berrangé [Wed, 17 Jun 2020 10:20:32 +0000 (11:20 +0100)]
qemu: remove use of the terms 'master' and 'slave' when iterating CPUs

When querying QEMU we have to iterate over two nested sets
of CPUs. The terms "main vcpu" and "sub vcpu" are a good
representation.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: remove use of the terms 'master' and 'slave' in PTY code
Daniel P. Berrangé [Wed, 17 Jun 2020 09:48:34 +0000 (10:48 +0100)]
util: remove use of the terms 'master' and 'slave' in PTY code

The two sides of a PTY can be referred to as primary and  secondary
TTYs.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotools: remove use of the term 'slave' in code dealing with bridges
Daniel P. Berrangé [Wed, 17 Jun 2020 09:44:39 +0000 (10:44 +0100)]
tools: remove use of the term 'slave' in code dealing with bridges

Network interfaces are simply attached to a bridge device.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: remove use of the term 'enslaved' wrt tap & bridge devices
Daniel P. Berrangé [Wed, 17 Jun 2020 09:35:04 +0000 (10:35 +0100)]
docs: remove use of the term 'enslaved' wrt tap & bridge devices

Network interfaces are simply attached to a bridge device.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonodedev: remove use of the term 'blacklist' from enumeration code
Daniel P. Berrangé [Tue, 16 Jun 2020 11:16:55 +0000 (12:16 +0100)]
nodedev: remove use of the term 'blacklist' from enumeration code

The term "ignored" is a better choice for the filtering performed
on devices from udev.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: rename method to virKModIsProhibited
Daniel P. Berrangé [Tue, 16 Jun 2020 11:12:09 +0000 (12:12 +0100)]
util: rename method to virKModIsProhibited

This new naming matches the terminology used in the error
messages that the callers report.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: remove use of the term 'whitelist' from firewall docs
Daniel P. Berrangé [Tue, 16 Jun 2020 08:35:41 +0000 (09:35 +0100)]
docs: remove use of the term 'whitelist' from firewall docs

The term is redundant in the context used.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: remove use of the terms 'whitelist' and 'blacklist' from CPU code
Daniel P. Berrangé [Tue, 16 Jun 2020 10:16:43 +0000 (11:16 +0100)]
qemu: remove use of the terms 'whitelist' and 'blacklist' from CPU code

When listing CPU models, we need to filter the data based on sets
of permitted and forbidden CPU models.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: remove use of the term 'whitelist' from cgroup docs
Daniel P. Berrangé [Tue, 16 Jun 2020 10:24:48 +0000 (11:24 +0100)]
docs: remove use of the term 'whitelist' from cgroup docs

The term "access control list" better describes the concept involved.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agocgroup: remove use of the term 'whitelist' from cgroup code
Daniel P. Berrangé [Tue, 16 Jun 2020 10:24:48 +0000 (11:24 +0100)]
cgroup: remove use of the term 'whitelist' from cgroup code

The term "access control list" better describes the concept involved.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: remove use of the term 'whitelist' from RPC code
Daniel P. Berrangé [Tue, 16 Jun 2020 09:39:17 +0000 (10:39 +0100)]
rpc: remove use of the term 'whitelist' from RPC code

The term "access control list" better describes the concept involved.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoscripts: remove use of the term 'whitelist' from build helpers
Daniel P. Berrangé [Tue, 16 Jun 2020 08:39:12 +0000 (09:39 +0100)]
scripts: remove use of the term 'whitelist' from build helpers

The term "permitted list" is a better choice for the filtering
logic applied.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: Use openSUSE image for code style checking
Jonathon Jongsma [Mon, 22 Jun 2020 14:43:05 +0000 (09:43 -0500)]
ci: Use openSUSE image for code style checking

CentOS does not have the cppi package, so some code style checks are
skipped. Switch to a openSUSE image to do the code style checks.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoqemuxml2xmltest: Set dummy non-hypervisor drivers
Michal Privoznik [Thu, 25 Jun 2020 14:34:30 +0000 (16:34 +0200)]
qemuxml2xmltest: Set dummy non-hypervisor drivers

When parsing domain XML post parse callbacks are run and one of
them might try and call API from a non-hypervisor driver (e.g.
just like qemuDomainDeviceNetDefPostParse() is doing - it calls a
network API). To avoid this in the test suite, set dummy drivers,
which renders all non-hypervisor APIs return error.

This mimics what qemuxml2argvtest does.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: ensure failure if input file doesn't exist
Jonathon Jongsma [Thu, 25 Jun 2020 20:18:23 +0000 (15:18 -0500)]
tests: ensure failure if input file doesn't exist

When using the DO_TEST_PARSE_ERROR() macro, a failure to parse the input
file is considered a successful test. However, if the input file is
totally missing, that should be distinguished from a parsing error and
not be treated as a test success.

The function virDomainDefParseFile() simply returns NULL for any parse
failure, including a missing file. So we need to explicitly check
whether the file exists first, and fail the test if it is missing.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoqemu: ramfb video device doesn't support PCI address
Jonathon Jongsma [Thu, 25 Jun 2020 20:18:22 +0000 (15:18 -0500)]
qemu: ramfb video device doesn't support PCI address

Although a ramfb video device is not a PCI device, we don't currently
report an error for ramfb device definitions containing a PCI address.
However, a guest configured with such a device will fail to start:

    # virsh start test1
    error: Failed to start domain test1
    error: internal error: qemu unexpectedly closed the monitor: 2020-06-16T05:23:02.759221Z qemu-kvm: -device ramfb,id=video0,bus=pcie.0,addr=0x1: Device 'ramfb' can't go on PCIE bus

A better approach is to reject any device definitions that contain PCI
addresses.  While this is a change in behavior, any existing
configurations were non-functional.

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoqemuDomainDeviceNetDefPostParse: Switch order of conditions
Michal Privoznik [Thu, 25 Jun 2020 07:27:30 +0000 (09:27 +0200)]
qemuDomainDeviceNetDefPostParse: Switch order of conditions

A few commits back (in v6.4.0-131-gbdb8f2e418) the post parse
function for domain interface was changed so that it doesn't fill
in model for hostdev types of interfaces (including network type
interfaces which would end up hostdevs).

While the idea is sound, the execution can be a bit better:
virDomainNetResolveActualType() which is used to determine
runtime type of given interface is heavy gun - it connects to
network driver, fetches network XML, parses it. This all is
followed by check whether the interface doesn't already have
model set (from domain XML).

If we switch the order of these two checks then the short circuit
evaluation will ensure the expensive check is done only if really
needed.

This commit in fact fixes qemuxml2xmltest which due to lacking
fake network driver tries to connect to network:///session and
start the virtnetworkd. Fortunately, because of
v6.3.0-25-gf28fbb05d3 it fails to do so and
virDomainNetResolveActualType() returns -1. The only reason we
don't see the test failing is because our input XMLs have model
and thus we are saved by the latter (now former) check.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoci: Refresh Dockerfiles
Andrea Bolognani [Thu, 25 Jun 2020 12:28:25 +0000 (14:28 +0200)]
ci: Refresh Dockerfiles

All targets get pip3, which is now part of the base system, and
the number of native packages included in the MinGW containers is
significantly reduced.

The corresponding libvirt-ci commit is 4ff697ba0b5d.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agoNEWS: mention fix for crash in qemuDomainBlockCommit
Peter Krempa [Thu, 25 Jun 2020 08:22:34 +0000 (10:22 +0200)]
NEWS: mention fix for crash in qemuDomainBlockCommit

There were two upstream issues filed for the problem so it's worth
mentioning.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agokbase: incrementalbackupinternals: Describe 'block commit'
Peter Krempa [Wed, 24 Jun 2020 10:59:17 +0000 (12:59 +0200)]
kbase: incrementalbackupinternals: Describe 'block commit'

oVirt does merge images out of libvirt in some cases. Add docs outlining
how it's done from a high level.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agokbase: incrementalbackupinternals: Replace bash with pseudocode
Peter Krempa [Wed, 24 Jun 2020 09:41:28 +0000 (11:41 +0200)]
kbase: incrementalbackupinternals: Replace bash with pseudocode

Simplify the docs and reduce maintenance burden by just describing the
algorithm by a pseudo-language. Users are encouraged to use libvirt
anyways and projects such as oVirt which do some management of storage
themselves are unlikely to use bash anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agokbase: incrementalbackupinternals: Add section on 'qemu-img bitmap' use
Peter Krempa [Wed, 24 Jun 2020 09:34:16 +0000 (11:34 +0200)]
kbase: incrementalbackupinternals: Add section on 'qemu-img bitmap' use

Define what users should look for when wanting to manipulate bitmaps
themselves.

Later on a patch will turn the bash algorithms into pseudocode for
simplicity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agokbase: incrementalbackupinternals: Add secion on bitmap handling in shell
Peter Krempa [Wed, 24 Jun 2020 09:26:29 +0000 (11:26 +0200)]
kbase: incrementalbackupinternals: Add secion on bitmap handling in shell

Add a section that outlines usage of tools to handle bitmaps and
introduce terms corresponding to the output of qemu-img to be used in
further sections.

With this we can simplify the section about checking bitmap health as we
don't have to explain the qemu-img output but can refer to the newly
defined terms.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agokbase: incrementalbackupinternals: Clarify language in snapshots section
Peter Krempa [Wed, 24 Jun 2020 09:03:39 +0000 (11:03 +0200)]
kbase: incrementalbackupinternals: Clarify language in snapshots section

Emphasize what needs to happen and also that creating a snapshot doesn't
create the appropriate bitmaps. Also mention that granularity is kept.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agokbase: incrementalbackupinternals: Add snapshot terminology
Peter Krempa [Wed, 24 Jun 2020 08:56:20 +0000 (10:56 +0200)]
kbase: incrementalbackupinternals: Add snapshot terminology

Make it obvious what's meant by 'overlay' and 'backing image' for sake
of extension of the document.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: auto-assign hostdev devices to PCIe
Laine Stump [Wed, 17 Jun 2020 20:18:23 +0000 (16:18 -0400)]
qemu: auto-assign hostdev devices to PCIe

Until recently, an <interface type='network'> would automatically be
assigned model "rtl8139", which in turn would lead to the device being
assigned a PCI address on a conventional PCI controller (i.e. a
pcie-to-pci-bridge). If the network was a typical Linux host
bridge-based network that used an emulated device, this would be
appropriate, since the guest actually would get an emulated rtl8139
NIC, and that device is a conventional PCI device.

However, if the network being used was a pool of hostdev devices, the
guest would get an actual PCIe network device assigned from the host
via VFIO; while the interface model in that case is irrelevant for the
QEMU commandline to assign the device, the PCI address would have
already been assigned prior to runtime, so the address assignment
would be done based on the model='rtl8139' - a conventional PCI
device. VFIO assignment of a PCIe device to a conventional PCI slot
works, but we would rather have these devices in a PCIe slot.

Since commit bdb8f2e4186, if <interface type='network'> points to a
etwork that is a pool of hostdev devices, the interface model will be
_unset_ by default. This patch uses that information when deciding
what type of slot to assign to the device: since all hostdev network
interfaces are SR-IOV VFs, and *all* SR-IOV network cards are PCIe, it
is safe to assume that the VFs are PCIe and we should assign then to a
PCIe slot in the guest.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu_domainjob: moved domain job APIs to a separate file
Prathamesh Chavan [Wed, 24 Jun 2020 10:45:23 +0000 (16:15 +0530)]
qemu_domainjob: moved domain job APIs to a separate file

All the domain job related APIs were present in `qemu_domain.c`
along with the other domain APIs. In this patch, we move all the
qemu domain job APIs into a separate file.

Also, in this process, `qemuDomainTrackJob()`,
`qemuDomainFreeJob()`, `qemuDomainInitJob()` and
`qemuDomainObjSaveStatus()` were converted to a non-static
funciton and exposed using `qemu_domain.h`.

Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_domain: Avoid using qemuDomainObjPrivatePtr as parameter
Prathamesh Chavan [Wed, 24 Jun 2020 10:45:22 +0000 (16:15 +0530)]
qemu_domain: Avoid using qemuDomainObjPrivatePtr as parameter

In functions `qemuDomainObjInitJob`, `qemuDomainObjResetJob`,
`qemuDomainObjResetAgentJob`, `qemuDomainObjResetAsyncJob`,
`qemuDomainObjFreeJob`, `qemuDomainJobAllowed`,
`qemuDomainNestedJobAllowed` we avoid sending the complete
qemuDomainObjPrivatePtr as parameter and instead just send
qemuDomainJobObjPtr.

This is done in a effort to separating the qemu-job APIs into
a spearate file.

Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: Add the build dependency of make
Han Han [Wed, 24 Jun 2020 09:07:19 +0000 (17:07 +0800)]
spec: Add the build dependency of make

For some minimal OS like fedora cloud image, the make is not installed
by default.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoleaseshelper: Report more errors
Michal Privoznik [Mon, 15 Jun 2020 10:53:48 +0000 (12:53 +0200)]
leaseshelper: Report more errors

Some functions or code paths that may fail don't report error
(e.g. when acquiring PID file fails) leading to a silent quit
of the leaseshelper. This makes it super hard for us and users
to debug what is happening. Fortunately, dnsmasq captures both
stdout and stderr so we can write an error message there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoleaseshelper: Wait to acquire PID file
Michal Privoznik [Thu, 11 Jun 2020 14:43:22 +0000 (16:43 +0200)]
leaseshelper: Wait to acquire PID file

On a DHCP transaction, dnsmasq runs our leases helper which
updates corresponding JSON files. While one dnsmasq won't run the
leaseshelper in parallel, two dnsmasqs (from two distinct
networks) might. To avoid corrupting JSON file, the leaseshelper
acquires PID file first. Well, the way it's acquiring it is not
ideal - it calls virPidFileAcquirePath(wait = false); which
means, that either it acquires the PID file instantly or returns
an error and does not touch the JSON at all. This in turn means
that there might be a leases record missing. With wait = true,
this won't happen.

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: fix missing error reports in capabilities probing
Daniel P. Berrangé [Mon, 15 Jun 2020 12:43:26 +0000 (13:43 +0100)]
qemu: fix missing error reports in capabilities probing

The "virsh domcapabilities --arch ppc64" command will fail with no
error message set if qemu-system-ppc64 is not currently installed.

This is because virQEMUCapsCacheLookup() does not report any error
message if not capabilities can be obtained from the cache. Almost
all methods calling this expected an error to be set on failure.

Once that's fixed though, we see a further bug which is that
virQEMUCapsCacheLookupDefault() is passing a NULL binary path to
virQEMUCapsCacheLookup(), so we need to catch that too.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoAUTHORS: add Pino Toscano as a maintainer
Ján Tomko [Wed, 24 Jun 2020 08:12:09 +0000 (10:12 +0200)]
AUTHORS: add Pino Toscano as a maintainer

$ git log --committer=ptoscano@redhat.com --pretty=oneline | wc -l
11

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoAUTHORS: clean up maintainer list
Ján Tomko [Wed, 24 Jun 2020 08:06:51 +0000 (10:06 +0200)]
AUTHORS: clean up maintainer list

Move people who currently do not have commit access:
  https://gitlab.com/libvirt/libvirt/-/project_members
to the 'previous maintainers' section.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: format 'ramfb' attribute for mediated devices
Jonathon Jongsma [Tue, 23 Jun 2020 18:29:56 +0000 (13:29 -0500)]
qemu: format 'ramfb' attribute for mediated devices

It's possible to use ramfb as the boot display of an assigned vgpu
device. This was introduced in 4b95738c, but unfortunately the attribute
was not formatted into the xml output for such a device. This patch
fixes that oversight and adds a xml2xml test to verify proper behavior.

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: don't continue loading caps if outdated
Daniel P. Berrangé [Thu, 18 Jun 2020 13:44:16 +0000 (14:44 +0100)]
qemu: don't continue loading caps if outdated

The XML format used for QEMU capabilities is not required to be
stable across releases, as we invalidate the cache whenever the
libvirt binary changes.

We none the less always try to parse te entire XML file before
we do any validity checks. Thus if we change the format of any
part of the data, or change permitted values for enums, then
libvirtd logs will be spammed with errors.

These are not in fact errors, but an expected scenario.

This change makes the loading code validate the cache timestamp
against the libvirtd timestamp immediately. If they don't match
then we stop loading the rest of the XML file.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonews: Document recent hook script extension
Dmitry Nesterenko [Tue, 23 Jun 2020 16:29:57 +0000 (18:29 +0200)]
news: Document recent hook script extension

Signed-off-by: Dmitry Nesterenko <dmitry.nesterenko@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Document recent hook script extension
Dmitry Nesterenko [Tue, 23 Jun 2020 14:45:35 +0000 (17:45 +0300)]
docs: Document recent hook script extension

Signed-off-by: Dmitry Nesterenko <dmitry.nesterenko@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirhook: support hooks placed in $driver.d/
Dmitry Nesterenko [Tue, 23 Jun 2020 14:45:34 +0000 (17:45 +0300)]
virhook: support hooks placed in $driver.d/

It is easier for management software (and subsequently
distributions) to install hook script under
/etc/libvirt/hooks/$driver.d/ and have libvirt execute them in
alphabetical order. To maintain backwards compatibility,
/etc/libvirt/hooks/$driver hook script is executed the first
followed by scripts from the $driver.d directory.

The stdio is chained between the scripts. The output of the first
script is input of the second and so on.

Signed-off-by: Dmitry Nesterenko <dmitry.nesterenko@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirhook: Separate hook script invocation into a function
Dmitry Nesterenko [Tue, 23 Jun 2020 14:45:33 +0000 (17:45 +0300)]
virhook: Separate hook script invocation into a function

This refactor is needed to support support hooks placed in
several files.

Signed-off-by: Dmitry Nesterenko <dmitry.nesterenko@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS.rst: update for the new TPM Proxy device
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:52 +0000 (15:11 -0300)]
NEWS.rst: update for the new TPM Proxy device

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotests/qemuxml2argvtest.c: add TPM Proxy command line tests
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:51 +0000 (15:11 -0300)]
tests/qemuxml2argvtest.c: add TPM Proxy command line tests

Add tests for both supported scenarios: a single TPM Proxy and
a TPM Proxy with a regular TPM device in the same domain.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: build command line for the TPM Proxy device
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:50 +0000 (15:11 -0300)]
qemu: build command line for the TPM Proxy device

This patch wraps it up all the wiring done in previous patches,
enabling a PPC64 guest to launch a guest using a TPM Proxy
device.

Note that device validation is already being done in qemu_validate.c,
qemuValidateDomainDeviceDefTPM(), on domain define time. We don't
need to verify QEMU capabilities for this device again inside
qemu_command.c.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: add XML schema tests for the TPM Proxy device
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:49 +0000 (15:11 -0300)]
tests: add XML schema tests for the TPM Proxy device

This tests aims to exercise how a TPM Proxy device can be
added in the domain, either alone or with a regular TPM
device. It also ensures that we do not allow bogus scenarios
to slip by.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: add validations after TPM Proxy model introduction
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:48 +0000 (15:11 -0300)]
qemu: add validations after TPM Proxy model introduction

Previous patch handled the conversion of def->tpm to the
array def->tpms and the XML parsing logic. This patch handles
the validations needed to ensure the intended behavior.

The existing qemuValidateDomainDeviceDefTPM() function was updated
to guarantee that the VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY model is
exclusive to PPC64 guests and to the VIR_DOMAIN_TPM_TYPE_PASSTHROUGH
backend.

A new function called qemuDomainDefTPMsPostParse() was added to guarantee
that the following combinations in the same domain are valid:

- a single TPM device
- a single TPM Proxy device
- a single TPM + single TPM Proxy devices

And these combinations in the same domain are NOT valid:

- 2 or more TPM devices
- 2 or more TPM Proxy devices

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf, qemu, security, tests: introducing 'def->tpms' array
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:47 +0000 (15:11 -0300)]
conf, qemu, security, tests: introducing 'def->tpms' array

A TPM Proxy device can coexist with a regular TPM, but the
current domain definition supports only a single TPM device
in the 'tpm' pointer. This patch replaces this existing pointer
in the domain definition to an array of TPM devices.

All files that references the old pointer were adapted to
handle the new array instead. virDomainDefParseXML() TPM related
code was adapted to handle the parsing of an extra TPM device.
TPM validations after this new scenario will be updated in
the next patch.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu_tpm, security, tests: change 'switch' clauses for 'if'
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:46 +0000 (15:11 -0300)]
qemu_tpm, security, tests: change 'switch' clauses for 'if'

This trivial rework is aimed to reduce the amount of line changes
made by the next patch, when 'def->tpm' will become a 'def->tpms'
array.

Instead of using a 'switch' where only the VIR_DOMAIN_TPM_TYPE_EMULATOR
label does something, use an 'if' clause instead.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu_extdevice.c: remove unneeded 'ret' variable
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:45 +0000 (15:11 -0300)]
qemu_extdevice.c: remove unneeded 'ret' variable

qemuExtDevicesInitPaths() does not need 'ret'.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Extend QEMU capabilities with 'spapr-tpm-proxy'
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:44 +0000 (15:11 -0300)]
qemu: Extend QEMU capabilities with 'spapr-tpm-proxy'

Expose the TPM Proxy support for PPC64 guests by creating a new
cap called QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY.

This device is part of the machinery the guest need to orchestrate
with the PPC64 Ultravisor the transition to the Secure VM (SVM)
mode. Inside QEMU, this device will be used with the H_TPM_COMM
hypercall to connect with the TPM Resource Manager, enabling
the guest to open and close TPM sessions with the host TPM.

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: documentation and schema for the new TPM Proxy model
Daniel Henrique Barboza [Wed, 10 Jun 2020 18:11:43 +0000 (15:11 -0300)]
docs: documentation and schema for the new TPM Proxy model

QEMU 4.1.0 introduced a new device type called TPM Proxy, currently
implemented by PPC64 guests via a new virtual device called
'spapr-tpm-proxy' (see QEMU 0fb6bd073230 for more info).

The TPM Proxy device interacts with a TPM Resource Manager, a host
device capable of multiplexing the host TPM with multiple processes.
This allows multiple guests to access some TPM features at the
same time. Note that this mode of operation does not provide
full TPM features to be available for the guest - for that case
the guest still needs to assign a vTPM device (tpm-spapr for
PPC64 guests). Although redundant, there is currently no technical
limitation for a guest to assign both a vTPM and a TPM Proxy at the
same time.

This patch adds documentation and schema for a new TPM model
type called 'spapr-tpm-proxy' that creates this new TPM Proxy
device. This model is valid only for the 'passthrough' backend.
An example of a TPM Proxy device connected to a TPM Resource Manager
'/dev/tpmrm0' will look like this:

<tpm model='spapr-tpm-proxy'>
  <backend type='passthrough'>
    <device path='/dev/tpmrm0'/>
  </backend>
</tpm>

Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu_capabilities.c: modernize virQEMUCapsCacheLookupDefault
Daniel Henrique Barboza [Mon, 22 Jun 2020 13:32:33 +0000 (10:32 -0300)]
qemu_capabilities.c: modernize virQEMUCapsCacheLookupDefault

Use g_autoptr() in qemuCaps to get rid of a virObjectUnref call,
a 'cleanup' label and the 'ret' pointer.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu_command: Fix IOMMU validator name in two comments
Michal Privoznik [Tue, 23 Jun 2020 13:55:42 +0000 (15:55 +0200)]
qemu_command: Fix IOMMU validator name in two comments

When building command line for IOMMU or machine, there are two
comments which mention function that validate IOMMU. But they
both refer to old name which was changed in v6.3.0-rc1~246.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: format address wdith on intel-iommu command line
Menno Lageman [Thu, 4 Jun 2020 07:42:43 +0000 (09:42 +0200)]
qemu: format address wdith on intel-iommu command line

Format the address width attribute. Depending on the version of
QEMU it is named 'aw-bits' or 'x-aw-bits'.

Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoconf: add address width attribute to iommu
Menno Lageman [Thu, 4 Jun 2020 07:42:42 +0000 (09:42 +0200)]
conf: add address width attribute to iommu

Add a new aw_bits attribute to the iommu device to control
the address width of the intel-iommu

Signed-off-by Menno Lageman <menno.lageman@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Correct the log name for qemu_security.c
Liao Pingfang [Tue, 23 Jun 2020 07:58:12 +0000 (15:58 +0800)]
qemu: Correct the log name for qemu_security.c

Correct the log name for qemu_security.c to qemu.qemu_security
instead of qemu.qemu_process.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: hostdev-scsi-virtio-scsi: Integrate iSCSI authentication cases
Peter Krempa [Wed, 17 Jun 2020 13:24:05 +0000 (15:24 +0200)]
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Integrate iSCSI authentication cases

Integrate both 'disk-hostdev-scsi-virtio-iscsi-auth-AES' and
'hostdev-scsi-virtio-iscsi-auth' as the new test infrastructure tests
both legacy and 'secret' object cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: hostdev-scsi-virtio-scsi: Integrate 'hostdev-scsi-virtio-iscsi...
Peter Krempa [Wed, 17 Jun 2020 13:19:36 +0000 (15:19 +0200)]
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Integrate 'hostdev-scsi-virtio-iscsi' case

We can add the iSCSI hostdevs to the same test file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: hostdev-scsi-virtio-scsi: Integrate 'hostdev-scsi-readonly'
Peter Krempa [Wed, 17 Jun 2020 13:57:13 +0000 (15:57 +0200)]
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Integrate 'hostdev-scsi-readonly'

This can be tested along with other stuff.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: hostdev-scsi-virtio-scsi: Add qemu-2.8 variant
Peter Krempa [Wed, 17 Jun 2020 13:10:51 +0000 (15:10 +0200)]
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Add qemu-2.8 variant

qemu-2.8 didn't yet support QEMU_CAPS_ISCSI_PASSWORD_SECRET. This
version will allow integrating multiple test cases into one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: hostdev-scsi-virtio-scsi: Add "latest" caps version
Peter Krempa [Wed, 17 Jun 2020 13:51:57 +0000 (15:51 +0200)]
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Add "latest" caps version

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>