]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoQEMU: declare qemu capabilities for the Virtio Free page reporting feature
Nico Pache [Mon, 12 Oct 2020 23:35:37 +0000 (19:35 -0400)] 
QEMU: declare qemu capabilities for the Virtio Free page reporting feature

This patch will introduce the free-page-reporting feature capabilities
that are in qemu 5.1

Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoDocument and parser support for the Virtio free page reporting feature.
Nico Pache [Mon, 12 Oct 2020 23:35:36 +0000 (19:35 -0400)] 
Document and parser support for the Virtio free page reporting feature.

This will add the proper documentation and parser support for the free page
reporting feature that is introduced in QEMU 5.1.

Signed-off-by: Nico Pache <npache@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Set noqueue qdisc for TAP devices
Michal Privoznik [Thu, 8 Oct 2020 14:22:50 +0000 (16:22 +0200)] 
qemu: Set noqueue qdisc for TAP devices

By default, pfifo_fast queueing discipline (qdisc) is set on
newly created interfaces (including TAPs). This qdisc has three
queues and packets that want to be sent through given NIC are
placed into one of the queues based on TOS field. Queues are then
emptied based on their priority allowing interactive sessions
stay interactive whilst something else is downloading a large
file.

Obviously, this means that kernel has to be involved and some
locking has to happen (when placing packets into queues). If
virtualization is taken into account then the above algorithm
happens twice - once in the guest and the second time in the
host.

This is arguably not optimal as it burns host CPU cycles
needlessly. Guest already made it choice and sent packets in the
order it wants.

To resolve this, Linux kernel offers 'noqueue' qdisc which can be
applied on virtual interfaces and in fact for 'lo' it is by
default:

  lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue

Set it for other TAP devices we create for domains too. With this
change I was able to squeeze 1Mbps more from a macvtap attached
to a guest and to my 1Gbps LAN (as measured by iperf3).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329644
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirnetdev: Introduce virNetDevSetRootQDisc()
Michal Privoznik [Thu, 8 Oct 2020 12:37:54 +0000 (14:37 +0200)] 
virnetdev: Introduce virNetDevSetRootQDisc()

This helper changes the root qdisc on given interface.
Ideally, it would be written using netlink but my attempts to
write the code were not successful and thus I've fallen back to
virCommand() + tc.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agorpm: remove rpath from rpms
Daniel Letai [Tue, 13 Oct 2020 10:11:49 +0000 (11:11 +0100)] 
rpm: remove rpath from rpms

The rpath improvements in:

  commit 69980ab798e240923ef12f86a92665b6c9ff7292
  Author: Andrea Bolognani <abologna@redhat.com>
  Date:   Wed Aug 19 11:15:35 2020 +0200

    meson: Improve RPATH handling

missed that Fedora's %meson macro sets --auto-features=enabled, thus
force enabling rpath in the RPM build. Thus we need to explicitly
disable it

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel Letai <dani@letai.org.il>
4 years agologging: allow max_len=0 to disable log rollover
Daniel P. Berrangé [Tue, 13 Oct 2020 09:20:19 +0000 (10:20 +0100)] 
logging: allow max_len=0 to disable log rollover

Currently setting max_len=0 causes virtlogd to spin in a busy loop. It
is natural to allow this to disable log rollover which can be useful for
developers debugging things.

Note disabling rollover exposes the host to denial of service from a
malicious guest, so must be used with care.

Closes https://gitlab.com/libvirt/libvirt/-/issues/85
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: virsecretobj: fix g_new0 allocation
Pavel Hrdina [Mon, 12 Oct 2020 17:54:36 +0000 (19:54 +0200)] 
conf: virsecretobj: fix g_new0 allocation

Fixes commit <d5b05614dfbc9bd60ea1a31a9cc32aaf3c771ddc> which changed
allocation from VIR_ALLOC_N to g_new0 but missed one +1 on number of
allocated elements.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoconf: fix g_new0 allocation
Pavel Hrdina [Mon, 12 Oct 2020 17:45:37 +0000 (19:45 +0200)] 
conf: fix g_new0 allocation

Fixes commit <a5d88ffe0ad9b5d5314ab0058c5b363f9f79b8ee> which changed
allocation from VIR_ALLOC_N to g_new0 but missed some +1 on number of
allocated elements.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu: migration: don't open storage driver too early
Cole Robinson [Wed, 7 Oct 2020 19:20:30 +0000 (15:20 -0400)] 
qemu: migration: don't open storage driver too early

