]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agoqemu_snapshot: revert: move validation to separate function
Pavel Hrdina [Fri, 26 Nov 2021 10:46:03 +0000 (11:46 +0100)]
qemu_snapshot: revert: move validation to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: revert: remove cleanup label
Pavel Hrdina [Thu, 25 Nov 2021 16:08:35 +0000 (17:08 +0100)]
qemu_snapshot: revert: remove cleanup label

Now the cleanup label is not necessary so we can drop it.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: revert: jump to endjob instead of calling qemuProcessEndJob
Pavel Hrdina [Thu, 25 Nov 2021 15:46:44 +0000 (16:46 +0100)]
qemu_snapshot: revert: jump to endjob instead of calling qemuProcessEndJob

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: revert: use g_autoptr
Pavel Hrdina [Thu, 25 Nov 2021 15:44:23 +0000 (16:44 +0100)]
qemu_snapshot: revert: use g_autoptr

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: revert: drop unused variable
Pavel Hrdina [Thu, 25 Nov 2021 15:43:43 +0000 (16:43 +0100)]
qemu_snapshot: revert: drop unused variable

Commit <f33ce12e9cd9cab7e6022e91d3765c33d99bf777> dropped unused code
but missed one variable.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: revert: fix incorrect jump to cleanup
Pavel Hrdina [Thu, 25 Nov 2021 15:36:13 +0000 (16:36 +0100)]
qemu_snapshot: revert: fix incorrect jump to cleanup

Fixes: 6a6f6b91e0e76480ea961f83135efcb4faf3284a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoFix reboot command for LXC containers
Joachim Falk [Thu, 2 Dec 2021 18:56:07 +0000 (19:56 +0100)]
Fix reboot command for LXC containers

The virNetDaemonQuit(dmn) command in virLXCControllerSignalChildIO triggers an
early close of all clients of lxc_controller. Here, libvirtd itself is a client
of this controller, and the client connection is used to notify libvirtd if a
reboot of the container is required. However, the client connection was closed
before such a status could be sent to libvirtd. To fix this bug, we will
immediately send the reboot or shutdown status of the container to libvirtd,
and only after client disconnect will we trigger virNetDaemonQuit.

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/237
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991773
Signed-off-by: Joachim Falk <joachim.falk@gmx.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolibxl: Protect access to libxlLogger files hash table
Jim Fehlig [Thu, 18 Nov 2021 19:03:20 +0000 (12:03 -0700)]
libxl: Protect access to libxlLogger files hash table

The hash table of log file objects in libxlLogger is not protected against
concurrent access. It is possible for one thread to remove an entry while
another is updating it. Add a mutex to the libxlLogger object and lock it
when accessing the files hash table.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Search for virDomainObj in event handler threads
Jim Fehlig [Wed, 24 Nov 2021 18:48:51 +0000 (11:48 -0700)]
libxl: Search for virDomainObj in event handler threads

libxl can deliver events and invoke callbacks on any application thread
calling into libxl. This can cause deadlock in the libvirt libxl driver

