]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoqemu: Validate memory hotplug in domainValidateCallback instead of cmd line generator
Michal Privoznik [Tue, 28 Jul 2020 08:51:32 +0000 (10:51 +0200)] 
qemu: Validate memory hotplug in domainValidateCallback instead of cmd line generator

When editing a domain with hotplug enabled, I removed the only
NUMA node it had and got no error. I got the error later though,
when starting the domain. This is not as user friendly as it can
be. Move the validation call out from command line generator and
into domain validator (which is called prior to starting cmd line
generation anyway).

When doing this, I had to remove memory-hotplug-nonuma xml2xml
test case because there is no way the test case can succeed,
obviously.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoPost-release version bump to 6.8.0
Jiri Denemark [Tue, 1 Sep 2020 07:10:30 +0000 (09:10 +0200)] 
Post-release version bump to 6.8.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-6.7.0 v6.7.0
Jiri Denemark [Tue, 1 Sep 2020 07:08:47 +0000 (09:08 +0200)] 
Release of libvirt-6.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRNG: Allow interleaving of /domain/cpu/numa/cell children
Michal Privoznik [Mon, 31 Aug 2020 09:35:47 +0000 (11:35 +0200)] 
RNG: Allow interleaving of /domain/cpu/numa/cell children

So far, the <cell/> element can have two types of children
elements: <distances/> and <cache/> (which can be repeated more
times). However, there is no reason to require specific order in
input XML. Allow elements to be interleaved.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonews: mention removal of autogenerated macvtap names from migration XML
Laine Stump [Fri, 28 Aug 2020 17:40:40 +0000 (13:40 -0400)] 
news: mention removal of autogenerated macvtap names from migration XML

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Remove extraneous plus signs from virsh man page v6.7.0-rc2
Martin Kletzander [Fri, 28 Aug 2020 12:58:38 +0000 (14:58 +0200)] 
docs: Remove extraneous plus signs from virsh man page

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: mention bhyve sound support
Roman Bogorodskiy [Thu, 27 Aug 2020 14:07:48 +0000 (18:07 +0400)] 
news: mention bhyve sound support

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: Document improvements/bug fixes for upcoming release
Michal Privoznik [Fri, 28 Aug 2020 11:33:11 +0000 (13:33 +0200)] 
NEWS: Document improvements/bug fixes for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agonews: Document the `role` attribute for shmem device
Wang Xin [Fri, 21 Aug 2020 08:53:00 +0000 (16:53 +0800)] 
news: Document the `role` attribute for shmem device

