]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoapi: virDomainMemoryStats: use 'ret' variable
Ján Tomko [Wed, 23 Sep 2020 16:44:14 +0000 (18:44 +0200)] 
api: virDomainMemoryStats: use 'ret' variable

Instead of 'nr_stats_ret'. Also reduce its scope.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agolibxl: remove unused 'bits' from struct guest_arch
Ján Tomko [Tue, 22 Sep 2020 20:38:12 +0000 (22:38 +0200)] 
libxl: remove unused 'bits' from struct guest_arch

It was made pointless by:
commit c25c18f71bdc43a1305be4ad1a2ca91b25cf13f3
    Convert capabilities / domain_conf to use virArch

and unused by:
commit 8db1f2d228bb2f27a729a873dcdb81ce3c7c38fd
    Fix libxl driver for virArch changes

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoDo not check whether unsigned variables are negative
Ján Tomko [Tue, 22 Sep 2020 20:27:55 +0000 (22:27 +0200)] 
Do not check whether unsigned variables are negative

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agovirsh: virshStreamSourceSkip: remove unused 'off'
Ján Tomko [Wed, 23 Sep 2020 17:57:09 +0000 (19:57 +0200)] 
virsh: virshStreamSourceSkip: remove unused 'off'

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agovbox: remove VBoxCGlueTerm
Ján Tomko [Tue, 22 Sep 2020 20:38:34 +0000 (22:38 +0200)] 
vbox: remove VBoxCGlueTerm

cppcheck reports:
  src/vbox/vbox_XPCOMCGlue.c:226:21: style:
  The statement 'if (hVBoxXPCOMC!=NULL) hVBoxXPCOMC=NULL' is
  logically equivalent to 'hVBoxXPCOMC=NULL'.
  [duplicateConditionalAssign]

It does not matter anyway because this function
is never called.

Fixes: e1506cb4eb7eab96e7ded27a23f0d8ac9697ac2a
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agotools: virshCheckpointListCollect: remove unused names
Ján Tomko [Wed, 23 Sep 2020 16:17:44 +0000 (18:17 +0200)] 
tools: virshCheckpointListCollect: remove unused names

Introduced by:
commit 689beaa47c51fb49fafa992dd468116b8f6b0782
and unused since.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoxen: Don't add dom0 twice on driver reload
Jim Fehlig [Fri, 11 Sep 2020 17:35:47 +0000 (11:35 -0600)] 
xen: Don't add dom0 twice on driver reload

When the xen driver loads, it probes libxl for some info about dom0 and
adds it to the virDomainObjList. The driver then looks for any domains
in stateDir and if they are still alive adds them to the list as well.
This logic is a bit flawed wrt handling driver reload and causes the
following error

  internal error: unexpected domain Domain-0 already exists

A simple fix is to load all domains from stateDir first and then only
add dom0 if needed.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuxml2argvtest: Test timer validation for non-x86 arches
Sebastian Mitterle [Tue, 22 Sep 2020 11:57:40 +0000 (11:57 +0000)] 
qemuxml2argvtest: Test timer validation for non-x86 arches

Add minimal coverage for non-x86_64 timer validation
from commit 2f5d8ffebe5d3d00e16a051ed62ce8a703f18e7c

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemuxml2argvtest: Test expected error messages
Sebastian Mitterle [Tue, 22 Sep 2020 11:57:39 +0000 (11:57 +0000)] 
qemuxml2argvtest: Test expected error messages

When an error is expected, the error message will be checked.
This is expressed by creating an additional ".err" file containing
the expected error message.

It is added in order to make sure the expected errors
are not masked by other errors during test execution while
leveraging the existing framework.

In order to keep it simple, an input file cannot be reused
anymore to cover several expected error cases configured
in the test code. An input file can still be reused by creating
a test case specific symlink.

For consistency, the mock needs to report an error now, too,
as every failure must have an error; otherwise a test case will
fail.

Require LC_ALL=C explicitly to make sure error messages are not
localized for testing.

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Suggested-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: qemuxml2argvmock: Report error in virNumaNodesetIsAvailable
Sebastian Mitterle [Wed, 23 Sep 2020 15:33:12 +0000 (17:33 +0200)] 
tests: qemuxml2argvmock: Report error in virNumaNodesetIsAvailable

The code path is invoked by one of the test cases. Upcoming testing of
error messages would fail.

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainCCWAddressAssign: Drop spurious space at end of error message
Sebastian Mitterle [Wed, 23 Sep 2020 15:31:40 +0000 (17:31 +0200)] 
virDomainCCWAddressAssign: Drop spurious space at end of error message

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainSnapshotDiskDef: Remove 'idx' field
Peter Krempa [Mon, 21 Sep 2020 17:39:51 +0000 (19:39 +0200)] 
virDomainSnapshotDiskDef: Remove 'idx' field

It's no longer needed and is valid only after virDomainSnapshotAlignDisks
is called while holding the lock.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: refactor extension to all disks
Peter Krempa [Mon, 21 Sep 2020 17:36:17 +0000 (19:36 +0200)] 
virDomainSnapshotAlignDisks: refactor extension to all disks

Last step of the algorithm in virDomainSnapshotAlignDisks is to extend
the array of disks to all VM's disk and provide defaults. This was done
by extending the array, adding defaults at the end and then sorting it.
This requires the 'idx' variable and also a separate sorting function.

If we store the pointer to existing snapshot disk definitions in a hash
table and create a new array of snapshot disk definitions, we can fill
the new array directly by either copying the definition from the old
array or adding the default.

