]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agointernal.h: Introduce and use VIR_IS_POW2()
Michal Privoznik [Wed, 4 Nov 2020 18:41:27 +0000 (19:41 +0100)] 
internal.h: Introduce and use VIR_IS_POW2()

This macro checks whether given number is an integer power of
two. At the same time, I've identified two places where we check
for pow2 and I'm replacing them with the macro.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoviruuid: Rework virUUIDIsValid()
Michal Privoznik [Tue, 24 Nov 2020 10:12:27 +0000 (11:12 +0100)] 
viruuid: Rework virUUIDIsValid()

The only test we do when checking for UUID validity is that
whether all bytes are the same (invalid UUID) or not (valid
UUID). The algorithm we use is needlessly complicated.

Also, the checked UUID is not modified and hence the argument can
be of 'const' type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoconf: checkpoint: Don't require <domain> when redefining checkpoints
Peter Krempa [Wed, 2 Dec 2020 13:18:40 +0000 (14:18 +0100)] 
conf: checkpoint: Don't require <domain> when redefining checkpoints

The domain definition stored with a checkpoint isn't used currently
apart from matching disks when creating a new checkpoints.

As some users of the incremental backup API want to provide backups in
offline mode under their control (obviously while compying with our
documentation on how the on-disk state should be handled) and then want
to define the checkpoint for live use, supplying a <domain> sub-element
is overly complex and not actually needed by the code.

Relax the restriction when re-defining a checkpoint so that <domain> is
not necessary and add (alibistic) documentation saying that future
actions may not work if it's missing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf: checkpoint: Prepare internals for missing domain definition
Peter Krempa [Wed, 2 Dec 2020 13:13:17 +0000 (14:13 +0100)] 
conf: checkpoint: Prepare internals for missing domain definition

Conditionalize code which assumes that the domain definition stored in
the checkpoint is present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirDomainCheckpointRedefineCommit: Don't check ABI of definition in checkpoint
Peter Krempa [Wed, 2 Dec 2020 12:35:29 +0000 (13:35 +0100)] 
virDomainCheckpointRedefineCommit: Don't check ABI of definition in checkpoint

Checking the definition ABI when redefining checkpoints doesn't make
much sense for the following reasons:

* the domain definition in the checkpoint is mostly unused (a relic
  adopted from the snapshot code)

* can be very easily overridden by deleting the checkpoint metadata
  before redefinition

Rather than complicating the logic when we'll be taking into account
that the domain definition may be missing, let's just remove the check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirDomainCheckpointDefParse: Use 'unsigned int' for flags
Peter Krempa [Wed, 2 Dec 2020 13:33:21 +0000 (14:33 +0100)] 
virDomainCheckpointDefParse: Use 'unsigned int' for flags

Fix the type for a variable holding flags to the usual 'unsigned int'
and change the name to be more appropriate to its use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirDomainCheckpointDefParse: Don't extract unused domain type
Peter Krempa [Wed, 2 Dec 2020 13:29:30 +0000 (14:29 +0100)] 
virDomainCheckpointDefParse: Don't extract unused domain type

We can extract './domain' directly and let the parser deal with the
type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agotests: Simplify some ppc64 tests
Andrea Bolognani [Wed, 2 Dec 2020 19:02:52 +0000 (20:02 +0100)] 
tests: Simplify some ppc64 tests

We can leave out things like USB controller, memballoon device,
kernel and initrd since they're not the focus of the tests.

Propagating some information from the output files back to the
input files makes it easier to compare them, as it reduces the
resulting diff, and in the case of the qemuxml2xml test for
memory-hotplug-ppc64-nonuma it allows us to convert the output
file into a symlink, since in the specific case the XML doesn't
change at all.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agotests: Sync some ppc64 tests
Andrea Bolognani [Wed, 2 Dec 2020 18:56:57 +0000 (19:56 +0100)] 
tests: Sync some ppc64 tests

The ppc64 tests

  memory-hotplug-ppc64-nonuma
  memory-hotplug-nvdimm-ppc64

are not passed the same information for qemuxml2argv and
qemuxml2xml tests; the former, in particular, doesn't show up
at all in qemuxml2xml. Address this inconsistency.

Note that one of the new output files had been introduced with
5540acb9a2bd despite not being actually used as of that commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agocpu_map: Fix Icelake Server model number
Tim Wiederhake [Wed, 2 Dec 2020 10:38:22 +0000 (11:38 +0100)] 
cpu_map: Fix Icelake Server model number

See arch/x86/include/asm/intel-family.h in the Kernel:
  #define INTEL_FAM6_ICELAKE_X 0x6A

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoapparmor: Allow lxc processes to receive signals from libvirt
Jim Fehlig [Wed, 2 Dec 2020 23:24:21 +0000 (16:24 -0700)] 
apparmor: Allow lxc processes to receive signals from libvirt

LXC processes confined by apparmor are not permitted to receive signals
from libvirtd. Attempting to destroy such a process fails

virsh --connect lxc:/// destroy distro_apparmor
 error: Failed to destroy domain distro_apparmor
 error: Failed to kill process 29491: Permission denied

And from /var/log/audit/audit.log

type=AVC msg=audit(1606949706.142:6345): apparmor="DENIED"
operation="signal" profile="libvirt-314b7109-fdce-48dc-ad28-7c47958a27c1"
pid=29390 comm="libvirtd" requested_mask="receive" denied_mask="receive"
signal=term peer="libvirtd"