Thread 19 (Thread 0x7f31411ec700 (LWP 14068) "libvirtd"):
#0  0x00007f318520cc7d in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x00007f3185205ed5 in pthread_mutex_lock () from /lib64/libpthread.so.0
#2  0x00007f3189488015 in virMutexLock (m=<optimized out>) at ../../src/util/virthread.c:79
#3  0x00007f3189463f3b in virObjectLock (anyobj=<optimized out>) at ../../src/util/virobject.c:433
#4  0x00007f31894f2f41 in virDomainObjListSearchID (payload=0x7f317400a6d0, name=<optimized out>, data=0x7f31411eaeac) at ../../src/conf/virdomainobjlist.c:105
#5  0x00007f3189437ac5 in virHashSearch (ctable=0x7f3124025a30, iter=iter@entry=0x7f31894f2f30 <virDomainObjListSearchID>, data=data@entry=0x7f31411eaeac, name=name@entry=0x0) at ../../src/util/virhash.c:745
#6  0x00007f31894f3919 in virDomainObjListFindByID (doms=0x7f3124025430, id=<optimized out>) at ../../src/conf/virdomainobjlist.c:121
#7  0x00007f3152f292e5 in libxlDomainEventHandler (data=0x7f3124023d80, event=0x7f310c010ae0) at ../../src/libxl/libxl_domain.c:660
#8  0x00007f3152c6ff5d in egc_run_callbacks (egc=egc@entry=0x7f31411eaf50) at libxl_event.c:1427
#9  0x00007f3152c718bd in libxl__egc_cleanup (egc=0x7f31411eaf50) at libxl_event.c:1458
#10 libxl__ao_inprogress (ao=ao@entry=0x7f310c00b8a0, file=file@entry=0x7f3152cce987 "libxl_domain.c", line=line@entry=730, func=func@entry=0x7f3152ccf750 <__func__.22238> "libxl_domain_unpause") at libxl_event.c:2047
#11 0x00007f3152c8c5b8 in libxl_domain_unpause (ctx=0x7f3124015a40, domid=<optimized out>, ao_how=ao_how@entry=0x0) at libxl_domain.c:730
#12 0x00007f3152f2a584 in libxl_domain_unpause_0x041200 (domid=<optimized out>, ctx=<optimized out>) at /usr/include/libxl.h:1756
#13 libxlDomainStart (driver=driver@entry=0x7f3124023d80, vm=vm@entry=0x7f317400a6d0, start_paused=start_paused@entry=false, restore_fd=restore_fd@entry=-1, restore_ver=<optimized out>, restore_ver@entry=2) at ../../src/libxl/libxl_domain.c:1482
#14 0x00007f3152f2a6e3 in libxlDomainStartNew (driver=driver@entry=0x7f3124023d80, vm=vm@entry=0x7f317400a6d0, start_paused=start_paused@entry=false) at ../../src/libxl/libxl_domain.c:1545
#15 0x00007f3152f2a789 in libxlDomainShutdownHandleRestart (driver=0x7f3124023d80, vm=0x7f317400a6d0) at ../../src/libxl/libxl_domain.c:464
#16 0x00007f3152f2a9e4 in libxlDomainShutdownThread (opaque=<optimized out>) at ../../src/libxl/libxl_domain.c:559
#17 0x00007f3189487ee2 in virThreadHelper (data=<optimized out>) at ../../src/util/virthread.c:196
#18 0x00007f3185203539 in start_thread () from /lib64/libpthread.so.0
#19 0x00007f3184f3becf in clone () from /lib64/libc.so.6

Frame 16 runs a thread created to handle domain shutdown processing for
domid 28712. In this case the event contained the reboot reason, so the
old domain is destroyed and a new one is created by libxlDomainStart new.
After starting the domain, it is unpaused by calling libxl_domain_unpause
in frame 12. While the thread is running within libxl, libxl takes the
opportunity to deliver a pending domain shutdown event for unrelated domid
28710. While searching for the associated virDomainObj by ID, a deadlock is
encountered when attempting to lock the virDomainObj for domid 28712, which
is already locked since this thread is processing its shutdown event.

The deadlock can be avoided by moving the search for a virDomainObj
associated with the event domid to the shutdown thread. The same is done
for the death thread.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Handle domain death events in a thread
Jim Fehlig [Wed, 24 Nov 2021 18:36:55 +0000 (11:36 -0700)]
libxl: Handle domain death events in a thread

Similar to domain shutdown events, processing domain death events can be a
lengthy process and we don't want to block the event handler while the
operation completes. Move the death handling function to a thread.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Modify name of shutdown thread
Jim Fehlig [Wed, 24 Nov 2021 18:16:38 +0000 (11:16 -0700)]
libxl: Modify name of shutdown thread

The current thread name 'ev-<domid>' is a bit terse. Change the name
to 'shutdown-event-<domid>', allowing it to be distinguished between
thread handling other event types.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Rename libxlShutdownThreadInfo struct
Jim Fehlig [Wed, 24 Nov 2021 18:10:19 +0000 (11:10 -0700)]
libxl: Rename libxlShutdownThreadInfo struct

An upcoming change will use the struct in a thread created to process
death events. Rename libxlShutdownThreadInfo to libxlEventHandlerThreadInfo
to reflect the more generic usage.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Disable death events after receiving a shutdown event
Jim Fehlig [Fri, 29 Oct 2021 20:16:33 +0000 (14:16 -0600)]
libxl: Disable death events after receiving a shutdown event

The libxl driver will handle all domain destruction and cleanup
when receiving a domain shutdown event from libxl. Commit fa30ee04a2a
introduced the ignoreDeathEvent boolean in the DomainObjPrivate struct
to ignore subsequent death events from libxl. But libxl already provides
a mechanism to disable death events via libxl_evdisable_domain_death.

This patch partially reverts commit fa30ee04a2a and instead uses
libxl_evdisable_domain_death to disable subsequent death events when
processing a shutdown event.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuConnectGetAllDomainStats: Simplify qemuDomainGetStats() error handling
Michal Privoznik [Thu, 11 Nov 2021 10:26:54 +0000 (11:26 +0100)]
qemuConnectGetAllDomainStats: Simplify qemuDomainGetStats() error handling