This avoids the sorting step and thus even the need to store the index
of the domain disk altogether.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirDomainSnapshotAlignDisks: clarify handing of snapshot location
Peter Krempa [Mon, 21 Sep 2020 16:59:37 +0000 (18:59 +0200)] 
virDomainSnapshotAlignDisks: clarify handing of snapshot location

Remove the use of the 'disk_snapshot' temporary variable since accessing
the disk definition now isn't that much longer to write and use explicit
value checks instead of the (non-)zero check to make it more obvious
what the code is doing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agovirDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable
Peter Krempa [Mon, 21 Sep 2020 16:58:37 +0000 (18:58 +0200)] 
virDomainSnapshotAlignDisks: remove unnecessary 'tmp' variable

The converted string is used exactly once so we can call the conversion
without storing the result in a variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Extract domain disk definition to a local variable
Peter Krempa [Mon, 21 Sep 2020 16:51:56 +0000 (18:51 +0200)] 
virDomainSnapshotAlignDisks: Extract domain disk definition to a local variable

Extract the disk def to a local variable so that it's more obvious
what's happening and it will also allow further simplification.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Add 'domdef' local variable
Peter Krempa [Mon, 21 Sep 2020 16:27:37 +0000 (18:27 +0200)] 
virDomainSnapshotAlignDisks: Add 'domdef' local variable

There are multiple places accessing the domain definition. Extract it to
a local variable so that it's more clear what's happening.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Rename 'disk' -> 'snapdisk'
Peter Krempa [Mon, 21 Sep 2020 16:26:03 +0000 (18:26 +0200)] 
virDomainSnapshotAlignDisks: Rename 'disk' -> 'snapdisk'

The 'disk' variable usually refers to a definition of a disk from the
domain definition. Rename it to 'snapdisk' to be clear that we are
talking about the snapshot disk definition especially since this
function also accesses the domain disk definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Rename 'def' -> 'snapdef'
Peter Krempa [Mon, 21 Sep 2020 15:23:10 +0000 (17:23 +0200)] 
virDomainSnapshotAlignDisks: Rename 'def' -> 'snapdef'

While this function resides in the snapshot config module, the 'def'
variable is referencing the VM definition in most places. Change the
name to 'snapdef' to avoid ambiguity especially since we are also
dealing with the domain definition in this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSnapshotAlignDisks: Refactor cleanup
Peter Krempa [Mon, 21 Sep 2020 15:06:31 +0000 (17:06 +0200)] 
virDomainSnapshotAlignDisks: Refactor cleanup

Use automatic pointer for the bitmap 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 agoqemuSnapshotCreateInactiveExternal: Don't access 'idx' of snapshot
Peter Krempa [Mon, 21 Sep 2020 17:38:11 +0000 (19:38 +0200)] 
qemuSnapshotCreateInactiveExternal: Don't access 'idx' of snapshot

After virDomainSnapshotAlignDisks is called the definitions of disks in
the snapshot definition and in the domain definition are in the same
order so they can be addressed using the same index.

This frees up 'idx' to be removed later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuDomainBlockRebase: Replace ternary operator with if/else
Peter Krempa [Tue, 22 Sep 2020 09:07:39 +0000 (11:07 +0200)] 
qemuDomainBlockRebase: Replace ternary operator with if/else

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageVolDefParseXML: Use g_steal_pointer
Peter Krempa [Tue, 22 Sep 2020 09:06:25 +0000 (11:06 +0200)] 
virStorageVolDefParseXML: Use g_steal_pointer

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirStorageSourceNew: Abort on failure
Peter Krempa [Tue, 22 Sep 2020 09:04:17 +0000 (11:04 +0200)] 
virStorageSourceNew: Abort on failure

Add an abort() on the class/object allocation failures so that
virStorageSourceNew() always returns a virStorageSource and remove
checks from all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: substitute missing model name for host-passthrough
Collin Walling [Wed, 23 Sep 2020 07:26:58 +0000 (09:26 +0200)] 
qemu: substitute missing model name for host-passthrough

Before:
  $ uname -m
  s390x
  $ cat passthrough-cpu.xml
  <cpu check="none" mode="host-passthrough" />
  $ virsh hypervisor-cpu-compare passthrough-cpu.xml
  error: Failed to compare hypervisor CPU with passthrough-cpu.xml
  error: internal error: unable to execute QEMU command 'query-cpu-model-comp
  arison': Invalid parameter type for 'modelb.name', expected: string

After:
  $ virsh hypervisor-cpu-compare passthrough-cpu.xml
  CPU described in passthrough-cpu.xml is identical to the CPU provided by hy
  pervisor on the host

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoNEWS.rst: update NVDIMM changes entry
Daniel Henrique Barboza [Tue, 22 Sep 2020 12:18:29 +0000 (09:18 -0300)] 
NEWS.rst: update NVDIMM changes entry

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: auto-align pSeries NVDIMM in virDomainMemoryDefPostParse()
Daniel Henrique Barboza [Tue, 22 Sep 2020 12:12:07 +0000 (09:12 -0300)] 
domain_conf.c: auto-align pSeries NVDIMM in virDomainMemoryDefPostParse()

The alignment for the pSeries NVDIMM does not depend on runtime
constraints. This means that it can be done in device parse
time, instead of runtime, allowing the domain XML to reflect
what the auto-alignment would do when the domain starts.

This brings consistency between the NVDIMM size reported by the
domain XML and what the guest sees, without impacting existing
guests that are using an unaligned size - they'll work as usual,
but the domain XML will be updated with the actual size of the
NVDIMM.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoconf, qemu: move qemuDomainNVDimmAlignSizePseries to domain_conf.c
Daniel Henrique Barboza [Tue, 15 Sep 2020 01:02:47 +0000 (22:02 -0300)] 
conf, qemu: move qemuDomainNVDimmAlignSizePseries to domain_conf.c