If storage migration is requested, and the destination storage does
not exist on the remote host, qemu's migration support will call
into the libvirt storage driver to precreate the destination storage.

The storage driver virConnectPtr is opened too early though, adding
an unnecessary dependency on the storage driver for several cases
that don't require it. This currently requires kubevirt to install
the storage driver even though they aren't actually using it.

Push the virGetConnectStorage calls to right before the cases they are
actually needed.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
4 years agonews: document bhyve virtio-9p support
Roman Bogorodskiy [Sat, 10 Oct 2020 04:11:33 +0000 (08:11 +0400)] 
news: document bhyve virtio-9p support

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: bhyve: document virtio-9p support
Roman Bogorodskiy [Sat, 10 Oct 2020 04:11:08 +0000 (08:11 +0400)] 
docs: bhyve: document virtio-9p support

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agobhyve: fix virtio-9p src/dst order
Roman Bogorodskiy [Sat, 10 Oct 2020 04:08:07 +0000 (08:08 +0400)] 
bhyve: fix virtio-9p src/dst order

For the virtio-9p bhyve command line argument, the proper order
is mount_tag=/path/to/host/dir, not the opposite.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsocketaddr: Zero @netmask in virSocketAddrPrefixToNetmask()
Michal Privoznik [Fri, 9 Oct 2020 14:16:58 +0000 (16:16 +0200)] 
virsocketaddr: Zero @netmask in virSocketAddrPrefixToNetmask()

The aim of virSocketAddrPrefixToNetmask() is to initialize passed
virSocketAddr structure based on prefix length and family.
However, it doesn't set all members in the struct which may lead
to reads of uninitialized values:

==15421== Use of uninitialised value of size 8
==15421==    at 0x50F297A: _itoa_word (in /lib64/libc-2.31.so)
==15421==    by 0x510C8FE: __vfprintf_internal (in /lib64/libc-2.31.so)
==15421==    by 0x5120295: __vsnprintf_internal (in /lib64/libc-2.31.so)
==15421==    by 0x50F8969: snprintf (in /lib64/libc-2.31.so)
==15421==    by 0x51BB602: getnameinfo (in /lib64/libc-2.31.so)
==15421==    by 0x496DEE0: virSocketAddrFormatFull (virsocketaddr.c:486)
==15421==    by 0x496DD9F: virSocketAddrFormat (virsocketaddr.c:444)
==15421==    by 0x11871F: networkDnsmasqConfContents (bridge_driver.c:1404)
==15421==    by 0x1118F5: testCompareXMLToConfFiles (networkxml2conftest.c:48)
==15421==    by 0x111BAF: testCompareXMLToConfHelper (networkxml2conftest.c:112)
==15421==    by 0x112679: virTestRun (testutils.c:142)
==15421==    by 0x111D09: mymain (networkxml2conftest.c:144)
==15421==  Uninitialised value was created by a stack allocation
==15421==    at 0x1175D2: networkDnsmasqConfContents (bridge_driver.c:1056)

All callers expect the function to initialize the structure
fully.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agobhyve: implement virtio-9p support
Roman Bogorodskiy [Wed, 7 Oct 2020 16:07:04 +0000 (20:07 +0400)] 
bhyve: implement virtio-9p support

Recently virtio-9p support was added to bhyve.

On the host side it looks this way:

  bhyve .... -s 25:0,virtio-9p,sharename=/path/to/shared/dir

It could also have ",ro" suffix to make share read-only.

In the Linux guest, this share is mounted with:

  mount -t 9p sharename /mnt/sharename

In the guest user will see the same permissions and ownership
information for this directory as on the host. No uid/gid remapping is
supported, so those could resolve to wrong user or group names.

The same applies to the other side: chowning/chmodding in the guest will
set specified ownership and permissions on the host.

In libvirt domain XML it's modeled using the 'filesystem' element:

  <filesystem type='mount'>
    <source dir='/path/to/shared/dir'/>
    <target dir='sharename'/>
  </filesystem>