Similar to the libvirt-qemu abstraction, add a rule to the libvirt-lxc
abstraction allowing reception of signals from libvirtd.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agoqemuxml2xmltest.c: honor ARG_PARSEFLAGS
Daniel Henrique Barboza [Wed, 18 Nov 2020 16:28:09 +0000 (13:28 -0300)] 
qemuxml2xmltest.c: honor ARG_PARSEFLAGS

At this moment,  it is not possible to create a test specifying
ARG_PARSEFLAGS because info->parseFlags is not being forwarded to
testCompareDomXML2XMLFiles(). Let's fix it now so next patch can
make use of it.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: move memory size align to qemuProcessPrepareDomain()
Daniel Henrique Barboza [Wed, 18 Nov 2020 18:12:51 +0000 (15:12 -0300)] 
qemu: move memory size align to qemuProcessPrepareDomain()

qemuBuildCommandLine() is calling qemuDomainAlignMemorySizes(),
which is an operation that changes live XML and domain and has
little to do with the command line build process.

Move it to qemuProcessPrepareDomain() where we're supposed to
make live XML and domain changes before launch. qemuProcessStart()
is setting VIR_QEMU_PROCESS_START_NEW if !migrate && !snapshot,
same conditions used in qemuBuildCommandLine() to call
qemuDomainAlignMemorySizes(), making this change seamless.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu_process.c: check migrateURI when setting VIR_QEMU_PROCESS_START_NEW
Daniel Henrique Barboza [Wed, 18 Nov 2020 17:56:24 +0000 (14:56 -0300)] 
qemu_process.c: check migrateURI when setting VIR_QEMU_PROCESS_START_NEW

qemuProcessCreatePretendCmdPrepare() is setting the
VIR_QEMU_PROCESS_START_NEW regardless of whether this is
a migration case or not. This behavior differs from what we're
doing in qemuProcessStart(), where the flag is set only
if !migrate && !snapshot.

Fix it by making the flag setting consistent with what we're
doing in qemuProcessStart().

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: Pass / fill niothreads for qemuMonitorGetIOThreads
John Ferlan [Wed, 2 Dec 2020 17:34:24 +0000 (12:34 -0500)] 
qemu: Pass / fill niothreads for qemuMonitorGetIOThreads

Let's pass along / fill @niothreads rather than trying to make dual
use as a return value and thread count.

This resolves a Coverity issue detected in qemuDomainGetIOThreadsMon
where if qemuDomainObjExitMonitor failed, then a -1 was returned and
overwrite @niothreads causing a memory leak.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: squelch G_DEFINE_TYPE volatile warnings with GCC 11
Daniel P. Berrangé [Thu, 3 Dec 2020 11:33:29 +0000 (11:33 +0000)] 
util: squelch G_DEFINE_TYPE volatile warnings with GCC 11

In this previous commit:

  commit 65491a2dfe00bfcf9f09a8d6eab60234b56c8cc4
  Author: Martin Kletzander <mkletzan@redhat.com>
  Date:   Thu Nov 12 13:58:53 2020 +0100

    Do not disable incompatible-pointer-types-discards-qualifiers

We selectively rewrite G_DEFINE_TYPE to avoid warnings about
mismatched volatile/non-volatile pointers that appeared with
CLang when using GLib2 >= 2.67

We have now just hit the reverse problem, GCC >= 11 has started
warning about mismatched volatile/non-volatile pointers but only
with GLib2 < 2.67. The new GLib2 avoids the warning, as does
older GCC.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agosrc: use singular form instead of plural, for guest disk info
Daniel P. Berrangé [Wed, 2 Dec 2020 12:08:14 +0000 (12:08 +0000)] 
src: use singular form instead of plural, for guest disk info

Existing practice with the filesystem fields reported for the
virDomainGetGuestInfo API is to use the singular form for
field names. Ensure the disk info follows this practice.

Fixes

  commit 05a75ca2ce743bc0bb119fb8d532ff84646fafa3
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Nov 20 22:09:46 2020 +0400

    domain: add disk informations to virDomainGetGuestInfo

  commit 0cb2d9f05d00497a715352f6ea28cf8fb6921731
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Nov 20 22:09:47 2020 +0400

    qemu_driver: report guest disk informations

  commit 172b8304352b1945e328394e61290a24446280dd
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Nov 20 22:09:48 2020 +0400

    virsh: add --disk informations to guestinfo command

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Use virDomainDiskByName
Peter Krempa [Tue, 1 Dec 2020 16:55:54 +0000 (17:55 +0100)] 
virDomainSnapshotAlignDisks: Use virDomainDiskByName

We don't need the index that virDomainDiskIndexByName returns.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: Use virDomainDiskByName
Peter Krempa [Tue, 1 Dec 2020 16:55:54 +0000 (17:55 +0100)] 
virDomainCheckpointAlignDisks: Use virDomainDiskByName

We don't need the index that virDomainDiskIndexByName returns.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainDiskByName: Remove ternary operator
Peter Krempa [Tue, 1 Dec 2020 16:54:41 +0000 (17:54 +0100)] 
virDomainDiskByName: Remove ternary operator

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointDiskDef: Remove unused 'idx' field
Peter Krempa [Wed, 2 Dec 2020 12:08:31 +0000 (13:08 +0100)] 
virDomainCheckpointDiskDef: Remove unused 'idx' field

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: refactor extension to all disks
Peter Krempa [Tue, 1 Dec 2020 17:10:00 +0000 (18:10 +0100)] 
virDomainCheckpointAlignDisks: refactor extension to all disks