We'll use the auto-alignment function during parse time, in
domain_conf.c. Let's move the function to that file, renaming
it to virDomainNVDimmAlignSizePseries(). This will also make it
clearer that, although QEMU is the only driver that currently
supports it, pSeries NVDIMM restrictions aren't tied to QEMU.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoTranslated using Weblate (Italian)
Milo Casagrande [Thu, 10 Sep 2020 13:43:35 +0000 (15:43 +0200)] 
Translated using Weblate (Italian)

Currently translated at 24.6% (2559 of 10366 strings)

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

Co-authored-by: Milo Casagrande <milo@milo.name>
Signed-off-by: Milo Casagrande <milo@milo.name>
4 years agotests: build SELinux tests
Ján Tomko [Wed, 23 Sep 2020 13:12:59 +0000 (15:12 +0200)] 
tests: build SELinux tests

We set WITH_LIBATTR in meson.build, not WITH_ATTR.

Also link securityselinuxlabeltest with test_qemu_driver_lib.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 3ace72965c3b11fc763f781ae7ce3ca29dd36507
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: do not unref event thread after joining it
Ján Tomko [Wed, 23 Sep 2020 14:30:22 +0000 (16:30 +0200)] 
util: do not unref event thread after joining it

g_thread_join() eats a reference.

==295055== Invalid read of size 4
==295055==    at 0x4DA4AE4: g_thread_unref (in /usr/lib64/libglib-2.0.so.0.6400.5)
==295055==    by 0x491D5FA: vir_event_thread_finalize (vireventthread.c:47)
==295055==    by 0x4E6BCFF: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.6400.5)
==295055==    by 0x22F35CF4: qemuProcessQMPFree (qemu_process.c:8525)
==295055==    by 0x22E71B58: glib_autoptr_clear_qemuProcessQMP (qemu_process.h:237)
...
==295055==    by 0x22E98A29: qemuDomainPostParseDataAlloc (qemu_domain.c:5476)
==295055==    by 0x49ABF83: virDomainDefPostParse (domain_conf.c:6023)
==295055==  Address 0x2acb1c68 is 24 bytes inside a block of size 88 free'd
==295055==    at 0x483B9F5: free (vg_replace_malloc.c:538)
==295055==    by 0x4D80A4C: g_free (in /usr/lib64/libglib-2.0.so.0.6400.5)
...
==295055==    by 0x491D5F1: vir_event_thread_finalize (vireventthread.c:46)
==295055==    by 0x4E6BCFF: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.6400.5)
==295055==    by 0x22F35CF4: qemuProcessQMPFree (qemu_process.c:8525)
==295055==    by 0x22E71B58: glib_autoptr_clear_qemuProcessQMP (qemu_process.h:237)
...
==295055==  Block was alloc'd at
==295055==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==295055==    by 0x4D80958: g_malloc (in /usr/lib64/libglib-2.0.so.0.6400.5)
...
==295055==    by 0x4DA4C32: g_thread_try_new (in /usr/lib64/libglib-2.0.so.0.6400.5)
==295055==    by 0x491D3BC: virEventThreadStart (vireventthread.c:159)
==295055==    by 0x491D3BC: virEventThreadNew (vireventthread.c:185)
...

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: f4fc3db9204407874181117085756c9ced78adad
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: use g_new0 instead of VIR_ALLOC_N
Ján Tomko [Tue, 22 Sep 2020 23:04:17 +0000 (01:04 +0200)] 
tests: use g_new0 instead of VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirnetdaemon: fix memory leak in virNetDaemonCallInhibit
Pavel Hrdina [Wed, 23 Sep 2020 14:31:21 +0000 (16:31 +0200)] 
virnetdaemon: fix memory leak in virNetDaemonCallInhibit

g_variant_new() returns a weak reference which can be consumed by passing
to other g_variant* functions or to g_dbus_connection_call* functions.

This make it possible to call g_variant_new() directly as argument to
the functions above. Because this might be confusing I explicitly call
g_variant_ref_sink() to make it normal reference in both
virGDBusCallMethod() and virGDBusCallMethodWithFD() so the caller is
always responsible for the data.

Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil/virgdbus: fix memory leak in virGDBusIsServiceInList
Pavel Hrdina [Wed, 23 Sep 2020 13:40:37 +0000 (15:40 +0200)] 
util/virgdbus: fix memory leak in virGDBusIsServiceInList

g_variant_iter_loop() handles freeing all arguments unless we break out
of the loop, in that case we have to free them manually.

Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agodocs: manpages: Strip table of contents from manpages
Peter Krempa [Wed, 23 Sep 2020 13:13:57 +0000 (15:13 +0200)] 
docs: manpages: Strip table of contents from manpages

After meson conversion the man pages started to contain the table of
contents.

In autoconf we prevented this by a 'grep -v ::contents' in the command
building the manpages.

A more cultured solution is to strip out the 'contents' docutils element
directly.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: use g_new0 instead of VIR_ALLOC
Ján Tomko [Tue, 22 Sep 2020 22:42:45 +0000 (00:42 +0200)] 
tests: use g_new0 instead of VIR_ALLOC

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: cpuTestLoadMultiXML: use g_new0 instead of VIR_ALLOC_N
Ján Tomko [Tue, 22 Sep 2020 22:59:59 +0000 (00:59 +0200)] 
tests: cpuTestLoadMultiXML: use g_new0 instead of VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: virNumaGetPages: use g_new0 instead of VIR_ALLOC_N
Ján Tomko [Tue, 22 Sep 2020 22:58:49 +0000 (00:58 +0200)] 
tests: virNumaGetPages: use g_new0 instead of VIR_ALLOC_N

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoUse (un)signed printf specifiers correctly
Ján Tomko [Tue, 22 Sep 2020 20:17:03 +0000 (22:17 +0200)] 
Use (un)signed printf specifiers correctly