In qemuConnectGetAllDomainStats() there a loop that iterates over
all domains that stats are to be fetched for. Within this loop
the qemuDomainGetStats() is called which is responsible for
fetching stats for an individual domain. Now, the code that
handles successful and failure cases is almost the same. Rework
it, so that the code is deduplicated. Note, that the check for
!tmp is dropped because upon successful return from
qemuDomainGetStats() it is always allocated.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: prefer .requiredCaps for VIR_DOMAIN_STATS_IOTHREAD
Michal Privoznik [Thu, 11 Nov 2021 10:20:29 +0000 (11:20 +0100)]
qemu: prefer .requiredCaps for VIR_DOMAIN_STATS_IOTHREAD

Since f29d7c3e698 we have an option for checking capabilities
required for given type of statistics upfront, instead of the
callback. Switch qemuDomainGetStatsIOThread() callback to the new
style.

This will now error out properly if user requests IOTHREAD stats
forcibly (via VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS
flag) but QEMU doesn't support IOThreads. Previously, this was
silently ignored.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Drop comma after QEMU_CAPS_LAST in queryDirtyRateRequired[]
Michal Privoznik [Thu, 11 Nov 2021 10:17:26 +0000 (11:17 +0100)]
qemu: Drop comma after QEMU_CAPS_LAST in queryDirtyRateRequired[]

The idea of queryDirtyRateRequired[] is that it lists QEMU
capabilities required for given domstats record
(VIR_DOMAIN_STATS_DIRTYRATE in this particular case) and
QEMU_CAPS_LAST is used as a sentinel. Therefore, there can never
be anything after it. Drop the comma to make it more obvious.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirnetdevveth: Do report error if creating veth fails
Michal Privoznik [Thu, 2 Dec 2021 12:04:05 +0000 (13:04 +0100)]
virnetdevveth: Do report error if creating veth fails

For some weird reason we are ignoring errors when creating veth
pair that netlink reports. This affects the LXC driver which
creates interfaces for container in
virLXCProcessSetupInterfaces(). If creating a veth pair fails, no
error is reported and the control jumps onto cleanup label where
some cryptic error message is reported instead (something about
inability to remove veth pair).

Let's report error that netlink returned - it's probably the most
accurate reason anyways.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/225
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirnetserver: Make pool job name less generic
Jiri Denemark [Fri, 26 Nov 2021 16:23:03 +0000 (17:23 +0100)]
virnetserver: Make pool job name less generic

The generic "rpc-worker" name becomes a name of the associated task,
which may than appear in logs and bring some confusion. Let's add a
server name to it so that one can easily see which daemon the task
belongs to, which is especially useful for split daemons. And since the
name would be too long, we can drop the "-worker" part and just keep it
as "rpc-*" and "prio-rpc-*".

Such confusing entries can, for example, be found in audit log when
SELinux is complaining that "rpc-worker" was denied access to something.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetserver: Use autoptr for virNetServer and virNetServerClient
Jiri Denemark [Fri, 26 Nov 2021 16:21:46 +0000 (17:21 +0100)]
virnetserver: Use autoptr for virNetServer and virNetServerClient

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetserver: Format functions consistently
Jiri Denemark [Fri, 26 Nov 2021 15:58:07 +0000 (16:58 +0100)]
virnetserver: Format functions consistently

The file used a pretty inconsistent style for formatting function
headers. Return types were both separate and on the same line as
function names and functions were separated by one, two, and sometimes
even three empty lines. Let's make it consistent by honoring our
preferred coding style.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirthreadpool: Copy job name
Jiri Denemark [Fri, 26 Nov 2021 15:22:43 +0000 (16:22 +0100)]
virthreadpool: Copy job name

Currently virThreadPoolNewFull relies on the caller to ensure the job
name outlives the thread pool. Which basically enforces static strings.
Let's drop this implicit requirement by making a copy of the job name.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: virhash: Replace 'virHashDataFree' by 'GDestroyNotify'
Peter Krempa [Tue, 30 Nov 2021 13:40:43 +0000 (14:40 +0100)]
util: virhash: Replace 'virHashDataFree' by 'GDestroyNotify'

We pass through to glib's hash table functions so we can also use glibs
function prototype definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoutil: virhash: Remove 'virHashFree'
Peter Krempa [Tue, 30 Nov 2021 13:20:02 +0000 (14:20 +0100)]
util: virhash: Remove 'virHashFree'

The code was converted to stop using this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoSwitch away from virHashFree
Peter Krempa [Tue, 30 Nov 2021 13:13:28 +0000 (14:13 +0100)]
Switch away from virHashFree

Use 'g_clear_pointer(&ptr, g_hash_table_unref)' instead.

