]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
5 years agotests: qemu: Split NBD and VXHS protocol tests
Peter Krempa [Thu, 30 Jul 2020 15:29:44 +0000 (17:29 +0200)] 
tests: qemu: Split NBD and VXHS protocol tests

QEMU is going to drop 'vxhs' in the upcoming release so we'll need to
track these separately to prevent test suite breakage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: qemuxml2argv: Use only modern versions of 'disk-network-tlsx509' test
Peter Krempa [Thu, 30 Jul 2020 15:41:43 +0000 (17:41 +0200)] 
tests: qemuxml2argv: Use only modern versions of 'disk-network-tlsx509' test

We already test with real caps so there's no real need for this special
case. While it technically tested the state without TLS encryption key
secrets, it doesn't really matter that much.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovirNodeDevPCICapSRIOVVirtualParseXML: fix memleak of addr
Hao Wang [Thu, 30 Jul 2020 12:03:08 +0000 (20:03 +0800)] 
virNodeDevPCICapSRIOVVirtualParseXML: fix memleak of addr

virPCIDeviceAddressPtr 'addr' is forgotten to be freed in the branch
'VIR_APPEND_ELEMENT() < 0'. Use g_autoptr instead.

Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Mention supported hypervisor of transient element
Han Han [Fri, 24 Jul 2020 06:48:19 +0000 (14:48 +0800)] 
docs: Mention supported hypervisor of transient element

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: fix memory leak in qemuDomainSaveInternal()
Zheng Chuan [Wed, 29 Jul 2020 03:42:49 +0000 (11:42 +0800)] 
qemu: fix memory leak in qemuDomainSaveInternal()

Use g_autoptr to free the temporary virDomainDef object created by
qemuDomainSaveInternal() when xmlin is non-NULL. Leak was added in
commit 0ea479f8f6, first appearing in libvirt 0.9.4 in August 2011.

Signed-off-by: Zheng Chuan <zhengchuan@huawei.com>
Reviewed-by: Laine Stump <laine@redhat.com>
5 years agoci: Use correct name for armv7l architecture
Andrea Bolognani [Wed, 29 Jul 2020 08:53:51 +0000 (10:53 +0200)] 
ci: Use correct name for armv7l architecture

Turns out 'ldebian' was not a typo, but rather the result of
mistakenly shifting the dash in 'armv7l-debian' one spot to the
left.

Fixes: 821100e81281eef9beeb15c3f4bf6a000d6a03c5
Reported-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agoci: Fix typo 'ldebian'
Andrea Bolognani [Wed, 29 Jul 2020 08:21:24 +0000 (10:21 +0200)] 
ci: Fix typo 'ldebian'

Fixes: 95abbdc432133b9ae4a76d15251d64b5893717e6
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: fix name of file containing max number of VFs
Paulo de Rezende Pinatti [Tue, 28 Jul 2020 09:16:24 +0000 (11:16 +0200)] 
docs: fix name of file containing max number of VFs

Signed-off-by: Paulo de Rezende Pinatti <ppinatti@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc: add missing balloon stats docs
Nikolay Shirokovskiy [Tue, 21 Jul 2020 08:07:22 +0000 (11:07 +0300)] 
src: add missing balloon stats docs

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: add missing iothread stats docs in domstats
Nikolay Shirokovskiy [Tue, 21 Jul 2020 08:07:21 +0000 (11:07 +0300)] 
docs: add missing iothread stats docs in domstats

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: add missing balloon stats docs in domstats
Nikolay Shirokovskiy [Tue, 21 Jul 2020 08:07:20 +0000 (11:07 +0300)] 
docs: add missing balloon stats docs in domstats

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolib: clarify docs for hugetlb in virDomainMemoryStatTags
Nikolay Shirokovskiy [Tue, 21 Jul 2020 08:07:19 +0000 (11:07 +0300)] 
lib: clarify docs for hugetlb in virDomainMemoryStatTags