Various places reported by cppcheck's invalidPrintfArgType_sint
and invalidPrintfArgType_uint.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirsh: do not return bool in virshNetworkPortUUIDCompleter
Ján Tomko [Tue, 22 Sep 2020 20:19:26 +0000 (22:19 +0200)] 
virsh: do not return bool in virshNetworkPortUUIDCompleter

portability: Returning an integer in a function with pointer
return type is not portable. [CastIntegerToAddressAtReturn]

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agorpc: socket: properly call virSetCloseExec
Ján Tomko [Tue, 22 Sep 2020 20:29:25 +0000 (22:29 +0200)] 
rpc: socket: properly call virSetCloseExec

cppcheck reports:
style: Argument 'fd<0' to function virSetCloseExec is always 0 [knownArgument]

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 4b9919af4024a6fbc3d4ee996d8a4c27dbc44285
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoqemu: firmware: check virJSONValueObjectGet return value
Ján Tomko [Tue, 22 Sep 2020 21:22:06 +0000 (23:22 +0200)] 
qemu: firmware: check virJSONValueObjectGet return value

If the mapping is not present, we should not try to
access its elements.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 8b5b80f4c5f7342eedce0747469223387ab709ef
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agoutil: event: check return value of virInitialize
Ján Tomko [Tue, 22 Sep 2020 21:17:18 +0000 (23:17 +0200)] 
util: event: check return value of virInitialize

This function can possibly fail.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 2e07a1e14635ad25c57b66c13488feff4c8d2b0c
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agotests: esxutilstest: depend on esx_gen_headers
Ján Tomko [Wed, 23 Sep 2020 08:29:56 +0000 (10:29 +0200)] 
tests: esxutilstest: depend on esx_gen_headers

Sometimes parallel compilation randomly fails on platforms
that do not have many drivers enabled, like macOS:

In file included from ../tests/esxutilstest.c:13:
../src/esx/esx_vi_types.h:62:10: fatal error: 'esx_vi_types.generated.typedef' file not found
 #include "esx_vi_types.generated.typedef"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

List esx_gen_headers as a source to stop meson from building
it before the headers are generated.

https://gitlab.com/libvirt/libvirt/-/jobs/726039284

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoesx: separate header and source file generation
Ján Tomko [Wed, 23 Sep 2020 06:37:20 +0000 (08:37 +0200)] 
esx: separate header and source file generation

Invoke the generator twice and introduce separate
meson targets for headers and C sources.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agogdbus: fix virGDBusCallMethodWithFD stub for non-UNIX
Ján Tomko [Wed, 23 Sep 2020 11:18:49 +0000 (13:18 +0200)] 
gdbus: fix virGDBusCallMethodWithFD stub for non-UNIX

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: a961d93768f18c28979ca2841832cd7278bf95b8
4 years agovirgdbus: add DBus reply format check
Pavel Hrdina [Mon, 21 Sep 2020 13:42:00 +0000 (15:42 +0200)] 
virgdbus: add DBus reply format check

We used to check the format of reply data with libdbus so we should do
the same with GLib DBus as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirfirewalld: fix g_variant_get call
Pavel Hrdina [Mon, 21 Sep 2020 12:39:49 +0000 (14:39 +0200)] 
virfirewalld: fix g_variant_get call

We need to pass pointer to `array`.

Reported-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
4 years agoRemove redundant check when storage pool is mounted
Yi Li [Wed, 23 Sep 2020 03:34:57 +0000 (11:34 +0800)] 
Remove redundant check when storage pool is mounted

virFileComparePaths just return 0 or 1 after commit 7b48bb8
so break while after virFileComparePaths return 1

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
4 years agotests: Don't advertise VIR_TEST_EXPENSIVE to users
Andrea Bolognani [Tue, 22 Sep 2020 11:41:49 +0000 (13:41 +0200)] 
tests: Don't advertise VIR_TEST_EXPENSIVE to users

Right now, the logic that takes care of deciding whether expensive
tests should be run or not is not working correctly: more
specifically, it's not possible to use something like

  $ VIR_TEST_EXPENSIVE=1 ninja test

to override the default choice, because in meson.build we always
pass an explicit value that overrides whatever is present in the
environment.

We could implement logic to make this work properly, but that
would require some refactoring of our test infrastructure and is
arguably of little value given that running

  $ meson build -Dexpensive_tests=enabled

is very fast, so let's just stop telling users about the variable
instead and call it a day.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Include value of expensive_tests in summary
Andrea Bolognani [Tue, 22 Sep 2020 13:15:49 +0000 (15:15 +0200)] 
meson: Include value of expensive_tests in summary

It's useful information to have available at a glance.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agodocs: Document global_{period,quota} schedinfo fields
Andrea Bolognani [Fri, 18 Sep 2020 16:36:25 +0000 (18:36 +0200)] 
docs: Document global_{period,quota} schedinfo fields

These fields have existed for a very long time but they were
never documented in virsh(1).

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agolibvirt: ensure defresult is used in virConnectAuthCallbackDefault
Matt Coleman [Tue, 22 Sep 2020 02:01:46 +0000 (22:01 -0400)] 
libvirt: ensure defresult is used in virConnectAuthCallbackDefault