In few instances it allows us to also remove explicit clearing of
pointers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuxml2argvtest: Use 'g_hash_table_unref' for clearing the qapi schema cache
Peter Krempa [Tue, 30 Nov 2021 13:07:36 +0000 (14:07 +0100)]
qemuxml2argvtest: Use 'g_hash_table_unref' for clearing the qapi schema cache

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemumonitorjsontest: mymain: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemumonitorjsontest: mymain: Automatically free GHashTable

Use separate automatically cleared variables for the x86_64 and s390
versions of the QAPI schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemumonitorjsontest: testBlockNodeNameDetect: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemumonitorjsontest: testBlockNodeNameDetect: Automatically free GHashTable

Additionally we no longer need the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agonwfilterxml2firewalltest: testCompareXMLToArgvFiles: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
nwfilterxml2firewalltest: testCompareXMLToArgvFiles: Automatically free GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agonwfilterxml2firewalltest: virNWFilterIncludeDefToRuleInst: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
nwfilterxml2firewalltest: virNWFilterIncludeDefToRuleInst: Automatically free GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuCheckpointGetXMLDescUpdateSize: Don't combine automatic freeing with manual
Peter Krempa [Tue, 30 Nov 2021 12:16:15 +0000 (13:16 +0100)]
qemuCheckpointGetXMLDescUpdateSize: Don't combine automatic freeing with manual

'blockNamedNodeData' is declared for automatic freeing but we also free
it manually and reuse which is a code pattern we don't normally allow.

Rewrite the code to have actually two separate hash tables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuProcessRefreshLegacyBlockjobs: Automatically free GHashTable and refactor cleanup
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemuProcessRefreshLegacyBlockjobs: Automatically free GHashTable and refactor cleanup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuProcessRefreshDisks: Automatically free GHashTable and refactor cleanup
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemuProcessRefreshDisks: Automatically free GHashTable and refactor cleanup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuProcessWaitForMonitor: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemuProcessWaitForMonitor: Automatically free GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuRefreshPRManagerState: Automatically free GHashTable and refactor cleanup
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemuRefreshPRManagerState: Automatically free GHashTable and refactor cleanup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup
Peter Krempa [Tue, 30 Nov 2021 10:49:24 +0000 (11:49 +0100)]
qemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuMigrationSrcFetchMirrorStats: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:42:17 +0000 (11:42 +0100)]
qemuMigrationSrcFetchMirrorStats: Automatically free GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuDomainGetDiskErrors: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:42:17 +0000 (11:42 +0100)]
qemuDomainGetDiskErrors: Automatically free GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuDomainBlocksStatsGather: Automatically free GHashTable and refactor cleanup
Peter Krempa [Tue, 30 Nov 2021 10:41:26 +0000 (11:41 +0100)]
qemuDomainBlocksStatsGather: Automatically free GHashTable and refactor cleanup

No need for the cleanup section once we switch to g_autoptr.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuDomainUpdateMemoryDeviceInfo: Automatically free temporary GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:38:48 +0000 (11:38 +0100)]
qemuDomainUpdateMemoryDeviceInfo: Automatically free temporary GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirNWFilterBuildAll: Automatically free temporary GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:35:42 +0000 (11:35 +0100)]
virNWFilterBuildAll: Automatically free temporary GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirNWFilterDoInstantiate: Automatically free temporary GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:35:42 +0000 (11:35 +0100)]
virNWFilterDoInstantiate: Automatically free temporary GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agolibxlLoggerNew: Avoid virHashFree by rearranging code
Peter Krempa [Tue, 30 Nov 2021 10:34:43 +0000 (11:34 +0100)]
libxlLoggerNew: Avoid virHashFree by rearranging code

Allocate the hash table only after the log file is opened so that we
don't need to deallocate it on failure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirDomainDeviceValidateAliasImpl: Automatically free GHashTable and remove cleanup
Peter Krempa [Tue, 30 Nov 2021 10:33:52 +0000 (11:33 +0100)]
virDomainDeviceValidateAliasImpl: Automatically free GHashTable and remove cleanup

After the conversion to g_autofree, the cleanup label is no longer
needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirDomainNetDefParseXML: Automatically free GHashTable
Peter Krempa [Tue, 30 Nov 2021 10:33:10 +0000 (11:33 +0100)]
virDomainNetDefParseXML: Automatically free GHashTable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirStorageSourceIsSameLocation: Special-case storage sources of type 'volume'
Peter Krempa [Fri, 26 Nov 2021 12:21:47 +0000 (13:21 +0100)]
virStorageSourceIsSameLocation: Special-case storage sources of type 'volume'

The function is used also to compare virStorageSource which may not be
resolved to the image at that point in which case the 'path' is not yet
populated and the actual type is not yet set. This means that the
function fails to consider two identical volume-based disks as pointing
to the same thing.

