Commit Graph

50362 Commits

Author SHA1 Message Date
Martin Kletzander
23c4794488 vmx: Check serialX.vspc before serialX.fileName
When using vSPC (Virtual Serial Port Concentrator) in vSphere the actual
address for it is saved in serialX.vspc in which case the
serialX.fileName is most probably something we can't get any useful
information from and we also fail during the parsing rendering any
dumpxml and similar tries unsuccessful.

Instead of parsing the vspc URL with something along the lines of
`virURIParse(vspc ? vspc : fileName)`, which could lead to us reporting
information that is very prune to misuse (the vSPC seemingly has a
protocol on top of the telnet connection; redefining the domain would
change the behaviour; the URL might have a fragment we are not saving;
etc.) or adding more XML knobs to indicate vSPC usage (which we would
not be able to configure; we'd have to properly error out everywhere;
etc.) let's just report dummy serial port that leads to nowhere (i.e.
type="null").

Resolves: https://issues.redhat.com/browse/RHEL-32182
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-05-02 17:22:37 +02:00
Daniel P. Berrangé
8074d64dc2 rpc: ensure temporary GSource is removed from client event loop
Users are seeing periodic segfaults from libvirt client apps,
especially thread heavy ones like virt-manager. A typical
stack trace would end up in the virNetClientIOEventFD method,
with illegal access to stale stack data. eg

==238721==ERROR: AddressSanitizer: stack-use-after-return on address 0x75cd18709788 at pc 0x75cd3111f907 bp 0x75cd181ff550 sp 0x75cd181ff548
WRITE of size 4 at 0x75cd18709788 thread T11
    #0 0x75cd3111f906 in virNetClientIOEventFD /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1634:15
    #1 0x75cd3210d198  (/usr/lib/libglib-2.0.so.0+0x5a198) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    #2 0x75cd3216c3be  (/usr/lib/libglib-2.0.so.0+0xb93be) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    #3 0x75cd3210ddc6 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x5adc6) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
    #4 0x75cd3111a47c in virNetClientIOEventLoop /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1722:9
    #5 0x75cd3111a47c in virNetClientIO /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2002:10
    #6 0x75cd3111a47c in virNetClientSendInternal /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2170:11
    #7 0x75cd311198a8 in virNetClientSendWithReply /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2198:11
    #8 0x75cd31111653 in virNetClientProgramCall /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclientprogram.c:318:9
    #9 0x75cd31241c8f in callFull /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6054:10
    #10 0x75cd31241c8f in call /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6076:12
    #11 0x75cd31241c8f in remoteNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/src/remote/remote_client_bodies.h:5959:9
    #12 0x75cd31410ff7 in virNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/libvirt-network.c:952:15

The root cause is a bad assumption in the virNetClientIOEventLoop
method. This method is run by whichever thread currently owns the
buck, and is responsible for handling I/O. Inside a for(;;) loop,
this method creates a temporary GSource, adds it to the event loop
and runs g_main_loop_run(). When I/O is ready, the GSource callback
(virNetClientIOEventFD) will fire and call g_main_loop_quit(), and
return G_SOURCE_REMOVE which results in the temporary GSource being
destroyed. A g_autoptr() will then remove the last reference.

What was overlooked, is that a second thread can come along and
while it can't enter virNetClientIOEventLoop, it will register an
idle source that uses virNetClientIOWakeup to interrupt the
original thread's 'g_main_loop_run' call. When this happens the
virNetClientIOEventFD callback never runs, and so the temporary
GSource is not destroyed. The g_autoptr() will remove a reference,
but by virtue of still being attached to the event context, there
is an extra reference held causing GSource to be leaked. The
next time 'g_main_loop_run' is called, the original GSource will
trigger its callback, and access data that was allocated on the
stack by the previous thread, and likely SEGV.

To solve this, the thread calling 'g_main_loop_run' must call
g_source_destroy, immediately upon return, to guarantee that
the temporary GSource is removed.

CVE-2024-4418
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reported-by: Martin Shirokov <shirokovmartin@gmail.com>
Tested-by: Martin Shirokov <shirokovmartin@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-05-02 14:46:31 +01:00
Rayhan Faizel
a1a3da94f5 qemu: Generate command line for sound devices with model 'virtio'
Allow generation of command line for virtio-sound-pci and virtio-sound-device
devices along with additional virtio options.

A new testcase is added to test virtio-sound-pci. The
arm-vexpressa9-virtio testcase is also extended to test virtio-sound-device.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 15:38:34 +02:00
Rayhan Faizel
bb593e3743 conf: Introduce support for virtio-sound devices
This patch adds parsing of the virtio sound model, along with parsing
of virtio options and PCI/virtio-mmio address assignment.