Similarly to d3c029bb105 where we've refactored
virDomainSnapshotAlignDisks, modify the extension algorithm to avoid use
of the 'idx' variable and sorting of the array.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: Extract domain disk def pointer to 'domdisk'
Peter Krempa [Tue, 1 Dec 2020 17:03:47 +0000 (18:03 +0100)] 
virDomainCheckpointAlignDisks: Extract domain disk def pointer to 'domdisk'

Add a local variable holding the pointer instead of indexing the array
multiple times.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: Use 'chkdisk' instead of 'disk'
Peter Krempa [Tue, 1 Dec 2020 16:22:21 +0000 (17:22 +0100)] 
virDomainCheckpointAlignDisks: Use 'chkdisk' instead of 'disk'

Clarify that the variable refers to the definition of the disk from the
checkpoint definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: rename 'def' to 'chkdef'
Peter Krempa [Tue, 1 Dec 2020 16:20:10 +0000 (17:20 +0100)] 
virDomainCheckpointAlignDisks: rename 'def' to 'chkdef'

In most cases 'def' is used for the domain definition. Rename it to
chkdef to prevent confusion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: Use 'domdef' for domain definition
Peter Krempa [Tue, 1 Dec 2020 16:18:44 +0000 (17:18 +0100)] 
virDomainCheckpointAlignDisks: Use 'domdef' for domain definition

Extract the pointer and use a local variable throughout the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: Unbreak error message
Peter Krempa [Tue, 1 Dec 2020 16:57:23 +0000 (17:57 +0100)] 
virDomainCheckpointAlignDisks: Unbreak error message

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainCheckpointAlignDisks: Refactor cleanup
Peter Krempa [Tue, 1 Dec 2020 16:04:03 +0000 (17:04 +0100)] 
virDomainCheckpointAlignDisks: Refactor cleanup

Use g_autoptr for virBitmap and get rid of the 'cleanup:' label and ret
variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: Fix segfault when parsing mdev types
Jonathon Jongsma [Wed, 2 Dec 2020 17:52:39 +0000 (11:52 -0600)] 
conf: Fix segfault when parsing mdev types

Commit f1b0890 introduced a potential crash due to incorrect operator
precedence when accessing an element from a pointer to an array.

Backtrace below:

  #0  virNodeDeviceGetMdevTypesCaps (sysfspath=0x7fff801661e0 "/sys/devices/pci0000:00/0000:00:02.0", mdev_types=0x7fff801c9b40, nmdev_types=0x7fff801c9b48) at ../src/conf/node_device_conf.c:2676
  #1  0x00007ffff7caf53d in virNodeDeviceGetPCIDynamicCaps (sysfsPath=0x7fff801661e0 "/sys/devices/pci0000:00/0000:00:02.0", pci_dev=0x7fff801c9ac8) at ../src/conf/node_device_conf.c:2705
  #2  0x00007ffff7cae38f in virNodeDeviceUpdateCaps (def=0x7fff80168a10) at ../src/conf/node_device_conf.c:2342
  #3  0x00007ffff7cb11c0 in virNodeDeviceObjMatch (obj=0x7fff84002e50, flags=0) at ../src/conf/virnodedeviceobj.c:850
  #4  0x00007ffff7cb153d in virNodeDeviceObjListExportCallback (payload=0x7fff84002e50, name=0x7fff801cbc20 "pci_0000_00_02_0", opaque=0x7fffe2ffc6a0) at ../src/conf/virnodedeviceobj.c:909
  #5  0x00007ffff7b69146 in virHashForEach (table=0x7fff9814b700 = {...}, iter=0x7ffff7cb149e <virNodeDeviceObjListExportCallback>, opaque=0x7fffe2ffc6a0) at ../src/util/virhash.c:394
  #6  0x00007ffff7cb1694 in virNodeDeviceObjListExport (conn=0x7fff98013170, devs=0x7fff98154430, devices=0x7fffe2ffc798, filter=0x7ffff7cf47a1 <virConnectListAllNodeDevicesCheckACL>, flags=0)
          at ../src/conf/virnodedeviceobj.c:943
  #7  0x00007fffe00694b2 in nodeConnectListAllNodeDevices (conn=0x7fff98013170, devices=0x7fffe2ffc798, flags=0) at ../src/node_device/node_device_driver.c:228
  #8  0x00007ffff7e703aa in virConnectListAllNodeDevices (conn=0x7fff98013170, devices=0x7fffe2ffc798, flags=0) at ../src/libvirt-nodedev.c:130
  #9  0x000055555557f796 in remoteDispatchConnectListAllNodeDevices (server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000, rerr=0x7fffe2ffc8a0, args=0x7fffd4008470, ret=0x7fffd40084e0)
          at src/remote/remote_daemon_dispatch_stubs.h:1613
  #10 0x000055555557f6f9 in remoteDispatchConnectListAllNodeDevicesHelper (server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000, rerr=0x7fffe2ffc8a0, args=0x7fffd4008470, ret=0x7fffd40084e0)
          at src/remote/remote_daemon_dispatch_stubs.h:1591
  #11 0x00007ffff7ce9542 in virNetServerProgramDispatchCall (prog=0x555555690c10, server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000) at ../src/rpc/virnetserverprogram.c:428
  #12 0x00007ffff7ce90bd in virNetServerProgramDispatch (prog=0x555555690c10, server=0x555555627080, client=0x5555556bf050, msg=0x5555556c0000) at ../src/rpc/virnetserverprogram.c:302
  #13 0x00007ffff7cf042b in virNetServerProcessMsg (srv=0x555555627080, client=0x5555556bf050, prog=0x555555690c10, msg=0x5555556c0000) at ../src/rpc/virnetserver.c:137
  #14 0x00007ffff7cf04eb in virNetServerHandleJob (jobOpaque=0x5555556b66b0, opaque=0x555555627080) at ../src/rpc/virnetserver.c:154
  #15 0x00007ffff7bd912f in virThreadPoolWorker (opaque=0x55555562bc70) at ../src/util/virthreadpool.c:163
  #16 0x00007ffff7bd8645 in virThreadHelper (data=0x55555562bc90) at ../src/util/virthread.c:233
  #17 0x00007ffff6d90432 in start_thread () at /lib64/libpthread.so.0
  #18 0x00007ffff75c5913 in clone () at /lib64/libc.so.6

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 3 Dec 2020 06:30:59 +0000 (07:30 +0100)] 
Translated using Weblate (Finnish)