Add a special case for both images being type=volume in which case we
compare only the pool/volume names.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/240
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuBlockJobRewriteConfigDiskSource: Add debug statements when skipping disk update
Peter Krempa [Fri, 26 Nov 2021 12:30:49 +0000 (13:30 +0100)]
qemuBlockJobRewriteConfigDiskSource: Add debug statements when skipping disk update

It makes it easier to see what's going on when trying to figure out why
the disk definition was not updated on a finalized blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoconf: domain: Convert all string length checks to STRLIM
Peter Krempa [Thu, 25 Nov 2021 12:38:19 +0000 (13:38 +0100)]
conf: domain: Convert all string length checks to STRLIM

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDeviceLoadparmIsValid: Use 'strspn' instead of a loop
Peter Krempa [Thu, 25 Nov 2021 12:44:13 +0000 (13:44 +0100)]
virDomainDeviceLoadparmIsValid: Use 'strspn' instead of a loop

In other places we use strspn to validate a character subset. Convert
the in-place loop and simplify the error message.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDeviceLoadparmIsValid: Simplify value lenght check
Peter Krempa [Thu, 25 Nov 2021 12:32:18 +0000 (13:32 +0100)]
virDomainDeviceLoadparmIsValid: Simplify value lenght check

Use the new STRLIM macro and unify it with the empty string check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agointernal: Add STRLIM macro for checking string length using strnlen()
Peter Krempa [Wed, 24 Nov 2021 16:03:07 +0000 (17:03 +0100)]
internal: Add STRLIM macro for checking string length using strnlen()

As a microoprimization when checking whether length of a string fits
into a limit we don't necessarily need to calculate the full length but
can use strnlen to check only LIMIT+1 chars. Add a macro which will
simplify the expressions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: seclabel: Parse booleans using virXMLPropTristateBool instead of virStringParse...
Peter Krempa [Wed, 24 Nov 2021 13:53:04 +0000 (14:53 +0100)]
conf: seclabel: Parse booleans using virXMLPropTristateBool instead of virStringParseYesNo

Reduce the extent of custom logic and custom error messages by using
virXMLPropTristateBool.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: enum: Add helpers for converting virTristate* to a plain bool
Peter Krempa [Wed, 24 Nov 2021 13:48:12 +0000 (14:48 +0100)]
util: enum: Add helpers for converting virTristate* to a plain bool

The helpers will update the passed boolean if the tristate's value is
not _ABSENT.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agorun: detect daemons when run via wrapper commands
Daniel P. Berrangé [Wed, 24 Nov 2021 12:02:20 +0000 (12:02 +0000)]
run: detect daemons when run via wrapper commands

The run script tries to detect when a daemon is being run in order to
shutdown other systemd unit files that clash. As implemented this
only works if the daemon name is the first argument. This won't be the
case if running via GDB or strace eg

  ./run strace -e trace=openat ./build/src/virtqemud

We need to check all argv to find which might be a daemon path/name.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: mock swtpm initialization in tests
Daniel P. Berrangé [Tue, 23 Nov 2021 17:39:16 +0000 (17:39 +0000)]
qemu: mock swtpm initialization in tests

The domain capabilities won't report TPM support unless SWTPM can be
initialized. To avoid relying on the swtpm install in the host, mock
the entire initialization method, since all it needs todo is return
a non-error value.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: fill in domain capabilities for TPMs
Daniel P. Berrangé [Tue, 23 Nov 2021 17:18:36 +0000 (17:18 +0000)]
qemu: fill in domain capabilities for TPMs

This reports what TPM features QEMU supports, provided that swtpm is
installed in the host.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoconf: add TPM devices to domain capabilities
Daniel P. Berrangé [Tue, 23 Nov 2021 17:17:20 +0000 (17:17 +0000)]
conf: add TPM devices to domain capabilities

This adds reporting of available TPM models and backends to the domain
capabilities schema

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: add a method for checking if swtpm is available
Daniel P. Berrangé [Wed, 24 Nov 2021 13:36:21 +0000 (13:36 +0000)]
util: add a method for checking if swtpm is available

The QEMU domain capabilities code wants to quietly know whether swtpm is
available on the host.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: pull TPM capabilities probing out of main init method
Daniel P. Berrangé [Wed, 24 Nov 2021 13:30:19 +0000 (13:30 +0000)]
util: pull TPM capabilities probing out of main init method

Many methods merely want to know that the swtpm binaries have been
found, and don't care about probing for capabilities. Even when
starting a guest, the QEMU driver may not need the capabilities.

Skipping probing ensures the VM startup path is as fast as possible
when capabilities are not required. It also removes various error
scenarios from the main init method.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: ensure all TPM global vars access is protected by lock
Daniel P. Berrangé [Wed, 24 Nov 2021 10:30:25 +0000 (10:30 +0000)]
util: ensure all TPM global vars access is protected by lock