The term number is used for other stats and even for hugetlb
stats in virsh man page. The term number is also more clear.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: fix typo in virsh.rst for balloon.major_fault
Nikolay Shirokovskiy [Tue, 21 Jul 2020 08:07:18 +0000 (11:07 +0300)] 
docs: fix typo in virsh.rst for balloon.major_fault

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoTranslated using Weblate (Polish)
Piotr Drąg [Mon, 27 Jul 2020 17:11:39 +0000 (19:11 +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: Piotr Drąg <piotrdrag@gmail.com>
5 years agoTranslated using Weblate (Polish)
Szymon Scholz [Mon, 27 Jul 2020 17:11:36 +0000 (19:11 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.4% (2432 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
5 years agodocs: virConnectGetCapabilities do not provide pool types
Pino Toscano [Mon, 20 Jul 2020 07:49:32 +0000 (09:49 +0200)] 
docs: virConnectGetCapabilities do not provide pool types

Remove the paragraph in the storage pool page that mentions
virConnectGetCapabilities, as virConnectGetCapabilities does not return
any information about pools.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
5 years agotests: commandtest: Make 'test4' checking daemonization more reliable
Peter Krempa [Tue, 21 Jul 2020 10:32:10 +0000 (12:32 +0200)] 
tests: commandtest: Make 'test4' checking daemonization more reliable

The 'commandhelper' checks effectively whether the parent process is
still around to report whether it was daemonized or not.

This creates a unlikely race condition in cases when we do actually
daemonize the process as the intermediate process used for the
daemonization might not have terminated yet which would report wrong
result leading to test failure.

For now there's just 'test4' which actually daemonizes the process.

Add an argument '--check-daemonize' which asks for retries of the
daemonization check in cases where we expect that the commandhelper is
going to be daemonized and use it in 'test4' to make the test more
reliable.

I've observed the test failure sporadically when my box is under load
e.g. while building two trees at once.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonews: Document recent CVE fix
Michal Privoznik [Mon, 27 Jul 2020 07:53:24 +0000 (09:53 +0200)] 
news: Document recent CVE fix

Document the fix of leaking /dev/mapper/control to QEMU (fixed in
v6.6.0-rc1-3-g2249455654).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoUpdate translation files
Weblate [Mon, 27 Jul 2020 07:35:44 +0000 (09:35 +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>
5 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Mon, 27 Jul 2020 07:35:40 +0000 (09:35 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10349 of 10349 strings)

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

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
5 years agoTranslated using Weblate (Polish)
Szymon Scholz [Mon, 27 Jul 2020 07:35:37 +0000 (09:35 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.4% (2431 of 10349 strings)

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

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
5 years agoTranslated using Weblate (Italian)
Pino Toscano [Mon, 27 Jul 2020 07:35:34 +0000 (09:35 +0200)] 
Translated using Weblate (Italian)

Currently translated at 24.7% (2560 of 10349 strings)

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

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
5 years agoUpdate translation files
Weblate [Mon, 27 Jul 2020 07:35:29 +0000 (09:35 +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>
5 years agoTranslated using Weblate (Finnish)
Daniel P. Berrangé [Mon, 27 Jul 2020 07:35:21 +0000 (09:35 +0200)] 
Translated using Weblate (Finnish)

Currently translated at 3.3% (348 of 10318 strings)

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

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agovirDevMapperGetTargets: Don't ignore EBADF
Michal Privoznik [Thu, 23 Jul 2020 15:08:46 +0000 (17:08 +0200)] 
virDevMapperGetTargets: Don't ignore EBADF

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirdevmapper: Don't use libdevmapper to obtain dependencies
Michal Privoznik [Thu, 23 Jul 2020 14:02:00 +0000 (16:02 +0200)] 
virdevmapper: Don't use libdevmapper to obtain dependencies

CVE-2020-14339

When building domain's private /dev in a namespace, libdevmapper
is consulted for getting full dependency tree of domain's disks.
The reason is that for a multipath devices all dependent devices
must be created in the namespace and allowed in CGroups.

However, this approach is very fragile as building of namespace
happens in the forked off child process, after mass close of FDs
and just before dropping privileges and execing QEMU. And it so
happens that when calling libdevmapper APIs, one of them opens
/dev/mapper/control and saves the FD into a global variable. The
FD is kept open until the lib is unlinked or dm_lib_release() is
called explicitly. We are doing neither.

However, the virDevMapperGetTargets() function is called also
from libvirtd (when setting up CGroups) and thus has to be thread
safe. Unfortunately, libdevmapper APIs are not thread safe (nor
async signal safe) and thus we can't use them. Reimplement what
libdevmapper would do using plain C (ioctl()-s, /proc/devices
parsing, /dev/mapper dirwalking, and so on).

Fixes: a30078cb832646177defd256e77c632905f1e6d0
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1858260

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirDevMapperGetTargetsImpl: Use VIR_AUTOSTRINGLIST
Michal Privoznik [Fri, 24 Jul 2020 07:40:04 +0000 (09:40 +0200)] 
virDevMapperGetTargetsImpl: Use VIR_AUTOSTRINGLIST

Since we have VIR_AUTOSTRINGLIST we can use it to free string
lists used in the function automatically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirdevmapper.c: Join two WITH_DEVMAPPER sections together
Michal Privoznik [Thu, 23 Jul 2020 14:30:56 +0000 (16:30 +0200)] 
virdevmapper.c: Join two WITH_DEVMAPPER sections together

There are two distinct WITH_DEVMAPPER sections in the file, for
different functions each. Rearrange the code to make some of
future commits smaller.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agopo: Refresh potfile for v6.6.0 v6.6.0-rc1
Jiri Denemark [Fri, 24 Jul 2020 22:45:52 +0000 (00:45 +0200)] 
po: Refresh potfile for v6.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoTranslated using Weblate (French)
Daniel P. Berrangé [Fri, 24 Jul 2020 13:02:00 +0000 (15:02 +0200)] 
Translated using Weblate (French)

Currently translated at 12.4% (1282 of 10318 strings)

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

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5 years agoTranslated using Weblate (Hungarian)
Balázs Meskó [Fri, 24 Jul 2020 13:01:57 +0000 (15:01 +0200)] 
Translated using Weblate (Hungarian)

Currently translated at 2.5% (265 of 10318 strings)

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

Signed-off-by: Balázs Meskó <meskobalazs@mailbox.org>
5 years agoUpdate translation files
Weblate [Fri, 24 Jul 2020 13:01:54 +0000 (15:01 +0200)] 
Update translation files

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

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

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

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

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

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
5 years agoTranslated using Weblate (French)
Jean-Baptiste Holcroft [Fri, 24 Jul 2020 13:01:51 +0000 (15:01 +0200)] 
Translated using Weblate (French)

Currently translated at 12.4% (1282 of 10318 strings)

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

Signed-off-by: Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
Translated using Weblate (French)

Currently translated at 12.0% (1241 of 10318 strings)

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

Signed-off-by: Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
5 years agoTranslated using Weblate (Italian)
Pino Toscano [Fri, 24 Jul 2020 13:01:48 +0000 (15:01 +0200)] 
Translated using Weblate (Italian)

Currently translated at 23.5% (2435 of 10318 strings)

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

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
Translated using Weblate (Italian)

Currently translated at 15.1% (1566 of 10318 strings)

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

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
5 years agoconf: add control over COW for storage pool directories
Daniel P. Berrangé [Fri, 17 Jul 2020 18:32:18 +0000 (19:32 +0100)] 
conf: add control over COW for storage pool directories

The storage pool code now attempts to disable COW by default on btrfs,
but management applications may wish to override this behaviour. Thus we
introduce a concept of storage pool features:

  <features>
    <cow state='yes|no'/>
  </features>

If the <cow> feature policy is set, it will be enforced. It will always
return an hard error if COW cannot be explicitly set or unset.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agostorage: attempt to disable COW by default
Daniel P. Berrangé [Fri, 17 Jul 2020 18:30:48 +0000 (19:30 +0100)] 
storage: attempt to disable COW by default

This calls virFileSetCOW when building a pool with a request to attempt,
but not require, COW to be disabled. The effect is that nothing changes
on non-btrfs filesystems, but btrfs will get COW disabled on the
directory. This setting is then inherited by all newly created files in
the pool, avoiding the need for mgmt app to set "nocow" on a per-volume
basis.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agostorage: convert to use virFileSetCOW
Daniel P. Berrangé [Fri, 17 Jul 2020 18:28:08 +0000 (19:28 +0100)] 
storage: convert to use virFileSetCOW

When disabling COW on individual files, we now use the virFileSetCOW
method. Note that this change has a slight semantic difference to the
old implementation.

The original code reported errors but returned success when disabling
COW failed.

With this new code, we will always report an error if the user requested
disabling of COW and we could not honour it, either because btrfs
returned an error, or because the filesystem is not btrfs.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: add a helper method for controlling the COW flag on btrfs
Daniel P. Berrangé [Fri, 17 Jul 2020 18:16:27 +0000 (19:16 +0100)] 
util: add a helper method for controlling the COW flag on btrfs

btrfs defaults to performing copy-on-write for files. This is often
undesirable for VM images, so we need to be able to control whether this
behaviour is used.

The virFileSetCOW() will allow for this. We use a tristate, since out of
the box, we want the default behaviour attempt to disable cow, but only
on btrfs, silently do nothing on non-btrfs. If someone explicitly asks
to disable/enable cow, then we want to raise a hard error on non-btrfs.

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoAdd a check attribute on the mac address element
Bastien Orivel [Mon, 13 Jul 2020 09:44:13 +0000 (11:44 +0200)] 
Add a check attribute on the mac address element

This is only used in the ESX driver where, when set to "no", it will
ignore all the checks libvirt does about the origin of the MAC address
(whether or not it's in a VMWare OUI) and forward the original one to
the ESX server telling it not to check it either.

This allows keeping a deterministic MAC address which can be useful for
licensed software which might dislike changes.

Signed-off-by: Bastien Orivel <bastien.orivel@diateam.net>
VMX conversion parts rewritten to apply on top of previously merged
support for type='generated|static'

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovmx: support outputing the type attribute for MAC addresses
Daniel P. Berrangé [Mon, 20 Jul 2020 15:46:09 +0000 (16:46 +0100)] 
vmx: support outputing the type attribute for MAC addresses

When support for MAC addresses having a type='static|generated'
attribute was added in:

  commit 454e5961abf40c14f8b6d7ee216229e68fd170bf
  Author: Bastien Orivel <bastien.orivel@diateam.net>
  Date:   Mon Jul 13 16:28:53 2020 +0200

    Add a type attribute on the mac address element

the VMX -> XML parser was not updated. As a result while we
accept the 'type' attribute on input, we never show it again
on 'output', so we loose information during the roundtrip.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovmx: fix logic handling mac address type
Daniel P. Berrangé [Mon, 20 Jul 2020 14:59:51 +0000 (15:59 +0100)] 
vmx: fix logic handling mac address type

With the current formatter, the XML snippets:

    <interface type='bridge'>
      <mac address='00:0c:29:dd:ee:fe' type='static'/>
      <source bridge='br1'/>
    </interface>
    <interface type='bridge'>
      <mac address='aa:bb:cc:dd:ee:fd' type='generated'/>
      <source bridge='br2'/>
    </interface>

result in

 ethernet1.present = "true"
 ethernet1.networkName = "br1"
 ethernet1.connectionType = "bridged"
 ethernet1.addressType = "static"
 ethernet1.address = "00:0c:29:dd:ee:fe"
 ethernet1.checkMACAddress = "false"

 ethernet2.present = "true"
 ethernet2.networkName = "br2"
 ethernet2.connectionType = "bridged"
 ethernet2.addressType = "static"
 ethernet2.address = "aa:bb:cc:dd:ee:fd"
 ethernet2.checkMACAddress = "false"

which is flawed, as both type='static' and type='generated' in the XML
turn into 'static' in the VMX config.

The existence of the 'static' attribute is further overriding whether
the checkMACAddress config option is set as a side effect.

Both these pieces of flawed logic were introduced in

  commit 454e5961abf40c14f8b6d7ee216229e68fd170bf
  Author: Bastien Orivel <bastien.orivel@diateam.net>
  Date:   Mon Jul 13 16:28:53 2020 +0200

    Add a type attribute on the mac address element

which intentionally added the 'checkMACAddress' side effect based on
the 'type' attribute.

With this change, we're reverting the handling of checkMACAddress
to match what existed historically. The 'type' attribute now directly
maps to the addressType attribute, so the above config becomes:

 ethernet1.present = "true"
 ethernet1.networkName = "br1"
 ethernet1.connectionType = "bridged"
 ethernet1.addressType = "static"
 ethernet1.address = "00:0c:29:dd:ee:fe"

 ethernet2.present = "true"
 ethernet2.networkName = "br2"
 ethernet2.connectionType = "bridged"
 ethernet2.addressType = "generated"
 ethernet2.generatedAddress = "aa:bb:cc:dd:ee:fd"
 ethernet2.generatedAddressOffset = "0"

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotools: be more paranoid about possibly NULL description
Daniel P. Berrangé [Wed, 22 Jul 2020 16:32:54 +0000 (17:32 +0100)] 
tools: be more paranoid about possibly NULL description

GCC 10 complains about "desc" possibly being a NULL dereference. Even
though it is a false positive, we can easily avoid it.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: don't mock the time() function on mingw
Daniel P. Berrangé [Wed, 22 Jul 2020 16:31:33 +0000 (17:31 +0100)] 
tests: don't mock the time() function on mingw

The mingw header define time() as a static inline function and this
causes a duplicate definition build failure. Since we're not using the
LD_PRELOAD at all on Mingw, we ideally wouldn't compile any of the
mock libraries. Rather than change the build system now though, this
just stubs out the offending function.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agom4: enable -fstack-protector-strong on mingw
Daniel P. Berrangé [Wed, 22 Jul 2020 16:29:19 +0000 (17:29 +0100)] 
m4: enable -fstack-protector-strong on mingw

Historically we avoided -fstack-protector* since it resulted in a broken
build on Mingw. In GCC 10 in Fedora though, we have the opposite problem,
getting a broken build if we don't enable one of the -fstack-protector*
options. This also works in GCC 9, so we don't need to worry about the
old brokeness which evidentally got fixed at some time without noticing.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: refactor code to workaround gcc 10.1.0 bug
Daniel P. Berrangé [Wed, 22 Jul 2020 14:58:16 +0000 (15:58 +0100)] 
util: refactor code to workaround gcc 10.1.0 bug

gcc 10.1.0 on Debian sid has a bug where the bounds checking gets
confused beteen two branches:

In file included from /usr/include/string.h:495,
                 from ../../src/internal.h:28,
                 from ../../src/util/virsocket.h:21,
                 from ../../src/util/virsocketaddr.h:21,
                 from ../../src/util/virnetdevip.h:21,
                 from ../../src/util/virnetdevip.c:21:
In function 'memcpy',
    inlined from 'virNetDevGetifaddrsAddress' at ../../src/util/virnetdevip.c:914:13,
    inlined from 'virNetDevIPAddrGet' at ../../src/util/virnetdevip.c:962:16:
/usr/include/arm-linux-gnueabihf/bits/string_fortified.h:34:10: error: '__builtin_memcpy' offset [16, 27] from the object at 'addr' is out of the bounds of referenced subobject 'inet4' with type 'struct sockaddr_in' at offset 0 [-Werror=array-bounds]
   34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../src/util/virnetdevip.h:21,
                 from ../../src/util/virnetdevip.c:21:
../../src/util/virnetdevip.c: In function 'virNetDevIPAddrGet':
../../src/util/virsocketaddr.h:29:28: note: subobject 'inet4' declared here
   29 |         struct sockaddr_in inet4;
      |                            ^~~~~
cc1: all warnings being treated as errors

Note the source location is pointing to the "inet6" / AF_INET6 branch of
the "if", but is complaining about bounds of the "inet4" field. Changing
the code into a switch() is sufficient to avoid triggering the bug and
is arguably better code too.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoci: Run 'make distcheck' on FreeBSD
Andrea Bolognani [Thu, 23 Jul 2020 08:29:35 +0000 (10:29 +0200)] 
ci: Run 'make distcheck' on FreeBSD

The Cirrus CI integration was modeled after the Travis CI jobs,
but those were limited to macOS where the test suite is currently
still broken. FreeBSD can run the full distcheck just fine, so
let's do that.

Fixes: 6190c14151c3e2cf5c30b9df9131697f5c3b64b9
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Fix affinity typo
Ján Tomko [Wed, 22 Jul 2020 13:50:06 +0000 (15:50 +0200)] 
qemu: Fix affinity typo

Fixes: 4c0398b5284d14c55eca51095673b6fadbbd85fb
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoformatdomain.html.in: mention pSeries NVDIMM 'align down' mechanic
Daniel Henrique Barboza [Mon, 20 Jul 2020 16:51:46 +0000 (13:51 -0300)] 
formatdomain.html.in: mention pSeries NVDIMM 'align down' mechanic

The reason why we align down the guest area (total-size - label-size) is
explained in the body of qemuDomainNVDimmAlignSizePseries(). This
behavior must also be documented in the user docs.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: pre-create the dbus directory in qemuStateInitialize
Bihong Yu [Tue, 14 Jul 2020 07:44:05 +0000 (15:44 +0800)] 
qemu: pre-create the dbus directory in qemuStateInitialize

There are races condiction to make '/run/libvirt/qemu/dbus' directory in
virDirCreateNoFork() while concurrent start VMs, and get "failed to create
directory '/run/libvirt/qemu/dbus': File exists" error message. pre-create the
dbus directory in qemuStateInitialize.

Signed-off-by: Bihong Yu <yubihong@huawei.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Drop ret variable from qemuConnectCPUModelComparison
Jiri Denemark [Tue, 21 Jul 2020 13:47:29 +0000 (15:47 +0200)] 
qemu: Drop ret variable from qemuConnectCPUModelComparison

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoNEWS: mention readonly attribute is not yet supported by virtiofsd
Jianan Gao [Tue, 21 Jul 2020 13:32:40 +0000 (21:32 +0800)] 
NEWS: mention readonly attribute is not yet supported by virtiofsd

There was a clear statement on not supported by virtiofsd with
readonly attribute.

Signed-off-by: Jianan Gao <jgao@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agosecurity: Remove the superfluous break
Liao Pingfang [Fri, 17 Jul 2020 02:00:43 +0000 (10:00 +0800)] 
security: Remove the superfluous break

Remove the superfuous break, as there is a 'return' before it.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Remove superfluous breaks
Liao Pingfang [Fri, 17 Jul 2020 02:00:28 +0000 (10:00 +0800)] 
qemu: Remove superfluous breaks

Remove superfluous breaks, as there is a "return" before them.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: Remove superfluous breaks
Liao Pingfang [Fri, 17 Jul 2020 02:00:09 +0000 (10:00 +0800)] 
conf: Remove superfluous breaks

Remove superfluous breaks, as there is a "return" before them.

Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Properly set //cpu/@migratable default value for running domains
Jiri Denemark [Wed, 15 Jul 2020 15:54:07 +0000 (17:54 +0200)] 
qemu: Properly set //cpu/@migratable default value for running domains

Since active domains which do not have the attribute already set were
not started by libvirt that probed for CPU migratable property, we need
to check this property on reconnect and update the domain definition
accordingly.

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

Reported-by: Mark Mielke <mark.mielke@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Do not set //cpu/@migratable for running domains in post-parse
Jiri Denemark [Wed, 15 Jul 2020 09:33:05 +0000 (11:33 +0200)] 
qemu: Do not set //cpu/@migratable for running domains in post-parse

Commit v6.4.0-61-g201bd5db63 started to fill the default value for
//cpu/@migratable attribute according to QEMU support. However, active
domains either have the migratable attribute already set or the
capabilities we use for checking the QEMU support were created by older
libvirt which didn't probe for this specific capability. Thus we should
leave active domains alone when parsing their XMLs.

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

Reported-by: Mark Mielke <mark.mielke@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu_monitor: Add API for checking CPU migratable property
Jiri Denemark [Wed, 15 Jul 2020 20:33:07 +0000 (22:33 +0200)] 
qemu_monitor: Add API for checking CPU migratable property

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu_capabilities.c: use g_autoptr() in virQEMUCapsInitQMPSingle()
Daniel Henrique Barboza [Fri, 17 Jul 2020 21:15:56 +0000 (18:15 -0300)] 
qemu_capabilities.c: use g_autoptr() in virQEMUCapsInitQMPSingle()

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-6-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_driver.c: modernize qemuConnectCPUModelComparison()
Daniel Henrique Barboza [Fri, 17 Jul 2020 21:15:55 +0000 (18:15 -0300)] 
qemu_driver.c: modernize qemuConnectCPUModelComparison()

Use g_auto* on pointers to avoid using the 'cleanup' label.

In theory the 'ret' variable can also be discarded if the flow
of the logic is reworked. Perhaps another time.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-5-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_driver.c: modernize qemuConnectCPUModelBaseline()
Daniel Henrique Barboza [Fri, 17 Jul 2020 21:15:54 +0000 (18:15 -0300)] 
qemu_driver.c: modernize qemuConnectCPUModelBaseline()

Use g_autoptr() on pointers and remove the unneeded 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-4-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_process.c: modernize qemuProcessQMPNew()
Daniel Henrique Barboza [Fri, 17 Jul 2020 21:15:53 +0000 (18:15 -0300)] 
qemu_process.c: modernize qemuProcessQMPNew()

Use g_autoptr() and remove the 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-3-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_process.h: register AUTOPTR_CLEANUP_FUNC for qemuProcessQMPPtr
Daniel Henrique Barboza [Fri, 17 Jul 2020 21:15:52 +0000 (18:15 -0300)] 
qemu_process.h: register AUTOPTR_CLEANUP_FUNC for qemuProcessQMPPtr

Next patches will use g_autoptr() in qemuProcessQMPPtr pointers
for some cleanups in QMP code.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200717211556.1024748-2-danielhb413@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agonetwork: split out networkSetIPv6Sysctl
Ján Tomko [Wed, 15 Jul 2020 21:22:38 +0000 (23:22 +0200)] 
network: split out networkSetIPv6Sysctl

Refactor networkSetIPv6Sysctls to remove repetition and reuse
of the 'field' variable.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemuDomainBlockPivot: Ignore failures of creating active layer bitmap
Peter Krempa [Thu, 16 Jul 2020 13:14:40 +0000 (15:14 +0200)] 
qemuDomainBlockPivot: Ignore failures of creating active layer bitmap

Ignore errors from creating "libvirt-tmp-activewrite" bitmap. This
prevents failures of finishing blockjobs if the bitmap already exists.

Note that if the bitmap exists, the worst case that can happen is that
more bits are marked as dirty in the resulting merge.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuDomainBlockPivot: Rename 'actions' to 'bitmapactions'
Peter Krempa [Thu, 16 Jul 2020 13:13:17 +0000 (15:13 +0200)] 
qemuDomainBlockPivot: Rename 'actions' to 'bitmapactions'

There are two possible 'transaction' command arguments in the function.
Rename 'actions' as they deal with creating bitmaps only.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: block: Remove 'active-write' bitmap even if there are no bitmaps to merge
Peter Krempa [Thu, 16 Jul 2020 12:46:43 +0000 (14:46 +0200)] 
qemu: block: Remove 'active-write' bitmap even if there are no bitmaps to merge

The 'libvirt-tmp-activewrite' bitmap is added during the 'pivot'
operation of block copy and active layer block commit operations
regardless of whether there are any bitmaps to merge, but was not
removed unless a bitmap was merged. This meant that subsequent attempts
to merge into the same image would fail.

Fix it by checking whether the 'libvirt-tmp-activewrite' would be used
by the code and don't skip the code which would delete it.

This is a regression introduced when we switched to the new code for
block commit in <20a7abc2d2d> and for block copy in <7bfff40fdfe5>. The
actual bug originates from <4fa8654ece>.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: blockjob: Actually delete temporary bitmap on failed active commit
Peter Krempa [Thu, 16 Jul 2020 13:19:25 +0000 (15:19 +0200)] 
qemu: blockjob: Actually delete temporary bitmap on failed active commit

Commit 20a7abc2d2d tried to delete the possibly leftover bitmap but
neglected to call the actual monitor to do so.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: blockjob: Don't base bitmap handling of active-layer block commit on QEMU_CAPS_...
Peter Krempa [Thu, 16 Jul 2020 13:54:46 +0000 (15:54 +0200)] 
qemu: blockjob: Don't base bitmap handling of active-layer block commit on QEMU_CAPS_BLOCKDEV_REOPEN

The handler finalizing the active layer block commit doesn't actually
reopen the file for active layer block commit, so the comment and check
are invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirDomainSetBlockThreshold: Mention that the event can be registered for <mirror>
Peter Krempa [Wed, 15 Jul 2020 11:09:32 +0000 (13:09 +0200)] 
virDomainSetBlockThreshold: Mention that the event can be registered for <mirror>

The infrastructure supports setting the threshold also for the <mirror>.
Mention it in the docs.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain
Peter Krempa [Wed, 15 Jul 2020 10:51:40 +0000 (12:51 +0200)] 
qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain

A disk can have a mirror, look also in its backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuDomainDiskLookupByNodename: Look also for 'mirror' node names
Peter Krempa [Wed, 15 Jul 2020 10:36:50 +0000 (12:36 +0200)] 
qemuDomainDiskLookupByNodename: Look also for 'mirror' node names

When doing a block copy, there is another chain of images attached to a
disk. Consider them as well when looking up a disk using nodename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirStorageSourceFindByNodeName: Remove unused 'idx' argument
Peter Krempa [Wed, 15 Jul 2020 10:33:34 +0000 (12:33 +0200)] 
virStorageSourceFindByNodeName: Remove unused 'idx' argument

None of the callers actually use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuDomainDiskLookupByNodename: Remove unused 'idx'
Peter Krempa [Wed, 15 Jul 2020 10:29:34 +0000 (12:29 +0200)] 
qemuDomainDiskLookupByNodename: Remove unused 'idx'

All callers pass NULL as the value. Remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirDomainSetBlockThreshold: Clarify values of @dev the event is fired for
Peter Krempa [Wed, 15 Jul 2020 11:06:44 +0000 (13:06 +0200)] 
virDomainSetBlockThreshold: Clarify values of @dev the event is fired for

Top level image may get two events, one with the disk target (vda) and
one with disk target with index (vda[3]) if the top level image has an
index.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuProcessHandleBlockThreshold: Report correct indexes
Peter Krempa [Wed, 15 Jul 2020 09:51:17 +0000 (11:51 +0200)] 
qemuProcessHandleBlockThreshold: Report correct indexes

The index returned by qemuDomainDiskLookupByNodename is the position in
the backing chain rather than the index we report in the XML.

Since with -blockdev they differ now and additionally the disk source
also has an index we need to fix the 'threshold' events we report:

1) If it's the top level image we must always trigger the event without
   any suffix as we did until now

2) We must report the correct index

3) We must report the correct index also for the top level image, when
   blockdev is used.

This means that we need to potentially emit 2 events, one for the device
without the index and then when blockdev is used and the top level image
has an index we must do it also with the index.

This will fix it for blockdev cases, while also not removing previous
semantics.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuDomainDiskBackingStoreGetName: Eliminate temp variable
Peter Krempa [Wed, 15 Jul 2020 10:01:39 +0000 (12:01 +0200)] 
qemuDomainDiskBackingStoreGetName: Eliminate temp variable

We can return the formatted string directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuDomainDiskBackingStoreGetName: Remove unused argument
Peter Krempa [Wed, 15 Jul 2020 10:19:35 +0000 (12:19 +0200)] 
qemuDomainDiskBackingStoreGetName: Remove unused argument

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirDomainSetBlockThreshold: Document values of '@dev' better
Peter Krempa [Wed, 15 Jul 2020 11:02:24 +0000 (13:02 +0200)] 
virDomainSetBlockThreshold: Document values of '@dev' better

Mention where to obtain the index and how it's treated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agonwfilter: convert remaining VIR_FREE() to g_free()
Laine Stump [Thu, 25 Jun 2020 02:06:47 +0000 (22:06 -0400)] 
nwfilter: convert remaining VIR_FREE() to g_free()

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: convert local pointers to use g_auto*
Laine Stump [Thu, 25 Jun 2020 01:59:39 +0000 (21:59 -0400)] 
nwfilter: convert local pointers to use g_auto*

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: replace VIR_ALLOC with g_new0
Laine Stump [Wed, 24 Jun 2020 20:55:23 +0000 (16:55 -0400)] 
nwfilter: replace VIR_ALLOC with g_new0

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: use standard label names when reasonable
Laine Stump [Thu, 25 Jun 2020 02:20:56 +0000 (22:20 -0400)] 
nwfilter: use standard label names when reasonable

Rather than having labels named exit, done, exit_snooprequnlock,
skip_rename, etc, use the standard "cleanup" label. And instead of
err_exit, malformed, tear_down_tmpebchains, use "error".

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: transform logic in virNWFilterRuleInstSort to eliminate label
Laine Stump [Thu, 25 Jun 2020 02:30:38 +0000 (22:30 -0400)] 
nwfilter: transform logic in virNWFilterRuleInstSort to eliminate label

This rewrite of a nested conditional produces the same results, but
eliminate a goto and corresponding label.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: define a typedef for struct ebtablesSubChainInst
Laine Stump [Wed, 24 Jun 2020 19:56:43 +0000 (15:56 -0400)] 
nwfilter: define a typedef for struct ebtablesSubChainInst

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: clear nrules when resetting virNWFilterInst
Laine Stump [Sun, 5 Jul 2020 02:29:23 +0000 (22:29 -0400)] 
nwfilter: clear nrules when resetting virNWFilterInst

It's possible/probable the callers to virNWFilterInstReset() make it
unnecessary to set the object's nrules to 0 after freeing all its
rules, but that same function is setting nfilters to 0, so let's do
the same for the sake of consistency.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonwfilter: remove unnecessary code from ebtablesGetSubChainInsts()
Laine Stump [Wed, 24 Jun 2020 23:31:55 +0000 (19:31 -0400)] 
nwfilter: remove unnecessary code from ebtablesGetSubChainInsts()

On failure, this function would clear out and free the list of
subchains it had been called with. This is unnecessary, because the
*only* caller of this function will also clear out and free the list
of subchains if it gets a failure from ebtablesGetSubChainInsts().

(It also makes more logical sense for the function that is creating
the entire list to be the one freeing the entire list, rather than
having a function whose purpose is only to create *one item* on the
list freeing the entire list).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko redhat com>
5 years agonetwork: use g_free() in place of remaining VIR_FREE()
Laine Stump [Wed, 24 Jun 2020 02:38:17 +0000 (22:38 -0400)] 
network: use g_free() in place of remaining VIR_FREE()

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonetwork: eliminate unnecessary labels
Laine Stump [Sat, 4 Jul 2020 03:51:27 +0000 (23:51 -0400)] 
network: eliminate unnecessary labels

All these cleanup/error labels were reduced to having just "return
ret" by a previous patch, so get rid of them and return directly.

This patch coincidentally fixes a bug in
networkFindUnusedBridgeName(), where we would log an error yet still
return success if we failed to find a single unused "virbrNNN" name
after checking all values of "N" from 0 - 256. Said bug was introduced
when that function was originally written, in commit a28d3e485f
(libvirt 1.2.15, 2015)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonetwork: use g_auto wherever appropriate
Laine Stump [Sat, 4 Jul 2020 03:43:21 +0000 (23:43 -0400)] 
network: use g_auto wherever appropriate

This includes standard g_autofree() as well as other objects that have
a cleanup function defined to use via g_autoptr (virCommand,
virJSONValue)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonetwork: replace VIR_ALLOC/REALLOC with g_new0/g_renew
Laine Stump [Wed, 24 Jun 2020 17:06:43 +0000 (13:06 -0400)] 
network: replace VIR_ALLOC/REALLOC with g_new0/g_renew

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodefine g_autoptr cleanup function for virNetworkDHCPLease
Laine Stump [Wed, 24 Jun 2020 17:04:25 +0000 (13:04 -0400)] 
define g_autoptr cleanup function for virNetworkDHCPLease

virNetworkDHCPLease and virNetworkDHCPLeaseFree() are declared in the
public API file libvirt-network.h, and we can't pollute that with glib
macro invocations, so put this in src/datatypes.h next to the other
virNetwork items.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: define g_autoptr cleanups for a couple dnsmasq objects
Laine Stump [Fri, 3 Jul 2020 03:40:13 +0000 (23:40 -0400)] 
util: define g_autoptr cleanups for a couple dnsmasq objects

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoreplace g_new() with g_new0() for consistency
Laine Stump [Thu, 25 Jun 2020 02:37:33 +0000 (22:37 -0400)] 
replace g_new() with g_new0() for consistency

g_new() is used in only 3 places. Switching them to g_new0() will do
no harm, reduces confusion, and helps me sleep better at night knowing
that all allocated memory is initialized to 0 :-) (Yes, I *know* that
in all three cases the associated memory is immediately assigned some
other value. Today.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agospec: Drop explicit dependency on ncurses
Andrea Bolognani [Sat, 18 Jul 2020 21:54:37 +0000 (23:54 +0200)] 
spec: Drop explicit dependency on ncurses

We don't actually use ncurses directly: readline needs it, but
that's a readline implementation detail and not something that we
should concern ourselves with.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agoqemu_domainjob: introduce `privateData` for `qemuDomainJob`
Prathamesh Chavan [Thu, 16 Jul 2020 11:48:34 +0000 (17:18 +0530)] 
qemu_domainjob: introduce `privateData` for `qemuDomainJob`

To remove dependecy of `qemuDomainJob` on job specific
paramters, a `privateData` pointer is introduced.
To handle it, structure of callback functions is
also introduced.

Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoInclude <sys/socket.h> before including <net/if.h>
Ryan Schmidt [Thu, 9 Jul 2020 05:36:33 +0000 (00:36 -0500)] 
Include <sys/socket.h> before including <net/if.h>

This is necessary for OS X 10.8 and earlier.

Signed-off-by: Ryan Schmidt <git@ryandesign.com>
5 years agospec: Don't require mdevctl on RHEL 7
Andrea Bolognani [Sat, 18 Jul 2020 22:43:08 +0000 (00:43 +0200)] 
spec: Don't require mdevctl on RHEL 7

mdevctl is a relatively new tool that's packaged for Fedora and
RHEL 8, but not for RHEL 7. Make the dependency conditional to
avoid the libvirt-daemon-driver-nodedev package becoming
uninstallable on that platform.

Fixes: 9691440ecbc7d9383a1410f1067a4f9221f2de2c
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agospec: Remove unnecessary version check
Andrea Bolognani [Sat, 18 Jul 2020 21:46:09 +0000 (23:46 +0200)] 
spec: Remove unnecessary version check

As of 65a883b34932 we no longer support Fedora releases older than
31, so the version check has become unnecessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: fix compilation instructions to use separate build dir
Daniel P. Berrangé [Fri, 17 Jul 2020 09:50:22 +0000 (10:50 +0100)] 
docs: fix compilation instructions to use separate build dir

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirNetSocketCheckProtocols: Actually check bool value
Michal Privoznik [Fri, 17 Jul 2020 14:14:23 +0000 (16:14 +0200)] 
virNetSocketCheckProtocols: Actually check bool value

In 9536379da4c8ed61 and 8b0cb0e666f I've tried to call
virNetSocketCheckProtocolByLookup() only if we are suspecting the
host is IPv4 or IPv6 capable (because we've found an interface
with such address). However, the code was missing dereference of
the boolean variables and thus was comparing pointers against
NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>