Currently translated at 8.8% (921 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 8.7% (914 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 7.6% (797 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 6.6% (695 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 6.2% (657 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 4.7% (501 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 4.7% (493 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 4.7% (491 of 10440 strings)

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

Translated using Weblate (Finnish)

Currently translated at 4.6% (489 of 10440 strings)

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

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 3 Dec 2020 06:30:58 +0000 (07:30 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 11.9% (1250 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 11.6% (1220 of 10440 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoqemu: support logfile on live attaching chardev
Nikolay Shirokovskiy [Wed, 2 Dec 2020 11:44:38 +0000 (14:44 +0300)] 
qemu: support logfile on live attaching chardev

Currently it is simply ignored.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: support append param on live attaching file chardev
Nikolay Shirokovskiy [Wed, 2 Dec 2020 11:43:25 +0000 (14:43 +0300)] 
qemu: support append param on live attaching file chardev

Currently it is simply ignored.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agocoding-style: Document 100 chars limit for line length
Michal Privoznik [Mon, 30 Nov 2020 12:55:12 +0000 (13:55 +0100)] 
coding-style: Document 100 chars limit for line length

The idea is to have it like a soft limit: if possible then break
lines, if not then have a long line instead of some creative
approach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: Fix some issues in virQEMUDriverConfigLoadNVRAMEntry
John Ferlan [Wed, 2 Dec 2020 12:43:21 +0000 (07:43 -0500)] 
qemu: Fix some issues in virQEMUDriverConfigLoadNVRAMEntry

Commit c4f4e195 fixed a double free, but if the code returns before
we realloc the list and virFirmwareFreeList was called with cfg->nfirmwares
> 0 (e.g. during virQEMUDriverConfigDispose), then it would be rather
disastrous. So let's reinitialize that too to indicate the list is empty.

Coverity pointed out that using nvram[0] as a guard to reallocating the
list could lead to a possible NULL deref. While nvram[0] may always be
true in this case, if it wasn't then the subsequent for loop would fail.
Just reallocate always regardless - even if nfirmwares == 0 as
virFirmwareFreeList will free it for us anyway.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agolocking: Resolve mem leak in virLockDaemonPreExecRestart
John Ferlan [Wed, 2 Dec 2020 12:43:20 +0000 (07:43 -0500)] 
locking: Resolve mem leak in virLockDaemonPreExecRestart

Initialize and free @magic since virJSONValueObjectAppendString
does not free it for us eventually.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agologging: Resolve mem leak in virLogDaemonPreExecRestart
John Ferlan [Wed, 2 Dec 2020 12:43:19 +0000 (07:43 -0500)] 
logging: Resolve mem leak in virLogDaemonPreExecRestart

Initialize and free @magic since virJSONValueObjectAppendString
does not free it for us eventually.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: Fix link for virConnectGetStoragePoolCapabilities
John Ferlan [Wed, 2 Dec 2020 12:43:17 +0000 (07:43 -0500)] 
docs: Fix link for virConnectGetStoragePoolCapabilities

The API is in the storage family not the domain family

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Fix memory leak in virNetDevOpenvswitchInterfaceGetMaster
John Ferlan [Wed, 2 Dec 2020 12:43:15 +0000 (07:43 -0500)] 
util: Fix memory leak in virNetDevOpenvswitchInterfaceGetMaster

Since 032548c4 @cmd was never autofree'd. Perhaps as a result of
VIR_AUTOPTR type changes occurring at roughly the same time so the
copy pasta missed this.

Found by Coverity.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Drop qemuMonitorGetVirtType()
Michal Privoznik [Wed, 2 Dec 2020 14:47:02 +0000 (15:47 +0100)] 
qemu: Drop qemuMonitorGetVirtType()

It's unused since v5.5.0-rc1~113.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirstring: Drop VIR_AUTOSTRINGLIST
Michal Privoznik [Tue, 1 Dec 2020 08:22:55 +0000 (09:22 +0100)] 
virstring: Drop VIR_AUTOSTRINGLIST

Now that no one uses VIR_AUTOSTRINGLIST it can be dropped.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolib: Replace VIR_AUTOSTRINGLIST with GStrv
Michal Privoznik [Tue, 1 Dec 2020 08:21:32 +0000 (09:21 +0100)] 
lib: Replace VIR_AUTOSTRINGLIST with GStrv

Glib provides g_auto(GStrv) which is in-place replacement of our
VIR_AUTOSTRINGLIST.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainGetGuestInfo: Exit early if getting info fails
Michal Privoznik [Tue, 1 Dec 2020 10:47:13 +0000 (11:47 +0100)] 
qemuDomainGetGuestInfo: Exit early if getting info fails

If there is an error getting info from guest agent, then the
control on qemuDomainGetGuestInfo() jumps onto 'exitagent' label
and subsequently continues on 'endagentjob'. Both labels are hit
also in success case too. The control then continues by
attempting to match fetched info (e.g. disk addresses) with
domain def. But this is needless - the API will return error
regardless.

To return early from the function move both 'exitagent' and
'endagentjob' labels at the end of the function and jump straight
onto 'cleanup' afterwards. This allows us to set 'ret = 0' later
- only when we know we succeeded.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agomeson: add winsock2 library on windows builds
Daniel P. Berrangé [Tue, 1 Dec 2020 20:15:20 +0000 (20:15 +0000)] 
meson: add winsock2 library on windows builds

If building for windows with curl disabled we get build failures due to
missing ws2_32 library needed for winsock2.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoscripts: ignore whitespace in pdwtags output
Daniel P. Berrangé [Wed, 2 Dec 2020 10:20:44 +0000 (10:20 +0000)] 
scripts: ignore whitespace in pdwtags output

The pdwtags program changed its whitespace formatting for enum
values in release 1.19:

  @@ -145,22 +145,22 @@
           u_int                      flags;
   };
   enum admin_procedure {
  -        ADMIN_PROC_CONNECT_OPEN = 1,
  -        ADMIN_PROC_CONNECT_CLOSE = 2,
  -        ADMIN_PROC_CONNECT_GET_LIB_VERSION = 3,
  -        ADMIN_PROC_CONNECT_LIST_SERVERS = 4,
  -        ADMIN_PROC_CONNECT_LOOKUP_SERVER = 5,
  +        ADMIN_PROC_CONNECT_OPEN                     = 1,
  +        ADMIN_PROC_CONNECT_CLOSE                    = 2,
  +        ADMIN_PROC_CONNECT_GET_LIB_VERSION          = 3,
  +        ADMIN_PROC_CONNECT_LIST_SERVERS             = 4,
  +        ADMIN_PROC_CONNECT_LOOKUP_SERVER            = 5,

Workaround this by telling diff to ignore whitespace changes.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemuMonitorGetCommandLineOptionParameters: remove the unused function and helpers
Peter Krempa [Mon, 30 Nov 2020 17:13:32 +0000 (18:13 +0100)] 
qemuMonitorGetCommandLineOptionParameters: remove the unused function and helpers

Remove the function along with helpers for caching the reply and tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirQEMUCapsProbeQMPCommandLine: Rewrite using qemuMonitorGetCommandLineOptions
Peter Krempa [Mon, 30 Nov 2020 17:05:23 +0000 (18:05 +0100)] 
virQEMUCapsProbeQMPCommandLine: Rewrite using qemuMonitorGetCommandLineOptions

Use the new handler to fetch the required data and do the extraction
locally without conversion to string list.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: monitor: Implement new handlers for 'query-command-line-options'
Peter Krempa [Mon, 30 Nov 2020 16:54:25 +0000 (17:54 +0100)] 
qemu: monitor: Implement new handlers for 'query-command-line-options'

Add a new set hander for getting the data for
'query-command-line-options' which returns everything at once and lets
the caller extract the data. This way we don't need to cache the output
of the monitor command for repeated calls.

Note that we will have enough testing of this code path via
qemucapabilitiestest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agogitlab: Add issue template for a feature request
Peter Krempa [Thu, 26 Nov 2020 13:16:16 +0000 (14:16 +0100)] 
gitlab: Add issue template for a feature request

Try to motivate the users to describe what they want to achieve before
diving down into technical specifics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agogitlab: Add issue template for reporting a bug
Peter Krempa [Thu, 26 Nov 2020 13:09:46 +0000 (14:09 +0100)] 
gitlab: Add issue template for reporting a bug

When reporting an issue in gitlab, the project can define a template for
various scenarios which are meant to guide the users to add the relevant
information the project needs to the reported issue.

Add a template for a bug report against libvirt. The template adds
sections which motivate users to add version information and also link
to documentation about fetching logs and such.

Note that markdown seems to be the only supported format for now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodomain_conf.c: modernize virDomainDefControllersParse()
Daniel Henrique Barboza [Tue, 24 Nov 2020 14:22:00 +0000 (11:22 -0300)] 
domain_conf.c: modernize virDomainDefControllersParse()

The 'error' label is just returning -1, so let's 'return -1'
directly.

Use g_autoptr() with virDomainControllerDefPtr to remove the
need to call virDomainControllerDefFree() in the error path.

There is no need to VIR_FREE(nodes) explictly since 'nodes'
is using g_autofree.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: modernize virDomainControllerDefParseXML()
Daniel Henrique Barboza [Tue, 24 Nov 2020 14:12:51 +0000 (11:12 -0300)] 
domain_conf.c: modernize virDomainControllerDefParseXML()

Let's register AUTOPTR_CLEANUP_FUNC for virDomainControllerDefPtr
and modernize this function, removing the 'error' label using
g_autoptr().

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: remove 'error' label in virDomainDefTunablesParse()
Daniel Henrique Barboza [Mon, 23 Nov 2020 13:06:55 +0000 (10:06 -0300)] 
domain_conf.c: remove 'error' label in virDomainDefTunablesParse()

The 'error' label is just doing a 'return -1'.

There's also a couple of 'VIR_FREE(nodes)' calls that are happening
right before exiting on error, but 'nodes' is already set for
autocleanup. These calls can also be removed.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: modernize virDomainSmartcardDefParseXML
Daniel Henrique Barboza [Fri, 20 Nov 2020 19:09:13 +0000 (16:09 -0300)] 
domain_conf.c: modernize virDomainSmartcardDefParseXML

Register a AUTOPTR_CLEANUP_FUNC for virDomainSmartcardDef and use
g_autoptr() to eliminate the 'error' label.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: modernize virDomainDiskDefParseXML()
Daniel Henrique Barboza [Thu, 19 Nov 2020 21:05:21 +0000 (18:05 -0300)] 
domain_conf: modernize virDomainDiskDefParseXML()

Register an AUTOPTR_CLEANUP_FUNC for virDomainDiskDefPtr, then
use g_autoptr() in virDomainDiskDef and virStorageEncryption
pointers to get rid of the 'cleanup' and 'error' labels.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirstorageencryption.h: add AUTOPTR_CLEANUP_FUNC for virStorageEncryptionPtr
Daniel Henrique Barboza [Thu, 19 Nov 2020 21:03:42 +0000 (18:03 -0300)] 
virstorageencryption.h: add AUTOPTR_CLEANUP_FUNC for virStorageEncryptionPtr

This will open an opportunity to modernize virDomainDiskDefParseXML()
in the next patch.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: use g_autoptr() with virDomainVideoDefPtr
Daniel Henrique Barboza [Thu, 19 Nov 2020 20:02:35 +0000 (17:02 -0300)] 
domain_conf.c: use g_autoptr() with virDomainVideoDefPtr

This will modernize virDomainVideoDefParseXML() and
virDomainDefAddImplicitVideo() by removing unneeded
cleanup labels.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: do not leak 'video' in virDomainDefParseXML()
Daniel Henrique Barboza [Thu, 19 Nov 2020 16:57:43 +0000 (13:57 -0300)] 
domain_conf.c: do not leak 'video' in virDomainDefParseXML()

The 'video' pointer is only being freed on error path, meaning
that we're leaking it after each loop restart.

There are more opportunities for auto cleanups of virDomainVideoDef
pointers, so let's register AUTOPTR_CLEANUP_FUNC for it to use
g_autoptr() later on.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: modernize virDomainDefBootOrderPostParse()
Daniel Henrique Barboza [Mon, 16 Nov 2020 20:40:17 +0000 (17:40 -0300)] 
domain_conf.c: modernize virDomainDefBootOrderPostParse()

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

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: use g_autofree in 'dev' in virDomainDefParseBootXML()
Daniel Henrique Barboza [Mon, 16 Nov 2020 20:34:00 +0000 (17:34 -0300)] 
domain_conf.c: use g_autofree in 'dev' in virDomainDefParseBootXML()

This spares us of 2 explicit VIR_FREE() calls.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agotestsutilsqemu: check return value of virQEMUCapsNewCopy
Ján Tomko [Fri, 20 Nov 2020 12:39:37 +0000 (13:39 +0100)] 
testsutilsqemu: check return value of virQEMUCapsNewCopy

While for virQEMUCapsNew this should not be needed
(the possible failures in VIR_CLASS_NEW are only hit
 on bad API usage which we don't do here),
virQEMUCapsNewCopy calls into many other functions,
some of which actually fail.

Check the return value of both.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: use qemuVirCommandGetDevSet less
Ján Tomko [Tue, 24 Nov 2020 13:49:19 +0000 (14:49 +0100)] 
qemu: use qemuVirCommandGetDevSet less

Do not look up the index of the passed FD in places where
we already have it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: introduce qemuBuildFDSet
Ján Tomko [Tue, 24 Nov 2020 13:42:58 +0000 (14:42 +0100)] 
qemu: introduce qemuBuildFDSet

An alternative to qemuVirCommandGetFDSet that takes the index
into the passed FD set as an argument and does not try to look it up.

Use it as well ass virCommandPassFDIndex in qemuBuildChrChardevFileStr
and qemuBuildInterfaceCommandLine.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: introduce virCommandPassFDIndex
Ján Tomko [Tue, 24 Nov 2020 13:11:36 +0000 (14:11 +0100)] 
util: introduce virCommandPassFDIndex

Just like virCommandPassFD, but it also returns an index of
the passed FD in the FD set.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoudevConnectListAllInterfaces: delete pointless cleanup code
Ján Tomko [Fri, 20 Nov 2020 13:10:58 +0000 (14:10 +0100)] 
udevConnectListAllInterfaces: delete pointless cleanup code

We only jump to cleanup before allocating any lists.

Drop the dead code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoudevConnectListAllInterfaces: initialize ret
Ján Tomko [Fri, 20 Nov 2020 13:05:54 +0000 (14:05 +0100)] 
udevConnectListAllInterfaces: initialize ret

Currently, ret is only used in the 'cleanup' section
and initialized right before the jump.

Switch to the customary initialization to -1 and only
leave in the 'ret = 0' statement on an empty list.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Use virJSONValueObjectGetStringArray() more
Michal Privoznik [Tue, 1 Dec 2020 10:47:30 +0000 (11:47 +0100)] 
qemu: Use virJSONValueObjectGetStringArray() more

In a few commit back (v6.10.0-5-gb3dad96972) a new helper for
obtaining string arrays from a virJSONObject was introduced:
virJSONValueObjectGetStringArray(). I've identified three places
where it can be used instead of open coding it:
qemuAgentSSHGetAuthorizedKeys(),
qemuMonitorJSONGetStringListProperty() and
qemuMonitorJSONGetCPUDefinitions().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirJSONValueObjectGetStringArray: Report error if @key is not an array
Michal Privoznik [Tue, 1 Dec 2020 11:10:34 +0000 (12:10 +0100)] 
virJSONValueObjectGetStringArray: Report error if @key is not an array

The virJSONValueObjectGetStringArray() function is given a @key
which is supposed to be an array inside given @object. Well, if
it's not then an error state is returned (NULL), but no error
message is set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: Update language bindings spotlight
Andrea Bolognani [Tue, 1 Dec 2020 15:30:52 +0000 (16:30 +0100)] 
docs: Update language bindings spotlight

We should highlight the language bindings that are actively
maintained, keep up with the core library's development pace,
have good API coverage and are relevant to people looking to
integrate libvirt into their projects today: based on these
criteria, it makes sense to highlight the Go binding instead
of the Java one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu_conf: Fix double free problem for cfg->firmwares
Tuguoyi [Tue, 24 Nov 2020 03:12:00 +0000 (03:12 +0000)] 
qemu_conf: Fix double free problem for cfg->firmwares

cfg->firmwares still points to the original memory address after being
freed by virFirmwareFreeList(). As cfg get freed, it will be freed again
even if cfg->nfirmwares=0 which eventually lead to crash.

The patch fix it by setting cfg->firmwares to NULL explicitly after
virFirmwareFreeList() returns

Signed-off-by: Guoyi Tu<tu.guoyi@h3c.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovircgroupv2: fix virCgroupV2DenyDevice
Pavel Hrdina [Wed, 25 Nov 2020 16:21:49 +0000 (17:21 +0100)] 
vircgroupv2: fix virCgroupV2DenyDevice

The original logic is incorrect. We would delete the device entry
from eBPF map only if the newval would be same as current val in the
map. In case that the device was allowed only as read-only but later
we remove all permissions for that device it would remain in the table
with empty values.

The old code would still deny the device but it's not working as
intended. Instead we will update the value in advance. If the updated
value is 0 it means that we are removing all permissions so it should
be removed from the map, otherwise we will update the value in map.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovircgroup: fix cpu quota maximum limit
Pavel Hrdina [Wed, 25 Nov 2020 11:41:16 +0000 (12:41 +0100)] 
vircgroup: fix cpu quota maximum limit

Kernel commit <d505b8af58912ae1e1a211fabc9995b19bd40828> added proper
check for cpu quota maximum limit to prevent internal overflow.

Even though this change is not present in all kernels it makes sense
to enforce the same limit in libvirt.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovircgroupv2: use defines for cpu period and quota limits
Pavel Hrdina [Wed, 25 Nov 2020 10:54:53 +0000 (11:54 +0100)] 
vircgroupv2: use defines for cpu period and quota limits

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovircgroupv1: use defines for cpu period and quota limits
Pavel Hrdina [Wed, 25 Nov 2020 10:54:01 +0000 (11:54 +0100)] 
vircgroupv1: use defines for cpu period and quota limits

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: move cgroup cpu period and quota defines to vircgroup.h
Pavel Hrdina [Wed, 25 Nov 2020 10:47:02 +0000 (11:47 +0100)] 
qemu: move cgroup cpu period and quota defines to vircgroup.h

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agovirsh: add --disk informations to guestinfo command
Marc-André Lureau [Fri, 20 Nov 2020 18:09:48 +0000 (22:09 +0400)] 
virsh: add --disk informations to guestinfo command

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemu_driver: report guest disk informations
Marc-André Lureau [Fri, 20 Nov 2020 18:09:47 +0000 (22:09 +0400)] 
qemu_driver: report guest disk informations

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agodomain: add disk informations to virDomainGetGuestInfo
Marc-André Lureau [Fri, 20 Nov 2020 18:09:46 +0000 (22:09 +0400)] 
domain: add disk informations to virDomainGetGuestInfo

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemu_agent: add qemuAgentGetDisks
Marc-André Lureau [Fri, 20 Nov 2020 18:09:45 +0000 (22:09 +0400)] 
qemu_agent: add qemuAgentGetDisks

guest-get-disks is available since QEMU 5.2:
https://wiki.qemu.org/ChangeLog/5.2#Guest_agent

Note that the test response was manually edited based on a reply on my
bare-metal computer. It shows partial results due to pcieport driver not
being currently supported by QGA.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemu: use virJSONValueObjectGetStringArray
Marc-André Lureau [Fri, 20 Nov 2020 18:09:44 +0000 (22:09 +0400)] 
qemu: use virJSONValueObjectGetStringArray

There might be more potential users around, I haven't looked thoroughly.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoutil: json: add virJSONValueObjectGetStringArray convenience
Marc-André Lureau [Fri, 20 Nov 2020 18:09:43 +0000 (22:09 +0400)] 
util: json: add virJSONValueObjectGetStringArray convenience

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemu_agent: factor out qemuAgentGetDiskAddress
Marc-André Lureau [Fri, 20 Nov 2020 18:09:42 +0000 (22:09 +0400)] 
qemu_agent: factor out qemuAgentGetDiskAddress

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemu_agent: export qemuAgentDiskAddressFree & add g_auto
Marc-André Lureau [Fri, 20 Nov 2020 18:09:41 +0000 (22:09 +0400)] 
qemu_agent: export qemuAgentDiskAddressFree & add g_auto

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoqemu_agent: rename qemuAgentDiskInfo->qemuAgentDiskAddress
Marc-André Lureau [Fri, 20 Nov 2020 18:09:40 +0000 (22:09 +0400)] 
qemu_agent: rename qemuAgentDiskInfo->qemuAgentDiskAddress

To match the QGA schema name (we are introducing a qemuAgentDiskInfo
struct again for different purpose).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Han Han <hhan@redhat.com>
4 years agoPost-release version bump to 7.0.0
Jiri Denemark [Tue, 1 Dec 2020 08:54:20 +0000 (09:54 +0100)] 
Post-release version bump to 7.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-6.10.0 v6.10.0
Jiri Denemark [Tue, 1 Dec 2020 08:51:03 +0000 (09:51 +0100)] 
Release of libvirt-6.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoNEWS: Mention network disk support in 'virsh attach-disk'
Peter Krempa [Thu, 26 Nov 2020 08:17:03 +0000 (09:17 +0100)] 
NEWS: Mention network disk support in 'virsh attach-disk'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoNEWS: add note about virt-ssh-helper perf improvements
Daniel P. Berrangé [Fri, 27 Nov 2020 10:07:34 +0000 (10:07 +0000)] 
NEWS: add note about virt-ssh-helper perf improvements

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemucapsprobemock: Fix lookup of qemu functions v6.10.0-rc2
Roman Bolshakov [Mon, 23 Nov 2020 22:10:18 +0000 (01:10 +0300)] 
qemucapsprobemock: Fix lookup of qemu functions

qemucapsprobemock can't find real versions of qemuMonitorSend() and
qemuMonitorJSONIOProcessLine() on macOS. That breaks qemucapsprobe.

The failure can be explained by documented behaviour of dlsym(3) on
macOS:

  If dlsym() is called with the special handle RTLD_NEXT, then dyld
  searches for the symbol in the dylibs the calling image linked against
  when built.

  [...] For flat linked images, the search starts in the load ordered
  list of all images, in the image right after the caller's image.

That means qemucapsprobemock must be linked against qemu test driver to
find symbols there with RTLD_NEXT.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Delay mock creation
Roman Bolshakov [Mon, 23 Nov 2020 22:10:17 +0000 (01:10 +0300)] 
tests: Delay mock creation

There might be mocks that need to reference qemu test driver and link
with it. It's not possible now because qemu test driver is defined after
mocks.

While at it, add 'link_with' parameter to mock definition that allows to
specify a set of libraries the mock has to be linked with.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoci: Run test suite on macOS
Roman Bolshakov [Mon, 23 Nov 2020 22:10:16 +0000 (01:10 +0300)] 
ci: Run test suite on macOS

There's no need to have different CI process between macOS and FreeBSD
as test suite has been fixed on macOS.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: Increase timeout
Roman Bolshakov [Mon, 23 Nov 2020 22:10:15 +0000 (01:10 +0300)] 
qemuxml2argvtest: Increase timeout

The test takes 40+ seconds on MBP 2012, MBA 2015. Cirrus completes the
test within default timeout, just above 29 seconds but the error margin
is narrow, under a second.

It'd be good to provide reasonable default timeout to avoid test suite
failure if "meson test" is invoked without arguments.

Closes https://gitlab.com/libvirt/libvirt/-/issues/58
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Fix mock chaining on macOS
Roman Bolshakov [Mon, 23 Nov 2020 22:10:14 +0000 (01:10 +0300)] 
tests: Fix mock chaining on macOS

Some tests in qemuxml2argvtest need opendir() from virpcimock, others
need opendir() from virfilewrapper.

But as of now, only opendir() from virpcimock has an effect.
real_opendir in virpcimock has a pointer to opendir$INODE64 in
libsystem_kernel.dylib instead of pointing to opendir$INODE64 in
qemuxml2argvtest (from virfilewrapper). And because the second one is
never used, tests that rely on prefixes added by virFileWrapperAddPrefix
fail.

That can be fixed if dlsym(3) is asked explicitly to search symbols in
main executable with RTLD_MAIN_ONLY before going to other dylibs.
Existing RTLD_NEXT handle results into libsystem_kernel.dylib being
searched before main executable.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Fix opendir mocks on macOS
Roman Bolshakov [Mon, 23 Nov 2020 22:10:13 +0000 (01:10 +0300)] 
tests: Fix opendir mocks on macOS

opendir() mocks need to search for decorated function with $INODE64
suffix, like stat mocks.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 27 Nov 2020 14:16:10 +0000 (15:16 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 10.5% (1100 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 10.2% (1070 of 10440 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Fri, 27 Nov 2020 14:16:09 +0000 (15:16 +0100)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10440 of 10440 strings)

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

Translated using Weblate (Ukrainian)

Currently translated at 99.3% (10370 of 10440 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agoUpdate translation files
Weblate [Fri, 27 Nov 2020 14:16:07 +0000 (15:16 +0100)] 
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/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 27 Nov 2020 14:16:03 +0000 (15:16 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 10.0% (1041 of 10399 strings)

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

Translated using Weblate (Swedish)

Currently translated at 9.4% (981 of 10399 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoci: Switch to meson build system
Erik Skultety [Mon, 9 Nov 2020 11:20:52 +0000 (12:20 +0100)] 
ci: Switch to meson build system

Add meson required bits to the ci logic in the repo to be able to run
a meson build in a container.
This patch also drops several environment variables we don't need with
meson anymore.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoutil: avoid glib event loop workaround where possible
Daniel P. Berrangé [Wed, 25 Nov 2020 17:59:16 +0000 (17:59 +0000)] 
util: avoid glib event loop workaround where possible

I previously did a workaround for a glib event loop race
that causes crashes:

  commit 0db4743645b7a0611a3c0687f834205c9956f7fc
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Tue Jul 28 16:52:47 2020 +0100

    util: avoid crash due to race in glib event loop code

it turns out that the workaround has a significant performance
penalty on I/O intensive workloads. We thus need to avoid the
workaround if we know we have a new enough glib to avoid the
race condition.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>