Optional 'readonly' sub-element enables read-only mode.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotools: use g_autoptr for virCgroup
Pavel Hrdina [Tue, 22 Sep 2020 10:52:38 +0000 (12:52 +0200)] 
tools: use g_autoptr for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agotests: use g_autoptr for virCgroup
Pavel Hrdina [Tue, 22 Sep 2020 10:52:26 +0000 (12:52 +0200)] 
tests: use g_autoptr for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoutil: use g_autoptr for virCgroup
Pavel Hrdina [Fri, 9 Oct 2020 14:09:46 +0000 (16:09 +0200)] 
util: use g_autoptr for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoqemu: use g_autoptr for virCgroup
Pavel Hrdina [Fri, 9 Oct 2020 14:01:07 +0000 (16:01 +0200)] 
qemu: use g_autoptr for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agolxc: use g_autoptr for virCgroup
Pavel Hrdina [Tue, 22 Sep 2020 10:49:58 +0000 (12:49 +0200)] 
lxc: use g_autoptr for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agolibvirt-lxc: use g_autoptr for virCgroup
Pavel Hrdina [Tue, 22 Sep 2020 10:49:33 +0000 (12:49 +0200)] 
libvirt-lxc: use g_autoptr for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoutil: vircgroup: introduce g_autoptr() for virCgroup
Pavel Hrdina [Tue, 22 Sep 2020 09:33:19 +0000 (11:33 +0200)] 
util: vircgroup: introduce g_autoptr() for virCgroup

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoutil: vircgroup: change virCgroupFree to take only virCgroupPtr
Pavel Hrdina [Tue, 22 Sep 2020 12:07:27 +0000 (14:07 +0200)] 
util: vircgroup: change virCgroupFree to take only virCgroupPtr

As preparation for g_autoptr() we need to change the function to take
only virCgroupPtr.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoutil: vircgroup: use GLib alloc functions
Pavel Hrdina [Tue, 22 Sep 2020 09:18:51 +0000 (11:18 +0200)] 
util: vircgroup: use GLib alloc functions

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoqemu_cgroup: introduce qemuRestoreCgroupThread helper
Pavel Hrdina [Tue, 22 Sep 2020 12:05:50 +0000 (14:05 +0200)] 
qemu_cgroup: introduce qemuRestoreCgroupThread helper

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agodoc: Fix element name in description of "feature"
Tim Wiederhake [Fri, 9 Oct 2020 10:47:20 +0000 (12:47 +0200)] 
doc: Fix element name in description of "feature"

Actual change is "s/``elements``/``feature`` elements/", rest is
reflow.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agodocs: Remove references to "cpu_map.xml" in the documentation
Tim Wiederhake [Fri, 9 Oct 2020 10:47:19 +0000 (12:47 +0200)] 
docs: Remove references to "cpu_map.xml" in the documentation

"cpu_map.xml" was moved to a directory "cpu_map" and split up into
several files.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemu: Remove references to "cpu_map.xml" in the code
Tim Wiederhake [Fri, 9 Oct 2020 10:47:18 +0000 (12:47 +0200)] 
qemu: Remove references to "cpu_map.xml" in the code

"cpu_map.xml" was moved to a directory "cpu_map" and split up into
several files.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agotests: Remove references to "cpu_map.xml" in the code
Tim Wiederhake [Fri, 9 Oct 2020 10:47:17 +0000 (12:47 +0200)] 
tests: Remove references to "cpu_map.xml" in the code

"cpu_map.xml" was moved to a directory "cpu_map" and split up into
several files.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agospec: Introduce arches_*
Andrea Bolognani [Mon, 5 Oct 2020 16:05:35 +0000 (18:05 +0200)] 
spec: Introduce arches_*

With this commit, all architecture lists that we base feature
enablement decisions on are defined within a few lines of each
other, increasing maintainability.

Additionally, generic architecture lists that appear in the
conditions for multiple features are defined, so that repetition
is reduced.

Note that a few checks (numactl, zfs, ceph) have been changed
from %ifarch to %ifnarch for consistency: while doing so, the
corresponding list of architectures has also been replaced with
the complement of the original one to ensure the overall behavior
would be preserved.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: Refactor qemu_kvm_arches definition
Andrea Bolognani [Mon, 5 Oct 2020 16:56:50 +0000 (18:56 +0200)] 
spec: Refactor qemu_kvm_arches definition

There's no need to set a default for it if we're going to override
it immediately afterwards anyway, and setting with_qemu_tcg at the
same time only makes things more confusing.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: Drop s390 architecture from conditionals
Andrea Bolognani [Mon, 5 Oct 2020 17:10:12 +0000 (19:10 +0200)] 
spec: Drop s390 architecture from conditionals