A new 'streams' attribute is added for configuring number of PCM streams
(default is 2) in virtio sound devices. QEMU additionally has jacks and chmaps
parameters but these are currently stubbed, hence they are excluded in this
patch series.

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 15:38:32 +02:00
Rayhan Faizel
9081320b53 qemu_capabilities: Add QEMU_CAPS_DEVICE_VIRTIO_SOUND capability
Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 15:37:53 +02:00
Daniel P. Berrangé
d754500e5f ci: drop CentOS 8 Stream and refresh
This drops the CentOS 8 Stream distro target, since that is going EOL
at the end of May, at which point it will cease to be installable
due to package repos being archived.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-05-02 13:52:30 +01:00
Daniel P. Berrangé
8132d38120 ci: refresh with latest lcitool manifest
This brings in a fix to the job rules which solves a problem with
jobs getting skipped in merge requests in some scenarios. It also
changes the way Cirrus CI vars are set, which involves a weak to
the way $PATH is set in build.yml.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-05-02 13:52:17 +01:00
Michal Privoznik
bc70aa1df3 scripts/meson-dist.py: Get builddir from env too
When meson runs a dist script it sets both MESON_BUILD_ROOT and
MESON_DIST_ROOT envvars [1]. But for some reason, we took the
former as an argument and obtained the latter via env. Well,
obtain both via env.