The virTPMEmulatorInit method updates various global variables
and holds a lock while doing so. Other methods which access
these variables, however, don't reliably hold locks over all
of their accesses.

Since virTPMEmulatorInit is no longer exported, we can push
the locking up into all the callers and achieve proper safety
for concurrent usage.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: don't export virTPMEmulatorInit method
Daniel P. Berrangé [Wed, 24 Nov 2021 12:10:10 +0000 (12:10 +0000)]
util: don't export virTPMEmulatorInit method

Every other exported API from virtpm.h will internally call
virTPMEmulatorInit, so there is no reason for this initializer
to be exported on its own.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: replace TPM global variables with a struct array
Daniel P. Berrangé [Wed, 24 Nov 2021 10:22:11 +0000 (10:22 +0000)]
util: replace TPM global variables with a struct array

The virTPMEmulatorInit function defines a struct that gets filled with
pointers to global variables. It will be simpler to just use the struct
for the global variables directly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: refactor TPM helper methods to reduce duplicationm
Daniel P. Berrangé [Wed, 24 Nov 2021 13:13:15 +0000 (13:13 +0000)]
util: refactor TPM helper methods to reduce duplicationm

The TPM helper methods for querying the binary path and capabilities
have the same patterns across all swtpm binaries. This code duplication
can be reduced by introducing helper methods.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: rename typedef for parsing swtpm capabilities
Daniel P. Berrangé [Wed, 24 Nov 2021 10:19:49 +0000 (10:19 +0000)]
util: rename typedef for parsing swtpm capabilities

Best practice is to have all types use a naming convention based on the
filename.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoutil: use consistent naming for swtpm global variables
Daniel P. Berrangé [Wed, 24 Nov 2021 10:15:22 +0000 (10:15 +0000)]
util: use consistent naming for swtpm global variables

Use a '_path' suffix on all vars which are paths.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu_domainjob: move jobs_queued to struct qemuDomainJobObj
Kristina Hanicova [Wed, 1 Dec 2021 09:41:41 +0000 (10:41 +0100)]
qemu_domainjob: move jobs_queued to struct qemuDomainJobObj

I think it makes more sense for the variable about jobs to be in
the job object. I also renamed it to be consistent with the rest
of the struct.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: don't strip audio elements with user config present
Daniel P. Berrangé [Wed, 10 Nov 2021 17:58:48 +0000 (17:58 +0000)]
qemu: don't strip audio elements with user config present

To support backwards live migration we must strip the default added
audio element, however, we are too aggressive in doing so. We are only
comparing a couple of attributes for equality, so risk stripping config
that was user customized. To improve this we need to a deep comparison
of the audio config.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoconf: add helper for comparing virDomainAudioDef objects
Daniel P. Berrangé [Wed, 10 Nov 2021 17:58:18 +0000 (17:58 +0000)]
conf: add helper for comparing virDomainAudioDef objects

It is useful to be able to deeply check them for equality.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu_snapshot: create: drop redefine boolean
Pavel Hrdina [Tue, 12 Oct 2021 10:10:32 +0000 (12:10 +0200)]
qemu_snapshot: create: drop redefine boolean

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move snapshot create to separate function
Pavel Hrdina [Thu, 25 Nov 2021 15:11:52 +0000 (16:11 +0100)]
qemu_snapshot: create: move snapshot create to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move snapshot redefine to separate function
Pavel Hrdina [Tue, 5 Oct 2021 09:52:02 +0000 (11:52 +0200)]
qemu_snapshot: create: move snapshot redefine to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move saving metadata to separate function
Pavel Hrdina [Mon, 4 Oct 2021 18:18:49 +0000 (20:18 +0200)]
qemu_snapshot: create: move saving metadata to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: refactor endjob in qemuSnapshotCreateXML
Pavel Hrdina [Wed, 29 Sep 2021 17:18:57 +0000 (19:18 +0200)]
qemu_snapshot: create: refactor endjob in qemuSnapshotCreateXML

The logic of saving metadata doesn't have to be in endjob section as
it will only happen if we have successfully created snapshot.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: drop update_current variable
Pavel Hrdina [Wed, 29 Sep 2021 17:02:39 +0000 (19:02 +0200)]
qemu_snapshot: create: drop update_current variable

There is no need for the extra variable as it is used only at one place.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: virDomainSnapshotGetCurrent is not used with redefine
Pavel Hrdina [Thu, 25 Nov 2021 14:59:42 +0000 (15:59 +0100)]
qemu_snapshot: create: virDomainSnapshotGetCurrent is not used with redefine

Move it to code path for creating new snapshot.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move virDomainSnapshotAssignDef to both code paths
Pavel Hrdina [Wed, 29 Sep 2021 16:53:52 +0000 (18:53 +0200)]
qemu_snapshot: create: move virDomainSnapshotAssignDef to both code paths