Neither Fedora nor RHEL build packages on this architecture.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
4 years agospec: Move _vpath_builddir definition
Andrea Bolognani [Mon, 5 Oct 2020 16:54:29 +0000 (18:54 +0200)] 
spec: Move _vpath_builddir definition

It belongs before package-specific feature flags are defined.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: Introduce with_dmidecode
Andrea Bolognani [Mon, 5 Oct 2020 16:43:32 +0000 (18:43 +0200)] 
spec: Introduce with_dmidecode

To keep things maintainable, we want to have architecture handling
all in one spot instead of sprinkling %ifarch conditionals all over
the place.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: Move with_numactl definition
Andrea Bolognani [Mon, 5 Oct 2020 16:40:22 +0000 (18:40 +0200)] 
spec: Move with_numactl definition

Keep it close to similar ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: bash completion actually defaults to on
Andrea Bolognani [Mon, 5 Oct 2020 16:30:22 +0000 (18:30 +0200)] 
spec: bash completion actually defaults to on

Remove the red herring.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: firewalld is always enabled
Andrea Bolognani [Mon, 5 Oct 2020 16:31:37 +0000 (18:31 +0200)] 
spec: firewalld is always enabled

Knowing this, we can remove some code.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agospec: Simplify setting features off by default
Andrea Bolognani [Mon, 5 Oct 2020 16:28:26 +0000 (18:28 +0200)] 
spec: Simplify setting features off by default

The right-hand side of these expressions will always evaluate to
zero. Stop obfuscating this fact.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agomeson: add tests build option to enable/disable unit tests
Pavel Hrdina [Thu, 8 Oct 2020 12:46:03 +0000 (14:46 +0200)] 
meson: add tests build option to enable/disable unit tests

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: add docs option to enable/disable generating documentation
Pavel Hrdina [Thu, 8 Oct 2020 12:39:38 +0000 (14:39 +0200)] 
meson: add docs option to enable/disable generating documentation

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: move build feature options to miscellaneous summary
Pavel Hrdina [Thu, 8 Oct 2020 12:10:46 +0000 (14:10 +0200)] 
meson: move build feature options to miscellaneous summary

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: remove required libraries from summary
Pavel Hrdina [Thu, 8 Oct 2020 12:05:45 +0000 (14:05 +0200)] 
meson: remove required libraries from summary

These are always enabled so it doesn't make any sense to have the result
in summary as meson will fail if they are missing.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: add missing libraries to summary
Pavel Hrdina [Thu, 8 Oct 2020 11:51:43 +0000 (13:51 +0200)] 
meson: add missing libraries to summary

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: prefix kvm_dep, m_dep and util_dep with lib
Pavel Hrdina [Thu, 8 Oct 2020 11:51:00 +0000 (13:51 +0200)] 
meson: prefix kvm_dep, m_dep and util_dep with lib

We don't use the lib prefix for all libraries but in these cases it
makes sense to use the prefix.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: add libnl build option
Pavel Hrdina [Thu, 8 Oct 2020 11:01:29 +0000 (13:01 +0200)] 
meson: add libnl build option

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: build nodedev driver only if libvirtd is compiled
Pavel Hrdina [Thu, 8 Oct 2020 10:46:11 +0000 (12:46 +0200)] 
meson: build nodedev driver only if libvirtd is compiled

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: properly handle readline if it's explicitly disabled
Pavel Hrdina [Thu, 8 Oct 2020 11:24:55 +0000 (13:24 +0200)] 
meson: properly handle readline if it's explicitly disabled

If readline is detected using pkg-config it would ignore the readline
option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: properly handle libpcap if it's explicitly disabled
Pavel Hrdina [Thu, 8 Oct 2020 11:09:45 +0000 (13:09 +0200)] 
meson: properly handle libpcap if it's explicitly disabled

If libpcap is detected using pkg-config it would ignore the libpcap
option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson: no need to call meson.get_compiler() again
Pavel Hrdina [Thu, 8 Oct 2020 11:49:47 +0000 (13:49 +0200)] 
meson: no need to call meson.get_compiler() again

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson_options: move firewalld options to build feature options
Pavel Hrdina [Thu, 8 Oct 2020 12:10:07 +0000 (14:10 +0200)] 
meson_options: move firewalld options to build feature options