1: https://mesonbuild.com/Reference-manual_builtin_meson.html#mesonadd_dist_script
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 14:33:20 +02:00
Kristina Hanicova
c95cc67efb qemu: format machine virt ras feature and test it
Resolves: https://issues.redhat.com/browse/RHEL-7489
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 13:17:17 +02:00
Kristina Hanicova
a43007b3c4 qemu: validate machine virt ras feature
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 13:17:17 +02:00
Kristina Hanicova
aaf4196843 conf: parse and format machine virt ras feature
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 13:17:16 +02:00
Kristina Hanicova
ffaf77a30d qemu: introduce QEMU_CAPS_MACHINE_VIRT_RAS capability
The capability can be used to detect if the qemu binary already
supports 'ras' feature for 'virt' machine type.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2024-05-02 13:17:16 +02:00
Jiri Denemark
8c80acdec0 Post-release version bump to 10.4.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-05-02 11:10:01 +02:00
Jiri Denemark
bcb3cfb5f8 Release of libvirt-10.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-05-02 11:07:09 +02:00
Michal Privoznik
ad3796c5ca NEWS: Document my contributions for upcoming release
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2024-05-02 10:28:07 +02:00
Göran Uddeborg
311284b3d8 Translated using Weblate (Swedish)
Currently translated at 71.0% (7403 of 10423 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-05-02 08:13:07 +02:00
Peter Krempa
310bf2e2ac NEWS: Document TLS migration bug, usb-net support and two fixes
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2024-04-30 14:08:29 +02:00
Peter Krempa
e9523fa1db NEWS: Fix marking of 'path' as inline literal
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2024-04-30 14:06:55 +02:00
김인수
63f00d09e3 Translated using Weblate (Korean)
Currently translated at 100.0% (10423 of 10423 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
2024-04-30 06:35:54 +02:00
Remus-Gabriel Chelu
3055e9805d Translated using Weblate (Romanian)
Currently translated at 0.8% (89 of 10423 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-28 07:54:24 +02:00
Weblate
66bd25ce50 Translated using Weblate (Romanian)
Currently translated at 0.7% (74 of 10423 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-04-28 01:24:04 +02:00
Remus-Gabriel Chelu
2112b3b8ba Translated using Weblate (Romanian)
Currently translated at 0.7% (74 of 10423 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-28 01:24:04 +02:00
Weblate
76d7d9b4e4 Translated using Weblate (Romanian)
Currently translated at 0.6% (69 of 10423 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-04-28 01:21:23 +02:00
Remus-Gabriel Chelu
59f029803a Translated using Weblate (Romanian)
Currently translated at 0.6% (69 of 10423 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-28 01:21:22 +02:00
Remus-Gabriel Chelu
55031eab99 Translated using Weblate (Romanian)
Currently translated at 0.4% (43 of 10423 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-27 11:40:22 +02:00
Weblate
f7ff831722 Translated using Weblate (Romanian)
Currently translated at 0.3% (32 of 10423 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-04-27 10:15:47 +02:00
Remus-Gabriel Chelu
9d6144c0e8 Translated using Weblate (Romanian)
Currently translated at 0.3% (32 of 10423 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-27 10:15:47 +02:00
Göran Uddeborg
8680805a04 Translated using Weblate (Swedish)
Currently translated at 70.8% (7383 of 10423 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-27 10:15:46 +02:00
Weblate
7a19175876 Translated using Weblate (Romanian)
Currently translated at 0.1% (11 of 10423 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-04-27 10:04:13 +02:00
Remus-Gabriel Chelu
6da62e6fa2 Translated using Weblate (Romanian)
Currently translated at 0.1% (11 of 10423 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-27 10:04:12 +02:00
Göran Uddeborg
047395263b Translated using Weblate (Swedish)
Currently translated at 70.7% (7378 of 10423 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-27 10:04:11 +02:00
Weblate
08e22b3c06 Translated using Weblate (Romanian)
Currently translated at 0.1% (3 of 10423 strings)

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

Co-authored-by: Weblate <noreply-mt-weblate@weblate.org>
Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2024-04-27 09:57:59 +02:00
Remus-Gabriel Chelu
6aa5168d17 Translated using Weblate (Romanian)
Currently translated at 0.1% (3 of 10423 strings)

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

Co-authored-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2024-04-27 09:57:58 +02:00
Yuri Chornoivan
4f30c9273d Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10423 of 10423 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>
2024-04-27 09:57:58 +02:00
Göran Uddeborg
d70e08dd45 Translated using Weblate (Swedish)
Currently translated at 70.6% (7363 of 10423 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-27 09:57:57 +02:00
김인수
f0563789b6 Translated using Weblate (Korean)
Currently translated at 100.0% (10423 of 10423 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2024-04-27 09:57:57 +02:00
Weblate
4a87181005 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>
2024-04-27 09:57:55 +02:00
Jiri Denemark
51589f154d po: Refresh potfile for v10.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2024-04-26 10:19:09 +02:00
Göran Uddeborg
966b394216 Translated using Weblate (Swedish)
Currently translated at 70.3% (7345 of 10438 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2024-04-25 21:48:00 +02:00
Peter Krempa
5540c3d241 vsh: Refactor logic in vshCommandParse
Refactor the existing logic using two nested loops with a jump into the
middle of both with 3 separate places fetching next token to a single
loop using a state machine with one centralized place to fetch next
tokens and add explanation comments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:20 +02:00
Peter Krempa
c27070f738 vsh: Move option assignment debugging from vshCommandParse to vshCmdOptAssign
As we now have a centralized point to assign values to options move the
debugging logic there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
166fe3c7b5 vshCmddefCheckInternals: Remove check for "too many options"
This check was needed due to the use "unsigned long long" as bitmap
which was refactored recently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
bf3e734fac vsh: Refactor parsed option and command assignment
Refactor the very old opaque logic (using multiple bitmaps) by
fully-allocating vshCmdOpt for each possible argument and then filling
them as they go rather than allocating them each time after it's parsed.

This simplifies the checkers and removes the need to cross-reference
multiple arrays.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
22cf91618d vsh: Unexport command lookup helpers 'vshCmddefSearch', 'vshCmdGrpSearch', 'vshCmdGrpHelp'
Neither of them is used outside of vsh.c. 'vshCmddefSearch' needed to be
rearranged as it was called earlier in vsh.c than it was defined.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
41efec103d vsh: Remove unused infrastructure for command completion
Remove the old helpers which were used previously to pick which field to
complete.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
da3c5638f9 virsh: Introduce new 'VSH_OT_ARGV' accessors
In preparation for internal parser refactor introduce new accessors for
the VSH_OT_ARGV type which will return a NULL-terminated string list or
even a concatenated string for the given argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
1818cbda3b vsh: Rework logic for picking which argument is to be completed
Currently the code decides which option to complete by looking into the
input string and trying to infer it based on whether we are at the
end position as we truncate the string to complete to the current cursor
position.

That basically means that only the last-parsed option will be up for
completion.

Replace the logic by remembering which is the last option rather than
using two different position checks and base the completion decision on
that and the actual value of the last argument (see comment).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
b41bde935d virshtest: Add test cases for command completion helper
Add both single invocations as well as a script containing the same
commands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
9950aef282 vsh: Add a VSH_OT_STRING argument for 'virsh echo'
The argument will be used for testing the command/option completer
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00
Peter Krempa
bb9bb55211 vsh: Fix 'stdin' closing in 'cmdComplete'
While the 'complete' command is meant to be hidden and used only for
the completion script, there's nothing preventing it being used in all
virsh modes.

This poses a problem as the command tries to close 'stdin' to avoid the
possibility that an auth callback would want to read the password.

In interactive mode this immediately terminates virsh and in
non-interactive mode it attempts to close it multiple times if you use
virsh in batch mode.

Fix the issues by using virOnce() to close it exactly once and do so
only in non-interactive mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2024-04-25 14:13:19 +02:00