This makes it obvious that the function is called for creating new
snapshot and redefining old snapshot as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move disk align to separate function
Pavel Hrdina [Wed, 29 Sep 2021 16:51:09 +0000 (18:51 +0200)]
qemu_snapshot: create: move disk align to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move XML def validation to separate function
Pavel Hrdina [Wed, 3 Nov 2021 09:53:12 +0000 (10:53 +0100)]
qemu_snapshot: create: move XML def validation to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_snapshot: create: move XML parsing to separate function
Pavel Hrdina [Wed, 22 Sep 2021 11:28:34 +0000 (13:28 +0200)]
qemu_snapshot: create: move XML parsing to separate function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_domainjob: remove dead code
Kristina Hanicova [Tue, 30 Nov 2021 12:33:47 +0000 (13:33 +0100)]
qemu_domainjob: remove dead code

Function qemuDomainJobAllowed() is never used -> remove it.

The last use was removed in commit 3f2fa8f3032779bf09590a4b24898636ee916876

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: absorb qemuDomainObjExitMonitorInternal
Ján Tomko [Wed, 24 Nov 2021 12:32:42 +0000 (13:32 +0100)]
qemu: absorb qemuDomainObjExitMonitorInternal

qemuDomainObjExitMonitor is just an alias for it at this point.

This also removes the incomplete ATTRIBUTE_NONNULL(1) annotation.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: turn qemuDomainObjExitMonitor into void
Ján Tomko [Wed, 24 Nov 2021 12:41:09 +0000 (13:41 +0100)]
qemu: turn qemuDomainObjExitMonitor into void

This reverts my
    commit dc2fd51fd727bbb6de172e0ca4b7dd307bb99180
    Check for domain liveness in qemuDomainObjExitMonitor
which fixed the symptoms of the bug later fixed by
    commit 81f50cb92d16643bcd749e3ab5b404b8b7cec643
    qemu: Avoid calling qemuProcessStop without a job

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: remove ignore_value for qemuDomainObjExitMonitor
Ján Tomko [Wed, 24 Nov 2021 12:12:40 +0000 (13:12 +0100)]
qemu: remove ignore_value for qemuDomainObjExitMonitor

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: do not check return value of qemuDomainObjExitMonitor
Ján Tomko [Wed, 24 Nov 2021 12:11:52 +0000 (13:11 +0100)]
qemu: do not check return value of qemuDomainObjExitMonitor

Remove the check from conditions where it's coupled with some other
checks.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: do not check return value of qemuDomainObjExitMonitor
Ján Tomko [Wed, 24 Nov 2021 12:09:32 +0000 (13:09 +0100)]
qemu: do not check return value of qemuDomainObjExitMonitor

Remove the unreachable code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: do not propagate return value of qemuDomainObjExitMonitor
Ján Tomko [Wed, 24 Nov 2021 12:42:09 +0000 (13:42 +0100)]
qemu: do not propagate return value of qemuDomainObjExitMonitor

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: qemuDomainObjExitMonitor: do not warn on unused result
Ján Tomko [Wed, 24 Nov 2021 12:44:56 +0000 (13:44 +0100)]
qemu: qemuDomainObjExitMonitor: do not warn on unused result

This wrapper for qemuDomainObjExitMonitorInternal was
extended by my commit dc2fd51fd727bbb6de172e0ca4b7dd307bb99180
to check whether the domain is still alive, because
we were observing crashes if the QEMU process died
while some of our APIs were in the monitor and the thread
processing the EOF event freed the domain definition.

This bug was fixed by:
    commit 81f50cb92d16643bcd749e3ab5b404b8b7cec643
    qemu: Avoid calling qemuProcessStop without a job
but we kept checking for the return value since.

Remove the G_GNUC_WARN_UNUSED_RESULT attribute since
all of the calls that could set def->id to -1 are protected
by qemuProcessBeginStopJob and cannot happen while we have a job
in the monitor.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoPost-release version bump to 8.0.0
Jiri Denemark [Wed, 1 Dec 2021 09:53:20 +0000 (10:53 +0100)]
Post-release version bump to 8.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoRelease of libvirt-7.10.0
Jiri Denemark [Wed, 1 Dec 2021 09:50:47 +0000 (10:50 +0100)]
Release of libvirt-7.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoNEWS: Mention two minor regression fixes and addition to bulk stats
Peter Krempa [Thu, 25 Nov 2021 14:54:45 +0000 (15:54 +0100)]
NEWS: Mention two minor regression fixes and addition to bulk stats

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoNEWS: document DEVICE_UNPLUG_GUEST_ERROR support
Daniel Henrique Barboza [Fri, 12 Nov 2021 18:47:48 +0000 (15:47 -0300)]
NEWS: document DEVICE_UNPLUG_GUEST_ERROR support

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agovz: fix vzCapsAddGuestDomain
Ján Tomko [Mon, 29 Nov 2021 16:15:10 +0000 (17:15 +0100)]
vz: fix vzCapsAddGuestDomain