These options don't check for any external libraries, they only enable
libvirt features.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson_options: change VirtualBox default from enabled to auto
Pavel Hrdina [Thu, 8 Oct 2020 12:23:52 +0000 (14:23 +0200)] 
meson_options: change VirtualBox default from enabled to auto

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agomeson_options: change VMware default from enabled to auto
Pavel Hrdina [Thu, 8 Oct 2020 10:55:30 +0000 (12:55 +0200)] 
meson_options: change VMware default from enabled to auto

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoremote: remove leftover goto
Ján Tomko [Fri, 9 Oct 2020 11:03:23 +0000 (13:03 +0200)] 
remote: remove leftover goto

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reported-by: John Ferlan <jferlan@redhat.com>
Fixes: 8487595bee0c04e56b0d8e866c5c71318faf1689
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu.conf: Re-word the description for *_tls_x509_verify
Fangge Jin [Fri, 21 Aug 2020 10:59:01 +0000 (18:59 +0800)] 
qemu.conf: Re-word the description for *_tls_x509_verify

The original descirption for *_tls_x509_verify is a little misleading
by saying that "Enabling this option will reject any client who does
not have a ca-cert.pem certificate".

Signed-off-by: Fangge Jin <fjin@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoci: Start building RPMs
Andrea Bolognani [Thu, 8 Oct 2020 13:36:07 +0000 (15:36 +0200)] 
ci: Start building RPMs

We lost this coverage during the move from CentOS CI to GitLab CI,
and it's high time we brought it back.

Building RPMs is currently skipped for

  * openSUSE, which is not supported by our spec file;

  * clang builds, where rpmbuild fails with

    meson.build:1:0: ERROR: Unable to determine dynamic linker

  * targets where we install Meson from PyPi, because that doesn't
    bring in the necessary RPM macros.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoci: Allow skipping dist
Andrea Bolognani [Thu, 8 Oct 2020 13:30:50 +0000 (15:30 +0200)] 
ci: Allow skipping dist

Instead of having an ad-hoc build script for CentOS 7, follow the
pattern established in other repositories under the libvirt group
and allow selectively disabling that specific part of the build.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoci: Refresh Dockerfiles
Andrea Bolognani [Thu, 8 Oct 2020 13:26:12 +0000 (15:26 +0200)] 
ci: Refresh Dockerfiles

The corresponding lcitool change is

  https://gitlab.com/libvirt/libvirt-ci/-/commit/00d736ea991e4a5b2f1a8f9a793f2358f4637fd3

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: remove openwsman.h
Matt Coleman [Fri, 9 Oct 2020 07:46:09 +0000 (03:46 -0400)] 
hyperv: remove openwsman.h

This header's main purpose was to work around bugs in older versions of
openwsman. Most of the files using it only needed wsman-api.h, which
they now include directly.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: bump minimum openwsman version to 2.6.3
Matt Coleman [Fri, 9 Oct 2020 07:46:08 +0000 (03:46 -0400)] 
hyperv: bump minimum openwsman version to 2.6.3

Bug fixes and comments specific to older versions have been removed.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: document new Hyper-V features and bug fixes
Matt Coleman [Mon, 5 Oct 2020 16:20:15 +0000 (12:20 -0400)] 
news: document new Hyper-V features and bug fixes

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement domainGetAutostart
Matt Coleman [Mon, 5 Oct 2020 16:20:14 +0000 (12:20 -0400)] 
hyperv: implement domainGetAutostart

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement connectGetVersion
Matt Coleman [Mon, 5 Oct 2020 16:20:13 +0000 (12:20 -0400)] 
hyperv: implement connectGetVersion

Hyper-V version numbers are not compatible with the encoding in
virParseVersionString():
https://gitlab.com/libvirt/libvirt/-/blob/master/src/util/virutil.c#L246

For example, the Windows Server 2016 Hyper-V version is 10.0.14393: its
micro is over 14 times larger than the encoding allows.

This commit repacks the Hyper-V version number in order to preserve all
of the digits. The major and minor are concatenated (with minor zero-
padded to two digits) to form the repacked major value. This works
because Microsoft's major and minor versions numbers are unlikely to
exceed 99. The repacked minor value is derived from the digits in the
thousands, ten-thousands, and hundred-thousands places of Hyper-V's
micro. The repacked micro is derived from the digits in the ones, tens,
and hundreds places of Hyper-V's micro.

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: fix Win32_OperatingSystem WMI queries
Matt Coleman [Mon, 5 Oct 2020 16:20:12 +0000 (12:20 -0400)] 
hyperv: fix Win32_OperatingSystem WMI queries