Signed-off-by: Wang Xin <wangxinxin.wang@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 27 Aug 2020 08:44:15 +0000 (10:44 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10366 of 10366 strings)

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

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agoUpdate translation files
Weblate [Thu, 27 Aug 2020 08:44:11 +0000 (10:44 +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 (Polish)
Piotr Drąg [Thu, 27 Aug 2020 08:44:05 +0000 (10:44 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2447 of 10349 strings)

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

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
Translated using Weblate (Polish)

Currently translated at 23.6% (2447 of 10349 strings)

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

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Szymon Scholz [Thu, 27 Aug 2020 08:44:01 +0000 (10:44 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2445 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
Translated using Weblate (Polish)

Currently translated at 23.6% (2445 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Thu, 27 Aug 2020 08:43:58 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2445 of 10349 strings)

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

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Szymon Scholz [Thu, 27 Aug 2020 08:43:53 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2443 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
Translated using Weblate (Polish)

Currently translated at 23.6% (2443 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Thu, 27 Aug 2020 08:43:49 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2443 of 10349 strings)

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

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Szymon Scholz [Thu, 27 Aug 2020 08:43:44 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.5% (2437 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
4 years agodocs: add kbase entry for migrationinternals
Fangge Jin [Thu, 20 Aug 2020 10:09:24 +0000 (18:09 +0800)] 
docs: add kbase entry for migrationinternals

Commit c051e56d27 added migrationinternals.rst in kbase, but the
entry was missing.

Signed-off-by: Fangge Jin <fjin@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: formatdomain: fix `since` tag
Ján Tomko [Tue, 11 Aug 2020 23:05:03 +0000 (01:05 +0200)] 
docs: formatdomain: fix `since` tag

Fix the `since` tag for the disk target.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agomeson: don't install sysconf files unconditionally
Roman Bogorodskiy [Wed, 26 Aug 2020 13:47:14 +0000 (17:47 +0400)] 
meson: don't install sysconf files unconditionally

There's no need to install sysconf files when init script installation
was not requested, i.e. when configured with init_script=none.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: always disable ceph on 32-bit
Daniel P. Berrangé [Fri, 21 Aug 2020 11:29:02 +0000 (12:29 +0100)] 
rpm: always disable ceph on 32-bit

The logic to disable Ceph on 32-bit was protected by a Fedora
conditional. This is redundant as RHEL hasn't shipped any
32-bit platforms for years.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agopo: Refresh potfile for v6.7.0 v6.7.0-rc1
Jiri Denemark [Wed, 26 Aug 2020 09:18:25 +0000 (11:18 +0200)] 
po: Refresh potfile for v6.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoapparmor: allow libvirtd to call virtiofsd
Kevin Locke [Tue, 25 Aug 2020 13:31:27 +0000 (07:31 -0600)] 
apparmor: allow libvirtd to call virtiofsd

When using [virtiofs], libvirtd must launch [virtiofsd] to provide
filesystem access on the host.  When a guest is configured with
virtiofs, such as:

    <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs'/>
      <source dir='/path'/>
      <target dir='mount_tag'/>
    </filesystem>

Attempting to start the guest fails with:

    internal error: virtiofsd died unexpectedly

/var/log/libvirt/qemu/$name-fs0-virtiofsd.log contains (as a single
line, wrapped below):

    libvirt:  error : cannot execute binary /usr/lib/qemu/virtiofsd:
    Permission denied

dmesg contains (as a single line, wrapped below):

    audit: type=1400 audit(1598229295.959:73): apparmor="DENIED"
    operation="exec" profile="libvirtd" name="/usr/lib/qemu/virtiofsd"
    pid=46007 comm="rpc-worker" requested_mask="x" denied_mask="x"
    fsuid=0 ouid=0

To avoid this, allow execution of virtiofsd from the libvirtd AppArmor
profile.

[virtiofs]: https://libvirt.org/kbase/virtiofs.html
[virtiofsd]: https://www.qemu.org/docs/master/interop/virtiofsd.html

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agoutil: use host module suffix when loading drivers
Scott Shambarger [Tue, 25 Aug 2020 23:47:07 +0000 (16:47 -0700)] 
util: use host module suffix when loading drivers

Driver module loaders current hardcode ".so" as the file
extension.  On MacOS, meson uses ".dylib" as a module file extension.
This patch adds VIR_FILE_MODULE_EXT to virfile.h defined as the
hosts module extension, and updates driver module loaders to make
use of it.

Signed-off-by: Scott Shambarger <scott-libvirt@shambarger.net>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agodomaincapsmock: mock virHostCPUGetMicrocodeVersion()
Daniel Henrique Barboza [Mon, 24 Aug 2020 13:27:54 +0000 (10:27 -0300)] 
domaincapsmock: mock virHostCPUGetMicrocodeVersion()

Previous patch handled the runtime case where a non-x86 host is
fetching /proc/cpuinfo data for a microcode info that we know
it doesn't exist. This change alone speeded everything by a
bit for non-x86, but there is at least one major culprit left.

qemuxml2argvtest does several arch-specific tests, and a good
chunk of them are x86 exclusive. This means that 'hostArch'
will be seen as x86 for these tests, even when running in
non-x86 hosts. In a Power 9 server with 128 CPUs, qemuxml2argvtest
takes 298 seconds to complete in average, and 'perf record'
indicates that 95% of the time is spent in
virHostCPUGetMicrocodeVersion().

This patch mocks virHostCPUGetMicrocodeVersion() to always return
0 in the tests, avoiding /proc/cpuinfo reads. This will make all
tests behave arch-agnostic, and the microcode value being 0 has no
impact on any existing test.

This is a CI speed across the board for all archs, including x86,
given that we're not reading /proc/cpuinfo in the tests. For
a Thinkpad T480 laptop with 8 Intel i7 CPUs, qemuxml2argvtest
went from 15.50 sec to 12.50 seconds. The performance gain is even
more noticeable for huge servers with lots of CPUs. For the
Power 9 server mentioned above, this patch speeds qemuxml2argvtest
to 9 seconds, down from 298 sec.

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 agovirhostcpu.c: skip non x86 hosts in virHostCPUGetMicrocodeVersion()
Daniel Henrique Barboza [Mon, 24 Aug 2020 13:27:53 +0000 (10:27 -0300)] 
virhostcpu.c: skip non x86 hosts in virHostCPUGetMicrocodeVersion()

Non-x86 archs does not have a 'microcode' version like x86. This is
covered already inside the function - just return 0 if no microcode
is found. Regardless of that, a read of /proc/cpuinfo is always made.
Each read will invoke the kernel to fill in the CPU details every time.

Now let's consider a non-x86 host, like a Power 9 server with 128 CPUs.
Each /proc/cpuinfo read will need to fetch data for each CPU and it
won't even matter because we know beforehand that PowerPC chips don't
have microcode information.

We can do better for non-x86 hosts by skipping this process entirely.

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 agovirhostcpu.c: modernize virHostCPUGetMicrocodeVersion()
Daniel Henrique Barboza [Mon, 24 Aug 2020 13:27:52 +0000 (10:27 -0300)] 
virhostcpu.c: modernize virHostCPUGetMicrocodeVersion()

Use g_autofree and remove the cleanup label.

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 agobuild: add -Wdeclaration-after-statement
Ján Tomko [Mon, 27 Jul 2020 20:49:55 +0000 (22:49 +0200)] 
build: add -Wdeclaration-after-statement

Now that all the users have been converted or silenced,
let's enable this warning.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
Ján Tomko [Mon, 3 Aug 2020 15:32:22 +0000 (17:32 +0200)] 
tests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT

Some test rely too much on declaring variables in the middle
of the function. Use the macro to locally suppress the warning

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc: internal: add VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
Ján Tomko [Mon, 3 Aug 2020 15:31:32 +0000 (17:31 +0200)] 
src: internal: add VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT

Add a macro to suppress the warning.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoVIR_XPATH_NODE_AUTORESTORE: remove semicolon from users
Ján Tomko [Tue, 28 Jul 2020 19:47:48 +0000 (21:47 +0200)] 
VIR_XPATH_NODE_AUTORESTORE: remove semicolon from users

Since the macro no longer includes the 'ignore_value'
statement, stop putting another empty statement after it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE
Ján Tomko [Tue, 28 Jul 2020 19:47:29 +0000 (21:47 +0200)] 
util: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE

The VIR_XPATH_NODE_AUTORESTORE contains an ignore_value
statement to silence an unused variable warning on clang.

Use a pragma instead, which is not a statement.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: iscsitest: split out testISCSIScanTargetsTests
Ján Tomko [Tue, 28 Jul 2020 18:11:09 +0000 (20:11 +0200)] 
tests: iscsitest: split out testISCSIScanTargetsTests

The ScanTargets testing code declares some variables
in the middle of main.

Split it out into a separate function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: cgroup: wrap BACKEND_CALL macro in a block
Ján Tomko [Tue, 28 Jul 2020 18:08:07 +0000 (20:08 +0200)] 
util: cgroup: wrap BACKEND_CALL macro in a block

VIR_CGROUP_BACKEND_CALL is exclusively used at the end
of a function, but it declares a variable.

Wrap it in a do..while block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: authconfigtest: move declarations
Ján Tomko [Tue, 28 Jul 2020 18:11:01 +0000 (20:11 +0200)] 
tests: authconfigtest: move declarations

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: sockettest: move declarations
Ján Tomko [Tue, 28 Jul 2020 18:10:53 +0000 (20:10 +0200)] 
tests: sockettest: move declarations

Declare the structs: at the beginning of the block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virNetDevBridgeSet: split declarations
Ján Tomko [Tue, 28 Jul 2020 18:09:22 +0000 (20:09 +0200)] 
util: virNetDevBridgeSet: split declarations

Declare the variables at the beginning of the function,
then fill them up.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosecurity: move chardevData declaration
Ján Tomko [Tue, 28 Jul 2020 17:59:54 +0000 (19:59 +0200)] 
security: move chardevData declaration

Declare it at the beginning of the function
instead of right before use.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agorpc: move lock after declaration
Ján Tomko [Tue, 28 Jul 2020 18:00:03 +0000 (20:00 +0200)] 
rpc: move lock after declaration

virNetClientRemoveStream starts by calling a lock.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoMove debug statements after declarations
Ján Tomko [Mon, 3 Aug 2020 15:28:06 +0000 (17:28 +0200)] 
Move debug statements after declarations

Many of our functions start with a DEBUG statement.
Move the statements after declarations to appease
our coding style.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoSplit declarations from initializations
Ján Tomko [Tue, 28 Jul 2020 17:50:28 +0000 (19:50 +0200)] 
Split declarations from initializations

Split those initializations that depend on a statement
above them.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoMove declarations before statements
Ján Tomko [Mon, 3 Aug 2020 15:27:58 +0000 (17:27 +0200)] 
Move declarations before statements

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: move declarations in virStorageFileChainLookup
Ján Tomko [Tue, 28 Jul 2020 18:09:40 +0000 (20:09 +0200)] 
util: move declarations in virStorageFileChainLookup

Use g_autofree and move the declarations to the beginning
of the block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virHostMem*Parameters: split out non-Linux stubs
Ján Tomko [Mon, 3 Aug 2020 15:58:03 +0000 (17:58 +0200)] 
util: virHostMem*Parameters: split out non-Linux stubs

Repeat the whole function header instead of mixing #ifdefs
in the code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virHostMemSetParameters: remove pointless variable
Ján Tomko [Mon, 3 Aug 2020 15:56:25 +0000 (17:56 +0200)] 
util: virHostMemSetParameters: remove pointless variable

It is only used inside the condition.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virRandomInt: remove temporary variable
Ján Tomko [Tue, 28 Jul 2020 18:09:31 +0000 (20:09 +0200)] 
util: virRandomInt: remove temporary variable

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: Mention support for device model commandline passthrough in Xen
Jim Fehlig [Fri, 31 Jul 2020 15:53:01 +0000 (09:53 -0600)] 
news: Mention support for device model commandline passthrough in Xen

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoXen: Add support for qemu commandline passthrough to config converter
Jim Fehlig [Fri, 31 Jul 2020 15:39:25 +0000 (09:39 -0600)] 
Xen: Add support for qemu commandline passthrough to config converter

Support qemu commandline passthrough in the domXML to native config
converter. Add tests to check the conversion.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoXen: Add support for qemu command-line passthrough
Jim Fehlig [Thu, 30 Jul 2020 19:25:20 +0000 (13:25 -0600)] 
Xen: Add support for qemu command-line passthrough

Xen supports passing arbitrary arguments to the QEMU device model via
the 'extra' member of the public libxl_domain_build_info structure.
This patch adds a 'xen' namespace extension, similar to the QEMU and
bhyve drivers, to map arbitrary arguments to the 'extra' member. Only
passthrough of arguments is supported. Passthrough of environment
variables or capabilities adjustments is not supported.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS.rst: update with NVDIMM auto-alignment removal for pSeries
Daniel Henrique Barboza [Mon, 24 Aug 2020 17:57:37 +0000 (14:57 -0300)] 
NEWS.rst: update with NVDIMM auto-alignment removal for pSeries

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 agostorage_util: fix qemu-img sparse allocation
Pavel Hrdina [Tue, 25 Aug 2020 13:09:53 +0000 (15:09 +0200)] 
storage_util: fix qemu-img sparse allocation

Commit <c9ec7088c7a3f4cd26bb471f1f243931fff6f4f9> introduced a support
to fully allocate qcow2 images when <allocation> matches <capacity> but
it doesn't work as expected.

The issue is that info.size_arg is in KB but the info.allocation
introduced by the mentioned commit is in B. This results in using
"preallocation=falloc," in cases where "preallocation=metadata," should
be used.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirnetserver: fix some memory leaks in virNetTLSContextReloadForServer
Jin Yan [Thu, 13 Aug 2020 03:37:56 +0000 (11:37 +0800)] 
virnetserver: fix some memory leaks in virNetTLSContextReloadForServer

These leaks were introduced in commit 15d280fa97b0, use g_autofree for all
cert_path pointers.

Signed-off-by: Jin Yan <jinyan12@huawei.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: Mention IQN setting for iSCSI hostdevs
Peter Krempa [Mon, 24 Aug 2020 15:11:05 +0000 (17:11 +0200)] 
NEWS: Mention IQN setting for iSCSI hostdevs

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirsh: Add source-initiator opt to build the initiator of pool XML
Han Han [Tue, 25 Aug 2020 03:50:33 +0000 (11:50 +0800)] 
virsh: Add source-initiator opt to build the initiator of pool XML

For iscsi-direct pool, the initiator is necessary for pool defining:
<pool type="iscsi-direct">
 ...
    <initiator>
      <iqn name="iqn.2013-06.com.example:iscsi-initiator"/>
    </initiator>
...
</pool>

Add --source-initiator to fill the initiator iqn for
pool-create-as/pool-define-as subcommands.

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

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationCapsToJSON: Refactor capability object formatting
Peter Krempa [Mon, 24 Aug 2020 15:00:59 +0000 (17:00 +0200)] 
qemuMigrationCapsToJSON: Refactor capability object formatting

Use virJSONValueObjectCreate rather than creating the object
piece-by-piece and use new accessors for bitmap to simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agogitdm: add missing aliases
Pino Toscano [Mon, 24 Aug 2020 10:44:14 +0000 (12:44 +0200)] 
gitdm: add missing aliases

Consider a couple of misspelt emails in B-y tags.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agogitdm: move pld-linux.org to opensource
Pino Toscano [Mon, 24 Aug 2020 10:19:59 +0000 (12:19 +0200)] 
gitdm: move pld-linux.org to opensource

PLD Linux is a Linux distribution, so @pld-linux.org fits in the
opensource group with similar projects.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agodocs: formatdomain: document <audio> element
Roman Bogorodskiy [Fri, 7 Aug 2020 15:00:38 +0000 (19:00 +0400)] 
docs: formatdomain: document <audio> element

Document the new <audio> element which allows to specify
host audio backend for a guest <sound> device, and update
the <sound> element description with the new <audio>
sub-element which specifies the other end of the mapping.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: allow to specify host sound device
Roman Bogorodskiy [Sat, 18 Jul 2020 11:23:28 +0000 (15:23 +0400)] 
bhyve: allow to specify host sound device

Allow to map sound playback and recording devices to host devices
using "<audio type='oss'/>" OSS audio backend.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: allow to map sound device to host device
Roman Bogorodskiy [Sat, 18 Jul 2020 06:23:57 +0000 (10:23 +0400)] 
conf: allow to map sound device to host device

Introduce a new device element "<audio>" which allows
to map guest sound device specified using the "<sound>"
element to specific audio backend.

Example:

  <sound model='ich7'>
     <audio id='1'/>
  </sound>
  <audio id='1' type='oss'>
     <input dev='/dev/dsp0'/>
     <output dev='/dev/dsp0'/>
  </audio>

This block maps to OSS audio backend on the host using
/dev/dsp0 device for both input (recording)
and output (playback).

OSS is the only backend supported so far.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: implement sound device support
Roman Bogorodskiy [Tue, 14 Jul 2020 14:44:13 +0000 (18:44 +0400)] 
bhyve: implement sound device support

bhyve supports intel hda sound devices that could be specified
on the command like using "-1:0,hda,play=$play_dev,rec=$rec_dev",
where "1:0" is a PCI address, and "$play_dev" and "$rec_dev"
point to the playback and recording device on the host respectively.
Currently, schema of the 'sound' element doesn't allow specifying
neither playback nor recording devices, so for now hardcode
/dev/dsp0, which is the first audio device on the host.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: add 'ich7' sound model
Roman Bogorodskiy [Thu, 6 Aug 2020 14:40:37 +0000 (18:40 +0400)] 
conf: add 'ich7' sound model

Add 'ich7' sound model. This is a preparation for sound support in
bhyve, as 'ich7' is the only model it supports.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: properly clear out autogenerated macvtap names when formatting/parsing
Laine Stump [Sun, 23 Aug 2020 03:42:52 +0000 (23:42 -0400)] 
conf: properly clear out autogenerated macvtap names when formatting/parsing

Back when macvtap support was added in commit 315baab9443 in Feb. 2010
(libvirt-0.7.7), it was setup to autogenerate a name for the device if
one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"),
similar to the way an unspecified standard tap device name will lead
to an autogenerated "vnet%d".

As a matter of fact, in commit ca1b7cc8e45 added in May 2010, the code
was changed to *always* ignore a supplied device name for macvtap
interfaces by deleting *any* name immediately during the <interface>
parsing (this was intended to prevent one domain which had failed to
completely start from deleting the macvtap device of another domain
which had subsequently been provided the same device name (this will
seem mildly ironic later). This was later fixed to only clear the
device name when inactive XML was being parsed. HOWEVER - this was
only done if the xml was <interface type='direct'> - autogenerated
names were not cleared for <interface type='network'> (which could
also result in a macvtap device).

Although the names of "vnetX" tap devices had always been
automatically cleared when parsing <interface> (see commit d1304583d
from July 2008 (!)), at the time macvtap support was added, both vnetX
and macvtapX device names were always included when formatting the
XML.

Then in commit a8be259d0cc (July 2011, libvirt-0.9.4), <interface>
formatting was changed to also clear out "vnetX" device names during
XML formatting as well. However the same treatment wasn't given to
"macvtapX".

Now in 2020, there has been a report that a failed migration leads to
the macvtap device of some other unrelated guest on the destination
host losing its network connectivity. It was determined that this was
due to the domain XML in the migration containing a macvtap device
name, e.g. "macvtap0", that was already in use by the other guest on
the destination. Normally this wouldn't be a problem, because libvirt
would see that the device was already in use, and then find a
different unused name. But in this case, other external problems were
causing the migration to fail prior to selecting a macvtap device and
successfully opening it, and during error recovery, qemuProcessStop()
was called, which went through all def->nets objects and (if they were
macvtap) deleted the device specified in net->ifname; since libvirt
hadn't gotten to the point of replacing the incoming "macvtap0" with
the name of a device it actually created for this guest, that meant
that "macvtap0" was deleted, *even though it was currently in use by a
different guest*!

Whew!

So, it turns out that when formatting "migratable" XML, "vnetX"
devices are omitted, just as when formatting "inactive" XML. By making
the code in both interface parsing and formatting consistent for
"vnetX", "macvtapX", and "macvlanX", we can thus make sure that the
autogenerated (and unneeded / completely *not* wanted) macvtap device
name will not be sent with the migration XML. This way when a
migration fails, net->ifname will be NULL, and libvirt won't have any
device to try and (erroneously) delete.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: remove unreachable code in qemuProcessStart()
Laine Stump [Sat, 22 Aug 2020 21:43:24 +0000 (17:43 -0400)] 
qemu: remove unreachable code in qemuProcessStart()

Back when the original version of this chunk of code was added (commit
41b087198 in libvirt-0.8.1 in April 2010), we used virExecDaemonize()
to start the qemu process, and would continue on in the function
(which at that time was called qemudStartVMDaemon()) even if a -1 was
returned. So it was possible to get to this code with rv == -1 (it was
called "ret" in that version of the code).

In modern libvirt code, qemu is started with virCommandRun(); then we
call virPidFileReadPath(); those are the only two ways of setting "rv"
prior to this code being removed, and in either case if the new value
of rv < 0, then we immediately skip over the rest of the code to the
cleanup: label.

This means that the code being removed by this patch is
unreachable.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_namespace: Don't build namespace if domain doesn't have it enabled
Michal Privoznik [Fri, 21 Aug 2020 13:49:29 +0000 (15:49 +0200)] 
qemu_namespace: Don't build namespace if domain doesn't have it enabled

Even if namespaces are disabled, then due to a missing check at the
beginning of qemuDomainBuildNamespace(), the domain startup code
still tries to populate (nonexistent) domain's namespace.

Fixes: 8da362fe62766b4eee209cd3ce591ceb62299d13
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRevert "formatdomain.html.in: mention pSeries NVDIMM 'align down' mechanic"
Daniel Henrique Barboza [Mon, 24 Aug 2020 16:41:05 +0000 (18:41 +0200)] 
Revert "formatdomain.html.in: mention pSeries NVDIMM 'align down' mechanic"

We do not auto-align down pSeries NVDIMMs anymore.

This reverts commit 8f474ceea05aec349be19726e394a62e300efe77.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_domain.c: change qemuDomainMemoryDeviceAlignSize() return type
Daniel Henrique Barboza [Thu, 30 Jul 2020 19:48:03 +0000 (16:48 -0300)] 
qemu_domain.c: change qemuDomainMemoryDeviceAlignSize() return type

After the recent changes, this function is now always returning
zero. Turn it to 'void' to relieve callers from checking it.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_domain.c: do not auto-align ppc64 NVDIMMs
Daniel Henrique Barboza [Thu, 30 Jul 2020 19:48:02 +0000 (16:48 -0300)] 
qemu_domain.c: do not auto-align ppc64 NVDIMMs

We don't need the auto-alignment now that the user is handling
it by hand.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_validate.c: add pSeries NVDIMM size alignment validation
Daniel Henrique Barboza [Thu, 30 Jul 2020 19:48:01 +0000 (16:48 -0300)] 
qemu_validate.c: add pSeries NVDIMM size alignment validation

The existing auto-align behavior for pSeries has the idea to
alleviate user configuration of the NVDIMM size, given that the
alignment calculation is not trivial to do (256MiB alignment
of mem->size - mem->label_size value, a.k.a guest area). We
align mem->size down to avoid end of file problems.

The end result is not ideal though. We do not touch the domain
XML, meaning that the XML can report a NVDIMM size 255MiB smaller
than the actual size the guest is seeing. It also adds one more
thing to consider in case the guest is reporting less memory
than declared, since the auto-align is transparent to the
user.

Following Andrea's suggestion in [1], let's instead do an
size alignment validation. If the NVDIMM is unaligned, error out
and suggest a rounded up value. This can be bothersome to users,
but will bring consistency of NVDIMM size between the domain XML
and the guest.

This approach will force existing non-running pSeries guests to
readjust the NVDIMM value in their XMLs, if necessary. No changes
were made for x86 NVDIMM support.

[1] https://www.redhat.com/archives/libvir-list/2020-July/msg01471.html

Suggested-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu_domain.c: make qemuDomainGetMemorySizeAlignment() public
Daniel Henrique Barboza [Thu, 30 Jul 2020 19:48:00 +0000 (16:48 -0300)] 
qemu_domain.c: make qemuDomainGetMemorySizeAlignment() public

Next patch will use it outside of qemu_domain.c.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuDomainGetMemorySizeAlignment: Mark domain @def const
Michal Privoznik [Mon, 24 Aug 2020 16:29:44 +0000 (18:29 +0200)] 
qemuDomainGetMemorySizeAlignment: Mark domain @def const

This function is not changing the domain definition, it's only
reading from it. The function is going to be used from another
function which already takes const virDomainDef. Make the @def
const to avoid typecasting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
4 years agomanpages/virsh: A couple of small clarifications
Kashyap Chamarthy [Tue, 4 Aug 2020 14:04:03 +0000 (16:04 +0200)] 
manpages/virsh: A couple of small clarifications

Changes:

  - Update the descriptions of --current & --config flags.

    For --config, the reason to rephrase "next boot" to "next start"
    is: "Next boot may still imply somebody selecting "reboot" in the
    guest OS and fully expecting the changes to be applied."  (per Peter
    Krempa)

    For --current, existing documentation says:

      "If *--current* is specified, affect the current guest state."

    It's not entirely clear what states can "current" mean or imply.  So
    rephrase it in context of the other two related flags --live and
    --config.

  - While at it, I also took the liberty to replace the few occurrences
    of "peristent domain[s]" with "persistent guest[s]"

Fix all occurrences (i.e. as many as I could spot) of this.

(Thanks: Dan Berrangé on IRC.)

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Move virQEMUFileOpenAs to qemu_domain.c
Peter Krempa [Mon, 24 Aug 2020 15:38:05 +0000 (17:38 +0200)] 
qemu: Move virQEMUFileOpenAs to qemu_domain.c

Commit 43620689794507308fbd3def6992a68ee2f8fa97 moved the function to
util/virqemu.c which is compiled also on win32 and geteuid()/getegid()
doesn't exist there.

Move it to qemu_domain.c which is compiled only when the qemu driver is
enabled. Originally I didn't want to put it here as qemu_domain.c is a
code dump for helper functions but this is the least invasive fix.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemucapabilitiesdata: Add test data for x86_64 for the qemu-5.2 dev cycle
Peter Krempa [Mon, 24 Aug 2020 12:22:20 +0000 (14:22 +0200)] 
qemucapabilitiesdata: Add test data for x86_64 for the qemu-5.2 dev cycle

The machine types for this cycle were already added and qemu also added
a property for the machine type object called "default-ram-id".

Also "block-bitmap-mapping" is supported as a migration parameter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: qemucapabilities: Update data for qemu-v5.1.0 release
Peter Krempa [Mon, 24 Aug 2020 12:14:48 +0000 (14:14 +0200)] 
tests: qemucapabilities: Update data for qemu-v5.1.0 release

qemu-v5.1.0 is released now. There weren't any noticable changes since
our last update to 'rc2'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemumigparamstest: Validate output parameters against QMP schema
Peter Krempa [Fri, 7 Aug 2020 14:02:03 +0000 (16:02 +0200)] 
qemumigparamstest: Validate output parameters against QMP schema

Ensure that the migration parameters are formatted properly according to
the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Extract snapshot related code to a separate file
Peter Krempa [Wed, 15 Jul 2020 13:50:14 +0000 (15:50 +0200)] 
qemu: Extract snapshot related code to a separate file

We've dumped all the snapshot helpers and related code into
qemu_driver.c. It accounted for ~10% of overal size of qemu_driver.c.

Separate the code to qemu_snapshot.c/h.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Split of code related to handling of the save image file
Peter Krempa [Thu, 16 Jul 2020 07:54:56 +0000 (09:54 +0200)] 
qemu: Split of code related to handling of the save image file

There's a lot of helper code related to the save image handling. Extract
it to qemu_saveimage.c/h.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuFileWrapperFDClose: move to qemu_domain.c
Peter Krempa [Thu, 16 Jul 2020 09:40:34 +0000 (11:40 +0200)] 
qemuFileWrapperFDClose: move to qemu_domain.c

Move the code to qemu_domain.c so that it can be reused in other parts
of the qemu driver. 'qemu_domain' was chosen as we check the domain
state after closing the wrapper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuOpenFile: Move to qemu_domain.c
Peter Krempa [Thu, 16 Jul 2020 09:17:47 +0000 (11:17 +0200)] 
qemuOpenFile: Move to qemu_domain.c

Move the code to qemu_domain.c so that it can be reused in other parts
of the qemu driver. 'qemu_domain' was chosen as the permissions are
based on the domain configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuOpenFileAs: Move into util/virqemu.c
Peter Krempa [Thu, 16 Jul 2020 08:51:21 +0000 (10:51 +0200)] 
qemuOpenFileAs: Move into util/virqemu.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationCapsCheck: Refactor variable cleanup
Peter Krempa [Wed, 19 Aug 2020 11:20:13 +0000 (13:20 +0200)] 
qemuMigrationCapsCheck: Refactor variable cleanup

Use automatic memory allocation to simplify the code and remove the need
for a 'cleanup:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationParamsParse: Refactor variable cleanup
Peter Krempa [Wed, 19 Aug 2020 11:20:13 +0000 (13:20 +0200)] 
qemuMigrationParamsParse: Refactor variable cleanup

Use automatic memory allocation and move variables into correct scope to
simplify the code and remove the need for a 'cleanup:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationCapsToJSON: Refactor variable cleanup
Peter Krempa [Wed, 19 Aug 2020 11:20:13 +0000 (13:20 +0200)] 
qemuMigrationCapsToJSON: Refactor variable cleanup

Use automatic memory allocation and move variables into correct scope to
simplify the code and remove the need for a 'error:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationParamsToJSON: Refactor variable cleanup
Peter Krempa [Wed, 19 Aug 2020 11:18:31 +0000 (13:18 +0200)] 
qemuMigrationParamsToJSON: Refactor variable cleanup

Use automatic memory allocation and move variables into correct scope to
simplify the code and remove the need for a 'error:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationParamsFromJSON: Unify return value handling with other functions
Peter Krempa [Wed, 19 Aug 2020 11:17:06 +0000 (13:17 +0200)] 
qemuMigrationParamsFromJSON: Unify return value handling with other functions

This function doesn't have an overly verbose cleanup section as there
isn't any error code path. Unify it with the rest of the functions which
will simplify adding a possible error path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationParamsFromFlags: Use 'g_autoptr' to remove 'error:' label
Peter Krempa [Wed, 19 Aug 2020 11:15:35 +0000 (13:15 +0200)] 
qemuMigrationParamsFromFlags: Use 'g_autoptr' to remove 'error:' label

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuMigrationParamsNew: Use new memory allocation to simplify code
Peter Krempa [Wed, 19 Aug 2020 11:13:29 +0000 (13:13 +0200)] 
qemuMigrationParamsNew: Use new memory allocation to simplify code

Use automatic memory cleaning and allocate via g_new0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonews: Document sparse streams for block devices
Michal Privoznik [Fri, 3 Jul 2020 15:16:31 +0000 (17:16 +0200)] 
news: Document sparse streams for block devices

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirfdstream: Emulate skip for block devices
Michal Privoznik [Wed, 1 Jul 2020 19:39:40 +0000 (21:39 +0200)] 
virfdstream: Emulate skip for block devices

This is similar to one of previous patches.

When receiving stream (on virStorageVolUpload() and subsequent
virStreamSparseSendAll()) we may receive a hole. If the volume we
are saving the incoming data into is a regular file we just
lseek() and ftruncate() to create the hole. But this won't work
if the file is a block device. If that is the case we must write
zeroes so that any subsequent reader reads nothing just zeroes
(just like they would from a hole in a regular file).

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirshStreamInData: Handle block devices
Michal Privoznik [Thu, 2 Jul 2020 13:51:20 +0000 (15:51 +0200)] 
virshStreamInData: Handle block devices

This is very similar to previous commit.

The virshStreamInData() callback is used by virStreamSparseSendAll()
to detect whether the file the data is read from is in data or hole
section. The SendAll() will then send corresponding type of virStream
message to make server create a hole or write actual data. But the
callback uses virFileInData() even for block devices, which results in
an error. Just like in previous commit, emulate a DATA section
for block devices.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852528

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirfdstream: Allow sparse stream vol-download
Michal Privoznik [Thu, 2 Jul 2020 13:43:00 +0000 (15:43 +0200)] 
virfdstream: Allow sparse stream vol-download

When handling sparse stream, a thread is executed. This thread
runs a read() or write() loop (depending what API is called; in
this case it's virStorageVolDownload() and  this the thread run
read() loop). The read() is handled in virFDStreamThreadDoRead()
which is then data/hole section aware, meaning it uses
virFileInData() to detect data and hole sections and sends
TYPE_DATA or TYPE_HOLE virStream messages accordingly.

However, virFileInData() does not work with block devices. Simply
because block devices don't have data and hole sections. What we
can do though, is to mimic being always in a DATA section.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852528

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirshStreamSkip: Emulate skip for block devices
Michal Privoznik [Thu, 2 Jul 2020 13:49:33 +0000 (15:49 +0200)] 
virshStreamSkip: Emulate skip for block devices

This callback is called when the server sends us STREAM_HOLE
meaning there is no real data, only zeroes. For regular files
we would just seek() beyond EOF and ftruncate() to create the
hole. But for block devices this won't work. Not only we can't
seek() beyond EOF, and ftruncate() will fail, this approach won't
fill the device with zeroes. We have to do it manually.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852528

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh: Track if vol-upload or vol-download work over a block device
Michal Privoznik [Thu, 2 Jul 2020 06:51:20 +0000 (08:51 +0200)] 
virsh: Track if vol-upload or vol-download work over a block device

We can't use virFileInData() with block devices, but we can
emulate being in data section all the time (vol-upload case).
Alternatively, we can't just lseek() beyond EOF with block
devices to create a hole, we will have to write zeroes
(vol-download case).  But to decide we need to know if the FD we
are reading data from / writing data to is a block device. Store
this information in _virshStreamCallbackData.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh: Pass virshStreamCallbackDataPtr to virshStreamSink() and virshStreamSkip()
Michal Privoznik [Thu, 2 Jul 2020 06:42:44 +0000 (08:42 +0200)] 
virsh: Pass virshStreamCallbackDataPtr to virshStreamSink() and virshStreamSkip()

These callback will need to know more that the FD they are
working on. Pass the structure that is passed to other stream
callbacks (e.g. virshStreamSource() or virshStreamSourceSkip())
instead of inventing a new one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agolibvirt-storage: Document volume upload/download stream format
Michal Privoznik [Wed, 1 Jul 2020 11:47:04 +0000 (13:47 +0200)] 
libvirt-storage: Document volume upload/download stream format

For libvirt, the volume is just a binary blob and it doesn't
interpret data on volume upload/download. But as it turns out,
this unspoken assumption is not clear to our users. Document it
explicitly.

Suggested in: https://bugzilla.redhat.com/show_bug.cgi?id=1851023#c17

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemumonitorjsontest: Add a last-resort warning if object-add/device_add are QAPIfied
Peter Krempa [Thu, 6 Aug 2020 17:45:24 +0000 (19:45 +0200)] 
qemumonitorjsontest: Add a last-resort warning if object-add/device_add are QAPIfied

When netdev-add was qapified it took us by surprise and we had to
scramble to fix the internals to format conformant monitor arguments.

Add a last-resort early warning system if this happens to object-add or
device_add. Hopefully qemu developers notify us sooner than this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agotestutilsqemuschema: Add template checker for schema entries
Peter Krempa [Thu, 6 Aug 2020 17:43:51 +0000 (19:43 +0200)] 
testutilsqemuschema: Add template checker for schema entries

We'll need to match that a certain part of the qemu schema hasn't grown
new properties unexpectedly. Add a helper which matches an 'object' QMP
schema entry against a template and reports errors if expected types
don't match or new entries are added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agomeson: Improve RPATH handling
Andrea Bolognani [Wed, 19 Aug 2020 09:15:35 +0000 (11:15 +0200)] 
meson: Improve RPATH handling

Right now we're unconditionally adding RPATH information to the
installed binaries and libraries, but that's not always desired.

autotools seem to be smart enough to only include that information
when targeting a non-standard prefix, so most distro packages
don't actually contain it; moreover, both Debian and Fedora have
wiki pages encouraging packagers to avoid setting RPATH:

  https://wiki.debian.org/RpathIssue
  https://fedoraproject.org/wiki/RPath_Packaging_Draft

Implement RPATH logic that Does The Right Thing™ in the most
common cases, while still offering users the ability to override
the default behavior if they have specific needs.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoABOUT-NLS: Drop symlink
Andrea Bolognani [Mon, 24 Aug 2020 07:52:43 +0000 (09:52 +0200)] 
ABOUT-NLS: Drop symlink

The ABOUT-NLS symlink pointing to po/README.rst is a leftover
from when we were using autotools as the build system, and now
that we're using Meson we can drop it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>