There is a stray 'return -1' executed on all code paths.

Fixes: c18d9e23fafabcfbb80481e0705931036b8e7331
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: canonicalize 'arm64' arch to 'aarch64'
Daniel P. Berrangé [Tue, 30 Nov 2021 10:51:33 +0000 (10:51 +0000)]
util: canonicalize 'arm64' arch to 'aarch64'

macOS on Apple silicon reports 'arm64' as the architecture from uname,
which we need to canonicalize to VIR_ARCH_AARCH64 / 'aarch64'.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotools: fix iterating over argv when recovering xattr
Daniel P. Berrangé [Fri, 26 Nov 2021 13:36:16 +0000 (13:36 +0000)]
tools: fix iterating over argv when recovering xattr

The libvirt_recover_xattrs.sh tool hangs when run. When no flags
are provided OPTIND is 1, so the loop expands to 'shift 0' which
has not effect. Rewrite to just loop over $@ instead which involves
less cleverness.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agowireshark: Drop needless comment in dissect_xdr_bytes()
Michal Privoznik [Mon, 29 Nov 2021 09:20:05 +0000 (10:20 +0100)]
wireshark: Drop needless comment in dissect_xdr_bytes()

In the dissect_xdr_bytes() there's a comment that the string
allocated by xdr_bytes() can't be freed using xdr_free(). Well,
that is expected because xdr_bytes() used plain calloc() AND the
string is not an XDR struct but plain 'char *' type. Passing it
to xdr_free() must result in weird things happening.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agowireshark: Switch to tvb_bytes_to_str()
Michal Privoznik [Mon, 29 Nov 2021 08:57:49 +0000 (09:57 +0100)]
wireshark: Switch to tvb_bytes_to_str()

When the dissector sees a byte sequence that is either an opaque
data (xdr_opaque) or a byte sequence (xdr_bytes) it formats the
bytes as a hex numbers using our own implementation. But
wireshark already provides a function for it: tvb_bytes_to_str().
NB, the reason why it returns a const string is so that callers
don't try to free it - the string is allocated using an allocator
which will decide when to free it.

The wireshark formatter was introduced in wireshark commit of
v1.99.2~479 and thus is present in the version we require at
least (2.6.0).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Sat, 27 Nov 2021 15:16:17 +0000 (16:16 +0100)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10439 of 10439 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>
3 years agoTranslated using Weblate (Korean)
simmon [Sat, 27 Nov 2021 15:16:17 +0000 (16:16 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10439 of 10439 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.8% (10423 of 10439 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
3 years agoUpdate translation files
Weblate [Sat, 27 Nov 2021 15:16:14 +0000 (16: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>
3 years agoqemu: Fix validation of PCI option rom settings on hotplug
Peter Krempa [Thu, 25 Nov 2021 15:17:16 +0000 (16:17 +0100)]
qemu: Fix validation of PCI option rom settings on hotplug

Commit 24be92b8e moved the option rom settings validation code to the
validation callbacks, but that doesn't work properly with device hotplug
as we assign addresses only after parsing the whole XML. The check is
too strict for that and caused failures when hotplugging devices such
as:

 <interface type='network'>
   <source network='default'/>
   <model type='virtio'/>
   <rom enabled='no'/>
 </interface>

This patch relaxes the check in the validation callback to accept also
_NONE and _UNASSIGNED address types and returns the check to
'qemuBuildRomProps' so that we preserve the full validation as we've
used to.

Fixes: 24be92b8e38762e9ba13e
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2021437
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor: Fix usage of 'query-blockstats'
Peter Krempa [Wed, 24 Nov 2021 16:22:29 +0000 (17:22 +0100)]
qemu: monitor: Fix usage of 'query-blockstats'

Commit bc24810c2cab modified code querying blockstats to use the
'query-nodes' parameter so that we can fetch stats also for images which
are not attached to a frontend such as block copy and backup scratch
images.

Unfortunately that broke the old blockstats because if 'query-nodes' is
enabled qemu doesn't output the 'qdev' parameter which our code used for
matching to the disk and also qemu neglects to populate the frontend
stats at all so we can't even switch to using nodename for matching.

To fix this we need to do two calls, one with 'query-nodes' disabled
using the old logic to populate everything and then an additional one
which populates all the remaining images.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/246
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Erik Skultety <eskultet@redhat.com>