CurrentTimeZone's type is a signed integer, not unsigned.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement connectGetMaxVcpus
Matt Coleman [Mon, 5 Oct 2020 16:20:11 +0000 (12:20 -0400)] 
hyperv: implement connectGetMaxVcpus

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: implement connectGetCapabilities
Matt Coleman [Mon, 5 Oct 2020 16:20:10 +0000 (12:20 -0400)] 
hyperv: implement connectGetCapabilities

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: replace generic WMI class list helpers with a macro
Matt Coleman [Mon, 5 Oct 2020 16:20:09 +0000 (12:20 -0400)] 
hyperv: replace generic WMI class list helpers with a macro

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: break out common lookups into separate functions
Matt Coleman [Mon, 5 Oct 2020 16:20:08 +0000 (12:20 -0400)] 
hyperv: break out common lookups into separate functions

This eliminates some duplicate code and simplifies the driver functions.

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: fix nodeGetInfo failures caused by long CPU names
Matt Coleman [Mon, 5 Oct 2020 16:20:07 +0000 (12:20 -0400)] 
hyperv: fix nodeGetInfo failures caused by long CPU names

Some CPU model names were too long for _virNodeInfo.model.
For example: Intel Xeon CPU E5-2620 v2 @ 2.10GHz
This commit removes the clock frequency suffix.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: make Msvm_ComputerSystem WQL queries locale agnostic
Matt Coleman [Mon, 5 Oct 2020 16:20:06 +0000 (12:20 -0400)] 
hyperv: make Msvm_ComputerSystem WQL queries locale agnostic

There are two specific WQL queries we're using to get either a list of
virtual machines or the hypervisor host itself from Msvm_ComputerSystem.
Those queries rely on filtering results based on the "Description"
field. Since the "Description" field is locale sensitive, the queries
will fail if the Windows host is using a language pack. While the WSMAN
spec allows the client to set the requested locale (and it is supported
since openwsman 2.6.x), the Windows WinRM service does not respect this
setting: it returns non-English strings despite the WSMAN request
properly setting the locale to 'en-US'. Therefore, this patch changes
the WQL query to make use of the "__SERVER" field to stop relying on
English strings in queries and side step the issue.

Co-authored-by: Dawid Zamirski <dzamirski@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs/submitting-patches: add reference to DCO
Mauro Matteo Cascella [Mon, 5 Oct 2020 13:34:33 +0000 (15:34 +0200)] 
docs/submitting-patches: add reference to DCO

Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: delete VIR_ALLOC and VIR_ALLOC_N
Ján Tomko [Thu, 8 Oct 2020 11:50:06 +0000 (13:50 +0200)] 
util: delete VIR_ALLOC and VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: delete VIR_ALLOC tests cases
Ján Tomko [Thu, 8 Oct 2020 11:50:00 +0000 (13:50 +0200)] 
tests: delete VIR_ALLOC tests cases

There are no more users of VIR_ALLOC or VIR_ALLOC_N.
Delete their test cases.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: use g_new0 instead of VIR_ALLOC
Ján Tomko [Thu, 8 Oct 2020 11:49:50 +0000 (13:49 +0200)] 
tests: use g_new0 instead of VIR_ALLOC

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agosrc: use g_new0 instead of VIR_ALLOC
Ján Tomko [Wed, 23 Sep 2020 18:44:29 +0000 (20:44 +0200)] 
src: use g_new0 instead of VIR_ALLOC

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoremote: remoteDispatchAuthList: remove useless 'rv'
Ján Tomko [Thu, 8 Oct 2020 10:47:00 +0000 (12:47 +0200)] 
remote: remoteDispatchAuthList: remove useless 'rv'

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoremote: use g_new0 instead of VIR_ALLOC
Ján Tomko [Sun, 4 Oct 2020 15:23:22 +0000 (17:23 +0200)] 
remote: use g_new0 instead of VIR_ALLOC

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agolibxl: xenParseXMOS: separate VIR_ALLOC call
Ján Tomko [Tue, 6 Oct 2020 14:45:20 +0000 (16:45 +0200)] 
libxl: xenParseXMOS: separate VIR_ALLOC call

To reduce churn in the following patches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoremote: refactor remoteSerializeDHCPLease
Ján Tomko [Thu, 8 Oct 2020 10:21:01 +0000 (12:21 +0200)] 
remote: refactor remoteSerializeDHCPLease