A previous change to this function's password handling broke the use of
default values for credential types other than VIR_CRED_PASSPHRASE and
VIR_CRED_NOECHOPROMPT.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Matt Coleman <matt@datto.com>
4 years agobhyve: add VNC password support
Fabian Freyer [Wed, 6 May 2020 13:35:55 +0000 (13:35 +0000)] 
bhyve: add VNC password support

Support setting a password for the VNC framebuffer using the passwd
attribute on the <graphics/> element, if the driver has the
BHYVE_CAP_VNC_PASSWORD capability.

Note that virsh domxml-from-native does not output the password in the
generated XML, as VIR_DOMAIN_DEF_FORMAT_SECURE is not set when
formatting the domain definition.

Signed-off-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: probe for VNC password capability
Fabian Freyer [Wed, 6 May 2020 13:35:54 +0000 (13:35 +0000)] 
bhyve: probe for VNC password capability

Introduces the BHYVE_CAP_VNC_PASSWORD capability, which is probed by
parsing the error message from the bhyve command. When it is not
supported, bhyve -s 0,fbuf,password= will return an error message.

Signed-off-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: add support for setting fbuf resolution
Fabian Freyer [Wed, 6 May 2020 13:35:53 +0000 (13:35 +0000)] 
bhyve: add support for setting fbuf resolution

The resolution of the VNC framebuffer can now be set via the resolution
definition introduced in 5.9.0.

Also, add "gop" to the list of model types  the <resolution/>
sub-element is valid for.

Signed-off-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: support parsing fbuf PCI device
Fabian Freyer [Wed, 6 May 2020 13:35:52 +0000 (13:35 +0000)] 
bhyve: support parsing fbuf PCI device

Add a new helper function, bhyveParsePCIFbuf, to parse the bhyve-argv
parameters for a frame-buffer device to <graphics/> and <video/>
definitions.

For now, only the listen address, port, and vga mode are detected.
Unsupported parameters are silently skipped.

This involves upgrading the private API to expose the
virDomainGraphicsDefNew helper function, which is used by
bhyveParsePCIFbuf.

Signed-off-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: add missing test files
Roman Bogorodskiy [Tue, 22 Sep 2020 11:59:37 +0000 (15:59 +0400)] 
bhyve: add missing test files

Fixes: 4277e61e22b7532dc476c44a356081053da470f8
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
4 years agonews: Document changes to NVDIMM handling on ppc64
Andrea Bolognani [Tue, 22 Sep 2020 10:24:04 +0000 (12:24 +0200)] 
news: Document changes to NVDIMM handling on ppc64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: revert latest pSeries NVDIMM design changes
Daniel Henrique Barboza [Tue, 15 Sep 2020 02:42:56 +0000 (23:42 -0300)] 
qemu: revert latest pSeries NVDIMM design changes

In [1], changes were made to remove the existing auto-alignment
for pSeries NVDIMM devices. That design promotes strange situations
where the NVDIMM size reported in the domain XML is different
from what QEMU is actually using. We removed the auto-alignment
and relied on standard size validation.

However, this goes against Libvirt design philosophy of not
tampering with existing guest behavior, as pointed out by Daniel
in [2]. Since we can't know for sure whether there are guests that
are relying on the auto-alignment feature to work, the changes
made in [1] are a direct violation of this rule.

This patch reverts [1] entirely, re-enabling auto-alignment for
pSeries NVDIMM as it was before. Changes will be made to ease
the limitations of this design without hurting existing
guests.

This reverts the following commits:

- commit 2d93cbdea9d1b8dbf36bc0ffee6cb73d83d208c7
  Revert "formatdomain.html.in: mention pSeries NVDIMM 'align down' mechanic"

- commit 0ee56369c8b4f2f898b6aa1ff1f51ab033be1c02
  qemu_domain.c: change qemuDomainMemoryDeviceAlignSize() return type

- commit 07de813924caf37e535855541c0c1183d9d382e2
  qemu_domain.c: do not auto-align ppc64 NVDIMMs

- commit 0ccceaa57c50e5ee528f7073fa8723afd62b88b7
  qemu_validate.c: add pSeries NVDIMM size alignment validation

- commit 4fa2202d884414ad34d9952e72fb39b1d93c7e14
  qemu_domain.c: make qemuDomainGetMemorySizeAlignment() public

[1] https://www.redhat.com/archives/libvir-list/2020-July/msg02010.html
[2] https://www.redhat.com/archives/libvir-list/2020-September/msg00572.html

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agotests: avoid close of bad file handle in commandtest
Daniel P. Berrangé [Mon, 21 Sep 2020 17:37:03 +0000 (18:37 +0100)] 
tests: avoid close of bad file handle in commandtest

Closed file handles need to be initialized to -1, not 0. This caused a
inappropriate double close of stdin, which is not desirable, although
it had no ill effects.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: don't mix FILE* and UNIX FD I/O on same stream
Daniel P. Berrangé [Mon, 21 Sep 2020 17:32:29 +0000 (18:32 +0100)] 
tests: don't mix FILE* and UNIX FD I/O on same stream

There is currently a hang in test27 that exhibits itself on FreeBSD 11.4
only. The behaviour is that virCommandProcessIO gets POLLIN on the
FD for stdout, but read() blocks. Meanwhile commandtest also blocks
in write for stderr because the pipe buffers are full.

This fix in commandhelper likely does not really address the root cause
just hides it due to the buffering done by FILE *. Mixing UNIX FD I/O
and FILE * I/O is bad practice regardless.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoudevProcessCSS: Check if def->driver is non-NULL
Marc Hartmayer [Mon, 21 Sep 2020 17:06:32 +0000 (19:06 +0200)] 
udevProcessCSS: Check if def->driver is non-NULL

Don't process subchannel devices where `def->driver` is not set. This
fixes the following segfault:

Thread 21 "nodedev-init" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x3ffb08fc910 (LWP 64303)]
(gdb) bt
 #0  0x000003fffd1272b4 in __strcmp_vx () at /lib64/libc.so.6
 #1  0x000003ffc260c3a8 in udevProcessCSS (device=0x3ff9018d130, def=0x3ff90194a90)
 #2  0x000003ffc260cb78 in udevGetDeviceDetails (device=0x3ff9018d130, def=0x3ff90194a90)
 #3  0x000003ffc260d126 in udevAddOneDevice (device=0x3ff9018d130)
 #4  0x000003ffc260d414 in udevProcessDeviceListEntry (udev=0x3ffa810d800, list_entry=0x3ff90001990)
 #5  0x000003ffc260d638 in udevEnumerateDevices (udev=0x3ffa810d800)
 #6  0x000003ffc260e08e in nodeStateInitializeEnumerate (opaque=0x3ffa810d800)
 #7  0x000003fffdaa14b6 in virThreadHelper (data=0x3ffa810df00)
 #8  0x000003fffc309ed6 in start_thread ()
 #9  0x000003fffd185e66 in thread_start ()
(gdb) p *def
$2 = {
  name = 0x0,
  sysfs_path = 0x3ff90198e80 "/sys/devices/css0/0.0.ff40",
  parent = 0x0,
  parent_sysfs_path = 0x0,
  parent_wwnn = 0x0,
  parent_wwpn = 0x0,
  parent_fabric_wwn = 0x0,
  driver = 0x0,
  devnode = 0x0,
  devlinks = 0x3ff90194670,
  caps = 0x3ff90194380
}

Fixes: 05e6cdafa6e0 ("node_device: detect CSS devices")
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
4 years agobhyve: soften requirements for slot 1
Roman Bogorodskiy [Sun, 20 Sep 2020 14:53:57 +0000 (18:53 +0400)] 
bhyve: soften requirements for slot 1

Currently, slot 1 is only allowed to be used by the LPC device.
Relax this requirement and allow to use slot 1 if it was explicitly
specified by the user for any other device type. In this case the LPC
device will have the next available address.

If slot 1 was not used by the user, it'll be reserved for the LPC
device, even if it is not configured to make address assignment
consistent in case the LPC device becomes necessary (e.g. the user
adds a console or a video device which require LPC).

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: support 'isa' controller for LPC
Roman Bogorodskiy [Sun, 17 Feb 2019 13:04:00 +0000 (17:04 +0400)] 
bhyve: support 'isa' controller for LPC

Support modeling of the 'isa' controller for bhyve. User can manually
define any PCI slot for the 'isa' controller, including PCI slot 1,
but other devices are not allowed to use this address.

When domain configuration requires the 'isa' controller to be present,
automatically add it on domain post-parse stage.

Now, as this controller is always available when needed, it's not
necessary to implicitly add it to the bhyve command line, so remove
bhyveBuildLPCArgStr().

Also, make bhyveDomainDefNeedsISAController() static as it's no longer
used outside of bhyve_domain.c.

As more than one ISA controller is not supported by bhyve,
and multiple controllers with the same index are forbidden,
so forbid ISA controllers with non-zero index for bhyve.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: add 'isa' controller type
Roman Bogorodskiy [Sun, 17 Feb 2019 13:04:00 +0000 (17:04 +0400)] 
conf: add 'isa' controller type

Introduce 'isa' controller type. In domain XML it looks this way:

    ...
    <controller type='isa' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
               function='0x0'/>
    </controller>
    ...

Currently, this is needed for the bhyve driver to allow choosing a
specific PCI address for that. In bhyve, this controller is used to
attach serial ports and a boot ROM.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: fix non-null pointer parameter annotations
Daniel P. Berrangé [Mon, 21 Sep 2020 08:57:45 +0000 (09:57 +0100)] 
util: fix non-null pointer parameter annotations

An extra parameter was added to virQEMUBuildQemuImgKeySecretOpts in

  commit ecfc4094d832a23fb56e1825d799c93488c168d7
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Tue Sep 15 16:30:37 2020 +0100

    storage: add support for qcow2 LUKS encryption

but the non-null pointer annotations were not adjusted to take account.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonews: dbus: use GLib implementation instead of libdbus
Pavel Hrdina [Thu, 17 Sep 2020 16:32:49 +0000 (18:32 +0200)] 
news: dbus: use GLib implementation instead of libdbus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agonews: node_device: remove HAL node device backend
Pavel Hrdina [Thu, 17 Sep 2020 16:31:13 +0000 (18:31 +0200)] 
news: node_device: remove HAL node device backend

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoremote: slightly improve debugging of socket selection
Daniel P. Berrangé [Wed, 16 Sep 2020 13:51:47 +0000 (14:51 +0100)] 
remote: slightly improve debugging of socket selection

The current debug message reports the "mode" after selection has
completed, however, the "mode" value can be changed by the selection
logic. It is thus beneficial to report most values upfront, and only
report newly changed values at the end.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agostorage: add support for qcow2 LUKS encryption
Daniel P. Berrangé [Tue, 15 Sep 2020 15:30:37 +0000 (16:30 +0100)] 
storage: add support for qcow2 LUKS encryption