Use g_new0 for allocation and remove all the temporary
variables.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agotests: commandhelper: Accept POLLNVAL on macOS
Roman Bolshakov [Thu, 8 Oct 2020 14:02:08 +0000 (17:02 +0300)] 
tests: commandhelper: Accept POLLNVAL on macOS

commandhelper hangs indefinitely in poll() on macOS on commandtest test2
and later because POLLNVAL is returned on revents for input file
descriptor opened from /dev/null, i.e this hangs:

  $ tests/commandhelper < /dev/null
  BEGIN STDOUT
  BEGIN STDERR
  ^C

But it works fine with regular stdin:

  $ tests/commandhelper <<< test
  BEGIN STDOUT
  BEGIN STDERR
  test
  test
  END STDOUT
  END STDERR

The issue is mentioned in poll(2):

  BUGS
    The poll() system call currently does not support devices.

With the change all 28 cases in commandtest pass.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agospec: Rework comment to avoid macro expansion
Andrea Bolognani [Thu, 8 Oct 2020 14:34:37 +0000 (16:34 +0200)] 
spec: Rework comment to avoid macro expansion

Without this, rpmbuild fails with

  warning: Macro expanded in comment on line 402: %firewalld_reload macro
  error: line 402: Unknown tag: test -f /usr/bin/firewall-cmd && firewall-cmd --reload --quiet || :

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
4 years agospec: Explain the BuildRequires on firewalld-filesystem
Andrea Bolognani [Thu, 8 Oct 2020 10:58:15 +0000 (12:58 +0200)] 
spec: Explain the BuildRequires on firewalld-filesystem

It's not immediately obvious why it is needed.

Suggested-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: bhyve: style improvements
Roman Bogorodskiy [Sun, 4 Oct 2020 02:20:11 +0000 (06:20 +0400)] 
docs: bhyve: style improvements

 - Wrap long lines in "domxml-to-native" example so it fits
   content width,
 - For changeset revision links, use "FreeBSD changeset rN" or
   "changeset rN" instead of just "rN" to make it more readable.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu: Don't generate '-machine memory-backend' and '-numa memdev'
Michal Privoznik [Tue, 6 Oct 2020 07:04:55 +0000 (09:04 +0200)] 
qemu: Don't generate '-machine memory-backend' and '-numa memdev'

In 88957116c9 I've switched to -machine memory-backend=ID and
-object memory-backend-* because QEMU is obsoleting -mem-path
and -mem-prealloc. However, what I did not foresee was that using
-machine memory-backend in combination with -numa is not allowed
in QEMU. This was reported upstream and fortunately not released
yet.

The problem is that if domain has NUMA nodes then we will
generate memory-backend-* objects for NUMA nodes (because if QEMU
is new enough to expose default RAM ID it also supports -numa
memdev=) and adding non-NUMA memory backend is wrong.

Reported-by: Masayoshi Mizuma <msys.mizuma@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: agent: split out qemuAgentGetAllInterfaceAddresses
Ján Tomko [Wed, 7 Oct 2020 12:33:08 +0000 (14:33 +0200)] 
qemu: agent: split out qemuAgentGetAllInterfaceAddresses

Remove more logic from qemuAgentGetInterfaces.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemuAgentGetInterfaceOneAddress: check for errors early
Ján Tomko [Wed, 7 Oct 2020 12:04:04 +0000 (14:04 +0200)] 
qemuAgentGetInterfaceOneAddress: check for errors early

For readability, and to ensure we do allocation when
returning 0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: rename tmp_iface to iface_obj
Ján Tomko [Mon, 5 Oct 2020 20:45:08 +0000 (22:45 +0200)] 
qemu: agent: rename tmp_iface to iface_obj

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemuAgentGetInterfaceAddresses: turn ifname into char*
Ján Tomko [Mon, 5 Oct 2020 20:35:34 +0000 (22:35 +0200)] 
qemuAgentGetInterfaceAddresses: turn ifname into char*

We only care about the first part of the 'ifname' string,
splitting it is overkill.

Instead, just replace the ':' with a '\0' in a copy of the string.
This reduces the count of the varaibles containing some form
of the interface name to two.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: remove cleanup in qemuAgentGetInterfaces
Ján Tomko [Mon, 5 Oct 2020 20:05:55 +0000 (22:05 +0200)] 
qemu: agent: remove cleanup in qemuAgentGetInterfaces

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: use g_auto in qemuAgentGetInterfaces
Ján Tomko [Mon, 5 Oct 2020 20:04:34 +0000 (22:04 +0200)] 
qemu: agent: use g_auto in qemuAgentGetInterfaces

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: use GetArray to remove a check
Ján Tomko [Mon, 5 Oct 2020 20:09:08 +0000 (22:09 +0200)] 
qemu: agent: use GetArray to remove a check