The storage driver was wired up to support creating raw volumes in LUKS
format, but was never adapted to support LUKS-in-qcow2. This is trivial
as it merely requires the encryption properties to be prefixed with
the "encrypt." prefix, and "encrypt.format=luks" when creating the
volume.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotests: remove redundant LUKS volume data files
Daniel P. Berrangé [Thu, 17 Sep 2020 11:32:54 +0000 (12:32 +0100)] 
tests: remove redundant LUKS volume data files

The two removed files have exactly the same config as other LUKS volume
data files, simply with different file names. Consolidate down to just
two LUKS volume data files as that's all that we need for the test
coverage.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: detect LUKS encryption scheme in qcow2 files
Daniel P. Berrangé [Wed, 16 Sep 2020 17:00:35 +0000 (18:00 +0100)] 
util: detect LUKS encryption scheme in qcow2 files

Crypt method number 2 indicates LUKS format.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoscripts: fix logic error in argv wrapping code
Daniel P. Berrangé [Thu, 17 Sep 2020 11:49:12 +0000 (12:49 +0100)] 
scripts: fix logic error in argv wrapping code

The first piece of the command we process must be added to the list
straight away regardless of whether it starts with a '-' or not.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agolibxl: use b_info->{acpi,acpi} when available
Marek Marczykowski-Górecki [Thu, 10 Sep 2020 04:18:01 +0000 (06:18 +0200)] 
libxl: use b_info->{acpi,acpi} when available

b_info->u.hvm.{acpi,apic} are deprecated. But also, on recent libxl
version (4.14) the old one seems to be broken. While libxl part should
be fixed too, update the usage here and at some point drop support for
the old version.
b_info->acpi was added in Xen 4.8
b_info->apic was added in Xen 4.10
Xen 4.10 is the oldest version that still has security support (until
December 2020).

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
4 years agodrop libdbus from libvirt
Pavel Hrdina [Tue, 15 Sep 2020 12:22:57 +0000 (14:22 +0200)] 
drop libdbus from libvirt

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/rpc/virnetdaemon: convert to use GLib DBus
Pavel Hrdina [Wed, 16 Sep 2020 14:01:51 +0000 (16:01 +0200)] 
src/rpc/virnetdaemon: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/remote/remote_daemon: convert to use GLib DBus
Pavel Hrdina [Wed, 9 Sep 2020 14:44:03 +0000 (16:44 +0200)] 
src/remote/remote_daemon: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/nwfilter/nwfilter_driver: convert to use GLib DBus
Pavel Hrdina [Wed, 9 Sep 2020 14:43:47 +0000 (16:43 +0200)] 
src/nwfilter/nwfilter_driver: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/network/bridge_driver: convert to use GLib DBus
Pavel Hrdina [Wed, 9 Sep 2020 14:43:32 +0000 (16:43 +0200)] 
src/network/bridge_driver: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/lxc/lxc_controller: convert to use GLib DBus
Pavel Hrdina [Wed, 9 Sep 2020 14:43:12 +0000 (16:43 +0200)] 
src/lxc/lxc_controller: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/util/virsystemd: convert to use GLib DBus
Pavel Hrdina [Wed, 9 Sep 2020 14:42:42 +0000 (16:42 +0200)] 
src/util/virsystemd: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/util/virfirewalld: convert to use GLib DBus
Pavel Hrdina [Tue, 15 Sep 2020 12:00:53 +0000 (14:00 +0200)] 
src/util/virfirewalld: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc/util/virpolkit: convert to use GLib DBus
Pavel Hrdina [Wed, 9 Sep 2020 14:42:16 +0000 (16:42 +0200)] 
src/util/virpolkit: convert to use GLib DBus

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: introduce virgdbusmock to mock GLib DBus functions
Pavel Hrdina [Fri, 11 Sep 2020 12:17:01 +0000 (14:17 +0200)] 
tests: introduce virgdbusmock to mock GLib DBus functions

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests/virmock: extend number of arguments
Pavel Hrdina [Fri, 11 Sep 2020 12:12:07 +0000 (14:12 +0200)] 
tests/virmock: extend number of arguments

Rewrite to use GLib DBus instead of libdbus will introduce function with
large number of arguments that we will have to mock for our tests so we
need to extend the number of arguments for our macros.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: introduce helpers for GLib DBus implementation
Pavel Hrdina [Tue, 8 Sep 2020 11:55:24 +0000 (13:55 +0200)] 
util: introduce helpers for GLib DBus implementation

With libdbus our wrappers had a special syntax to create the DBus
messages by defining the DBus message signature followed by list
of arguments providing data based on the signature.

There will be no similar helper with GLib implementation as they
provide same functionality via GVariant APIs. The syntax is slightly
different mostly for how arrays, variadic types and dictionaries are
created/parsed.

Additional difference is that with GLib DBus everything is wrapped in
extra tuple (struct). For more details refer to the documentation [1].

[1] <https://developer.gnome.org/glib/stable/gvariant-format-strings.html>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: mock libdbus in networkxml2firewalltest
Pavel Hrdina [Tue, 15 Sep 2020 11:55:53 +0000 (13:55 +0200)] 
tests: mock libdbus in networkxml2firewalltest

This test calls into src/util/virfirewalld.c where it uses DBus to
figure out if firewalld is registered. Without the mock it luckily
fails and the test works correctly.

To isolate the tests from host environment we should mock the DBus
calls.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoremove HAL node device driver
Pavel Hrdina [Thu, 3 Sep 2020 12:20:43 +0000 (14:20 +0200)] 
remove HAL node device driver

There was one attempt a year ago done by me to drop HAL [1] but it was
never resolved. There was another time when Dan suggested to drop HAL
driver [2] but it was decided to keep it around in case device
assignment will be implemented for FreeBSD and the fact that
virt-manager uses node device driver [3].