The error check for ValueObjectGet("return") is redundant,
qemuAgentCommand already checked for us that the reply contains
a "return" object.

It does not guarantee, that it is an array.

Use virJSONValueObjectGetArray that combines getting the object
with checking for its type and return the more helpful of
the two error messages.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: split out qemuAgentGetInterfaceAddresses
Ján Tomko [Mon, 5 Oct 2020 19:48:12 +0000 (21:48 +0200)] 
qemu: agent: split out qemuAgentGetInterfaceAddresses

Convert one interface from the "return" array returned by
"guest-network-get-interfaces" to virDomainInterface.

Due to the functionality of squashing interface aliases together,
this is not a pure function - it either:
* Adds the interface to ifaces_ret, incrementing ifaces_count
  and adds a pointer to it into the ifaces_store hash table.
* Adds the additional IP addresses from the interface alias
  to the existing interface entry, found through the hash table.
  This does not increment ifaces_count or extend the array.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: simplify access to ifaces_ret
Ján Tomko [Mon, 5 Oct 2020 20:22:00 +0000 (22:22 +0200)] 
qemu: agent: simplify access to ifaces_ret

We have a local 'iface' variable that contains the same value
eventually. Initialize it early instead of indexing two more
times.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: use virHashNew
Ján Tomko [Mon, 5 Oct 2020 19:34:52 +0000 (21:34 +0200)] 
qemu: agent: use virHashNew

We're passing 'ifaces_count' to virHashCreate as the initial
hash table size just after we've initialized it to zero.
This translates to a default of 256 inside virHashCreateFull.

Instead of this obfuscation, use virHashNew (default of 32),
to make it obvious we don't care about the initial hash size.

Also remove the error handling, since neither of the functions
return any errors after switching to g_new0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: use g_auto for ifname
Ján Tomko [Mon, 5 Oct 2020 19:32:49 +0000 (21:32 +0200)] 
qemu: agent: use g_auto for ifname

This lets us conveniently reduce its scope to the outer loop.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: expand addrs upfront
Ján Tomko [Mon, 5 Oct 2020 19:26:01 +0000 (21:26 +0200)] 
qemu: agent: expand addrs upfront

qemuAgentGetInterfaceOneAddress returns exactly one address
for every iteration of the loop (and we error out if not).

Instead of expanding the addrs by one on every iteration,
do it upfront since we know how many times the loop will
execute.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: reduce scope of addrs_count
Ján Tomko [Mon, 5 Oct 2020 19:25:43 +0000 (21:25 +0200)] 
qemu: agent: reduce scope of addrs_count

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: remove impossible errors
Ján Tomko [Mon, 5 Oct 2020 19:21:07 +0000 (21:21 +0200)] 
qemu: agent: remove impossible errors

For both 'ip_addr_arr' and 'ret_array', we:
1) already checked that they are arrays
2) only iterate up to the array size

Remove the duplicate checks.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: split out qemuAgentGetInterfaceOneAddress
Ján Tomko [Mon, 5 Oct 2020 18:35:08 +0000 (20:35 +0200)] 
qemu: agent: split out qemuAgentGetInterfaceOneAddress

A function that takes one entry from the "ip-addresses" array
returned by "guest-network-get-interfaces" and converts it
into virDomainIPAddress.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoqemu: agent: remove redundant checks
Ján Tomko [Mon, 5 Oct 2020 20:09:49 +0000 (22:09 +0200)] 
qemu: agent: remove redundant checks

virJSONValueObjectGetArray returns NULL if the object with
the supplied key is not an array.

Calling virJSONValueIsArray right after is redundant.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agotools: spell out the type instead of using typeof
Ján Tomko [Wed, 7 Oct 2020 18:54:13 +0000 (20:54 +0200)] 
tools: spell out the type instead of using typeof

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: virDomainUSBAddressHubNew: refactor
Ján Tomko [Tue, 6 Oct 2020 14:42:51 +0000 (16:42 +0200)] 
conf: virDomainUSBAddressHubNew: refactor

Remove the pointless variable and pointer stealing.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>