I checked git history and code and it doesn't look like bhyve supports
device assignment so from that POV it should not block removing HAL.

The argument about virt-manager is not strong as well because libvirt
installed from FreeBSD packages doesn't have HAL support so it will not
affect these users as well [4].

The only users affected by this change would be the ones compiling
libvirt from GIT on FreeBSD.

I looked into alternatives and there is libudev-devd package on FreeBSD
but unfortunately it doesn't work as it doesn't list any devices when
used with libvirt. It provides libudev APIs using devd.

I also looked into devd directly and it provides some APIs but there are
no APIs for device monitoring and events so that would have to be
somehow done by libvirt.

Main motivation for dropping HAL support is to replace libdbus with GLib
dbus implementation and it cannot be done with HAL driver present in
libvirt because HAL APIs heavily depends on symbols provided by libdbus.

[1] <https://www.redhat.com/archives/libvir-list/2019-May/msg00203.html>
[2] <https://www.redhat.com/archives/libvir-list/2016-April/msg00992.html>
[3] <https://www.redhat.com/archives/libvir-list/2016-April/msg00994.html>
[4] <https://svnweb.freebsd.org/ports/head/devel/libvirt/Makefile?view=markup>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: virsh: Document the IO mode 'io_uring'
Lin Ma [Wed, 16 Sep 2020 07:17:36 +0000 (15:17 +0800)] 
docs: virsh: Document the IO mode 'io_uring'

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: event: options --list, --all and --event are mutually exclusive
Lin Ma [Wed, 16 Sep 2020 07:17:35 +0000 (15:17 +0800)] 
virsh: event: options --list, --all and --event are mutually exclusive

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirsh: net-port-create: log errors for non-existent xml file
Lin Ma [Wed, 16 Sep 2020 07:17:34 +0000 (15:17 +0800)] 
virsh: net-port-create: log errors for non-existent xml file

Signed-off-by: Lin Ma <lma@suse.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoaccess: ensure ACL files are rebuilt when protocol changes
Daniel P. Berrangé [Wed, 16 Sep 2020 09:42:02 +0000 (10:42 +0100)] 
access: ensure ACL files are rebuilt when protocol changes

Meson is not told that the .x protocol files are an input for the
generator, so it doesn't know to setup a rebuild dependancy.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: fix concurrency crash bug in force snapshot revert
Nikolay Shirokovskiy [Mon, 14 Sep 2020 11:58:05 +0000 (14:58 +0300)] 
qemu: fix concurrency crash bug in force snapshot revert

This patch is just revert of [1]. Actually we should NOT pass
QEMU_ASYNC_JOB_NONE as that patch suggests while we are in async job in order
to acquire nested jobs correctly. The patch tries to fix issues introduced by
another patch [2] where jobs are mistakenly cleared out in qemuProcessStop.
Later patch [3] fixed the issue introduced by patch [2]. Now we need to revert
[1] as well as we now still have same concurrency crash issues as [3] described
but for the force revert.

[1] 0c4408c83: qemu: Don't use asyncJob after stop during snapshot revert
[2] 888aa4b6b: qemuDomainObjPrivateDataClear: Don't leak @migParams
[3] d75f865fb: qemu: fix concurrency crash bug in snapshot revert

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agohyperv: fix the number of threads per core
Matt Coleman [Tue, 15 Sep 2020 22:27:16 +0000 (18:27 -0400)] 
hyperv: fix the number of threads per core

The operands were reversed, producing an incorrect result.

Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuBuildHostdevSCSIAttachPrepare: Propagate 'readonly' flag also for iSCSI
Peter Krempa [Tue, 15 Sep 2020 15:58:04 +0000 (17:58 +0200)] 
qemuBuildHostdevSCSIAttachPrepare: Propagate 'readonly' flag also for iSCSI

The 'readonly' hostdev property is stored separately from the
virStorageSource as some hostdevs are not described by a virStorage
source. We need to propagate the flag to the virStorage source also for
iSCSI backends as it's used to generate the backend properties.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuxml2argvtest: hostdev-scsi-virtio-scsi: Add <readonly/> to one of the iSCSI hostdevs
Peter Krempa [Tue, 15 Sep 2020 15:48:22 +0000 (17:48 +0200)] 
qemuxml2argvtest: hostdev-scsi-virtio-scsi: Add <readonly/> to one of the iSCSI hostdevs

Test a readonly iSCSI backend as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: backup: Write TLS cert and secret object aliases into status XML
Peter Krempa [Mon, 14 Sep 2020 15:59:07 +0000 (17:59 +0200)] 
qemu: backup: Write TLS cert and secret object aliases into status XML

We've put the aliases into the backup job definition after the status
XML was already written so they didn't appear in the on-disk state.

Move the code putting them into the private definition earlier, so that
the status XML update done by saving blockjobs already writes them out.

Also add a note notifying that the block job status update writes the
status XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1870488
Fixes: 423576679a5
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: backup: Remove note that TLS should be implemented
Peter Krempa [Mon, 14 Sep 2020 15:58:09 +0000 (17:58 +0200)] 
qemu: backup: Remove note that TLS should be implemented

Commit 423576679a5 implementing TLS forgot to remove the comment.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemustatusxml2xml: backup-pull: Test private data formatting/parsing
Peter Krempa [Mon, 14 Sep 2020 15:46:42 +0000 (17:46 +0200)] 
qemustatusxml2xml: backup-pull: Test private data formatting/parsing

Modify the test case to enable TLS and add private data containing
aliases of objects corresponding to a TLS setup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>