]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agodocs: virsh: Drop duplicate spelling for dompmwakeup
Lin Ma [Fri, 11 Sep 2020 07:06:19 +0000 (15:06 +0800)] 
docs: virsh: Drop duplicate spelling for dompmwakeup

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirsh: pool-list: options --all and --inactive are mutually exclusive
Lin Ma [Fri, 11 Sep 2020 07:06:17 +0000 (15:06 +0800)] 
virsh: pool-list: options --all and --inactive are mutually exclusive

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirsh: iface-list: options --all and --inactive are mutually exclusive
Lin Ma [Fri, 11 Sep 2020 07:06:16 +0000 (15:06 +0800)] 
virsh: iface-list: options --all and --inactive are mutually exclusive

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirsh: domdisplay: options --all and --type are mutually exclusive
Lin Ma [Fri, 11 Sep 2020 07:06:15 +0000 (15:06 +0800)] 
virsh: domdisplay: options --all and --type are mutually exclusive

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirsh: domblkinfo: options --all and --device are mutually exclusive
Lin Ma [Fri, 11 Sep 2020 07:06:14 +0000 (15:06 +0800)] 
virsh: domblkinfo: options --all and --device are mutually exclusive

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Return perf status that affect next boot for shutoff domains
Lin Ma [Fri, 11 Sep 2020 07:06:09 +0000 (15:06 +0800)] 
qemu: Return perf status that affect next boot for shutoff domains

While we set up perf events for a shutoff domain and check the settings,
All of perf events are reported as 'disabled', unless we add --config,
This is redundant for a shutoff domain.

 # virsh domstate $GUEST
shut off

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : disabled
mbml           : disabled
......

 # virsh perf --domain $GUEST --enable mbmt
mbmt           : enabled

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : disabled
mbml           : disabled
......

Use virDomainObjGetOneDefState instead of virDomainObjGetOneDef to fix
the issue. After patch, The perf event status of a shutoff domain is
reported correctly:

 # virsh domstate $GUEST
shut off

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : disabled
mbml           : disabled
......

 # virsh perf --domain $GUEST --enable mbmt
mbmt           : enabled

 # virsh perf --domain $GUEST
cmt            : disabled
mbmt           : enabled
mbml           : disabled
......

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: qemuDomainPMSuspendForDuration: Check availability of agent
Lin Ma [Fri, 11 Sep 2020 07:06:08 +0000 (15:06 +0800)] 
qemu: qemuDomainPMSuspendForDuration: Check availability of agent

It requires a guest agent configured and running in the domain's guest
OS, So check qemu agent during qemuDomainPMSuspendForDuration().

Signed-off-by: Lin Ma <lma@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agodaemon: Fix a comment typo in libvirtd.conf.in
Jim Fehlig [Fri, 11 Sep 2020 20:55:59 +0000 (14:55 -0600)] 
daemon: Fix a comment typo in libvirtd.conf.in

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
4 years agoutil: Remove VIR_REALLOC_N_QUIET
Tim Wiederhake [Fri, 11 Sep 2020 11:42:18 +0000 (13:42 +0200)] 
util: Remove VIR_REALLOC_N_QUIET

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Use glib memory functions in virFileGetXAttrQuiet
Tim Wiederhake [Fri, 11 Sep 2020 11:42:17 +0000 (13:42 +0200)] 
util: Use glib memory functions in virFileGetXAttrQuiet

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotools: Use glib memory functions in vshCompleterFilter
Tim Wiederhake [Fri, 11 Sep 2020 11:42:16 +0000 (13:42 +0200)] 
tools: Use glib memory functions in vshCompleterFilter

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: Use glib memory functions in pci_driver_new
Tim Wiederhake [Fri, 11 Sep 2020 11:42:15 +0000 (13:42 +0200)] 
tests: Use glib memory functions in pci_driver_new

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: Use glib memory functions in add_fd
Tim Wiederhake [Fri, 11 Sep 2020 11:42:14 +0000 (13:42 +0200)] 
tests: Use glib memory functions in add_fd

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Use glib memory functions in qemuProcessReadLog
Tim Wiederhake [Fri, 11 Sep 2020 11:42:13 +0000 (13:42 +0200)] 
qemu: Use glib memory functions in qemuProcessReadLog

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Use glib memory functions in qemuDomainLogContextRead
Tim Wiederhake [Fri, 11 Sep 2020 11:42:12 +0000 (13:42 +0200)] 
qemu: Use glib memory functions in qemuDomainLogContextRead

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Use glib memory functions in qemuDomainMasterKeyReadFile
Tim Wiederhake [Fri, 11 Sep 2020 11:42:11 +0000 (13:42 +0200)] 
qemu: Use glib memory functions in qemuDomainMasterKeyReadFile

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Use glib memory functions in virDevMapperGetTargetsImpl
Tim Wiederhake [Fri, 11 Sep 2020 11:42:08 +0000 (13:42 +0200)] 
util: Use glib memory functions in virDevMapperGetTargetsImpl

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Use glib memory functions in virThreadCreateFull
Tim Wiederhake [Fri, 11 Sep 2020 11:42:05 +0000 (13:42 +0200)] 
util: Use glib memory functions in virThreadCreateFull

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Use glib memory functions in virLogFilterNew
Tim Wiederhake [Fri, 11 Sep 2020 11:42:04 +0000 (13:42 +0200)] 
util: Use glib memory functions in virLogFilterNew

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Use glib memory functions in virSaveLastError
Tim Wiederhake [Fri, 11 Sep 2020 11:42:03 +0000 (13:42 +0200)] 
util: Use glib memory functions in virSaveLastError

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Use glib memory functions in virBitmapNewQuiet
Tim Wiederhake [Fri, 11 Sep 2020 11:42:00 +0000 (13:42 +0200)] 
util: Use glib memory functions in virBitmapNewQuiet

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agorpc: Use glib memory functions in virNetMessageSaveError
Tim Wiederhake [Fri, 11 Sep 2020 11:41:59 +0000 (13:41 +0200)] 
rpc: Use glib memory functions in virNetMessageSaveError

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agotests: Use glib memory functions in virpcimock.c
Tim Wiederhake [Fri, 11 Sep 2020 11:41:58 +0000 (13:41 +0200)] 
tests: Use glib memory functions in virpcimock.c

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu: Replace VIR_FREE with g_free
Tim Wiederhake [Fri, 11 Sep 2020 13:22:49 +0000 (15:22 +0200)] 
cpu: Replace VIR_FREE with g_free

Note the use of g_clear_pointer(..., g_free) in ppc64DataClear and virCPUx86Baseline.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu: Replace VIR_ALLOC_N with g_new0
Tim Wiederhake [Fri, 11 Sep 2020 13:22:48 +0000 (15:22 +0200)] 
cpu: Replace VIR_ALLOC_N with g_new0

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu: Replace VIR_ALLOC with g_new0
Tim Wiederhake [Fri, 11 Sep 2020 13:22:47 +0000 (15:22 +0200)] 
cpu: Replace VIR_ALLOC with g_new0

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Remove unnecessary variable in loadData
Tim Wiederhake [Fri, 11 Sep 2020 13:22:46 +0000 (15:22 +0200)] 
cpu_map: Remove unnecessary variable in loadData

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_x86: Use g_auto* in virX86CpuIncompatible
Tim Wiederhake [Fri, 11 Sep 2020 13:22:45 +0000 (15:22 +0200)] 
cpu_x86: Use g_auto* in virX86CpuIncompatible

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Use g_auto* in loadIncludes
Tim Wiederhake [Fri, 11 Sep 2020 13:22:44 +0000 (15:22 +0200)] 
cpu_map: Use g_auto* in loadIncludes

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Use g_auto* in loadData
Tim Wiederhake [Fri, 11 Sep 2020 13:22:43 +0000 (15:22 +0200)] 
cpu_map: Use g_auto* in loadData

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64: Use g_auto* in ppc64MakeCPUData
Tim Wiederhake [Fri, 11 Sep 2020 13:22:42 +0000 (15:22 +0200)] 
cpu_ppc64: Use g_auto* in ppc64MakeCPUData

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: qemuDomainPMSuspendAgent: Don't assign to 'ret' in a conditional
Erik Skultety [Fri, 11 Sep 2020 12:44:27 +0000 (14:44 +0200)] 
qemu: qemuDomainPMSuspendAgent: Don't assign to 'ret' in a conditional

When the guest agent isn't running, we still report success on a PM
suspend action even though we logged an error correctly, this is because
we poisoned the 'ret' value a few lines above.

Fixes: a663a860819287e041c3de672aad1d8543098ecc
Signed-off-by: Erik Skultety <eskultet@redhat.com>
4 years agovirnuma: Use numa_nodes_ptr when checking available NUMA nodes
Michal Privoznik [Fri, 11 Sep 2020 09:50:33 +0000 (11:50 +0200)] 
virnuma: Use numa_nodes_ptr when checking available NUMA nodes

In v6.7.0-rc1~86 I've tried to fix a problem where we were not
detecting NUMA nodes properly because we misused behaviour of a
libnuma API and as it turned out the behaviour was correct for
hosts with 64 CPUs in one NUMA node. So I changed the code to use
nodemask_isset(&numa_all_nodes, ..) instead and it fixed the
problem on such hosts. However, what I did not realize is that
numa_all_nodes does not reflect all NUMA nodes visible to
userspace, it contains only those nodes that the process
(libvirtd) an allocate memory from, which can be only a subset of
all NUMA nodes. The bitmask that contains all NUMA nodes visible
to userspace and which one I should have used is: numa_nodes_ptr.
For curious ones:

https://github.com/numactl/numactl/commit/4a22f2238234155e11e3e2717c011864722b767b

And as I was fixing virNumaGetNodeCPUs() I came to realize that
we already have a function that wraps the correct bitmask:
virNumaNodeIsAvailable().

Fixes: 24d7d85208f812a45686b32a0561cc9c5c9a49c9
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1876956
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirnuma: Assume numa_bitmask_isbitset() exists
Michal Privoznik [Fri, 11 Sep 2020 11:10:25 +0000 (13:10 +0200)] 
virnuma: Assume numa_bitmask_isbitset() exists

This function was introduced in the 2.0.6 release which happened
in December 2010. I think it is safe to assume that all libnuma
we deal with have the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agotools: virsh-domain: Remove redundant conditional before virshDomainFree
Yi Li [Fri, 11 Sep 2020 02:24:52 +0000 (10:24 +0800)] 
tools: virsh-domain: Remove redundant conditional before virshDomainFree

virshDomainFree handles NULL pointers gracefully, so there's no need to
check the pointer before the call.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoutil: remove unused virNetDevIPWaitDadFinish()
Laine Stump [Fri, 4 Sep 2020 17:53:18 +0000 (13:53 -0400)] 
util: remove unused virNetDevIPWaitDadFinish()

Since we no longer need to wait for IPv6 DAD to complete, we never
call this function.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonetwork: don't wait for IPv6 DAD completion when starting a network
Laine Stump [Fri, 4 Sep 2020 16:44:33 +0000 (12:44 -0400)] 
network: don't wait for IPv6 DAD completion when starting a network

0f7436ca54 added code during virtual network startup to wait for DAD
(Duplicate Address Detection) to complete if there were any IPv6
addresses on the network. This wait was needed because (according to
the commit log) "created problems when [the "dummy" tap device] is set
to IFF_DOWN prior to DAD completing".

That commit in turn referenced commit db488c7917, which had added the
code to set the dummy tap device IFF_DOWN, commenting "DAD has
happened (dnsmasq waits for it)", and in its commit message pointed
out that if we just got rid of the dummy tap device this wouldn't be
needed.

Now that the dummy tap device has indeed been removed (commit
ee6c936fbb), there is no longer any need to set it IFF_DOWN, and thus
nothing requiring us to wait for DAD to complete. At any rate, with
the dummy tap device removed, leaving nothing else on the bridge when
it is first started, DAD never completes, leading to failure to start
any IPv6 network.

So, yes, this patch removes the wait for DAD completion, and IPv6
networks can once again start, and their associated dnsmasq process
starts successfully (this is the problem that the DAD wait was
originally intended to fix)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: kbase: Tune how CPU support for SEV should be queried
Erik Skultety [Thu, 10 Sep 2020 13:15:48 +0000 (15:15 +0200)] 
docs: kbase: Tune how CPU support for SEV should be queried

 #useless_use_of_cat + avoid accidental substring matches.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoAdd FreeBSD 11.4 CI job on Cirrus
Daniel P. Berrangé [Fri, 4 Sep 2020 10:22:16 +0000 (11:22 +0100)] 
Add FreeBSD 11.4 CI job on Cirrus

The previous 11.3 image provided by Cirrus did not boot, but they have
now provided a working 11.4 image

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoFix linkage to libutil and libkvm on FreeBSD 11
Daniel P. Berrangé [Fri, 4 Sep 2020 11:52:13 +0000 (12:52 +0100)] 
Fix linkage to libutil and libkvm on FreeBSD 11

We are currently adding -lutil and -lkvm to the linker using the
add_project_link_arguments method. On FreeBSD 11.4, this results in
build errors because the args appear too early in the command line.

We need to pass the libraries as dependencies so that they get placed
at the same point in the linker args as other dependencies.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoFix a typo in hacking.rst: "contirbute" -> "contribute"
Matt Coleman [Tue, 8 Sep 2020 20:43:54 +0000 (16:43 -0400)] 
Fix a typo in hacking.rst: "contirbute" -> "contribute"

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoFix errors in contribute.html.in
Matt Coleman [Tue, 8 Sep 2020 20:43:53 +0000 (16:43 -0400)] 
Fix errors in contribute.html.in

* Add a period to the end of the page's introductory sentence.
* Correct a spelling error: "Evangalism"/"evangalise" -> "Evangelism"/"evangelize"

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoFix a typo in compiling.html.in: that -> from
Matt Coleman [Tue, 8 Sep 2020 20:43:52 +0000 (16:43 -0400)] 
Fix a typo in compiling.html.in: that -> from

The original author intended to write "different than".
"Different" is commonly followed by "from", "than", and "to".
Globally, "from" is the most common.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agoremote: fix error reporting for invalid daemon mode
Daniel P. Berrangé [Fri, 7 Aug 2020 17:39:22 +0000 (18:39 +0100)] 
remote: fix error reporting for invalid daemon mode

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: use new virt-ssh-helper binary for remote tunnelling
Daniel P. Berrangé [Wed, 8 Jul 2020 16:03:38 +0000 (17:03 +0100)] 
rpc: use new virt-ssh-helper binary for remote tunnelling

This wires up support for using the new virt-ssh-helper binary with the ssh,
libssh and libssh2 protocols.

The new binary will be used preferentially if it is available in $PATH,
otherwise we fall back to traditional netcat.

The "proxy" URI parameter can be used to force use of netcat e.g.

  qemu+ssh://host/system?proxy=netcat

or the disable fallback e.g.

  qemu+ssh://host/system?proxy=native

With use of virt-ssh-helper, we can now support remote session URIs

  qemu+ssh://host/session

and this will only use virt-ssh-helper, with no fallback. This also lets
the libvirtd process be auto-started, and connect directly to the
modular daemons, avoiding use of virtproxyd back-compat tunnelling.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: switch order of args in virNetClientNewSSH
Daniel P. Berrangé [Wed, 8 Jul 2020 12:05:38 +0000 (13:05 +0100)] 
rpc: switch order of args in virNetClientNewSSH

Switch keyfile and netcat parameters, since the netcat path and
socket path are a logical pair that belong together. This patches
the other constructors.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: introduce virt-ssh-helper binary
Daniel P. Berrangé [Mon, 8 Jul 2019 15:38:49 +0000 (16:38 +0100)] 
remote: introduce virt-ssh-helper binary

When accessing libvirtd over a SSH tunnel, the remote driver needs a way
to proxy the SSH input/output stream to a suitable libvirt daemon. This
is currently done by spawning netcat, pointing it to the libvirtd socket
path. This is problematic for a number of reasons:

 - The socket path varies according to the --prefix chosen at build
   time. The remote client is seeing the local prefix, but what we
   need is the remote prefix

 - The socket path varies according to remote env variables, such as
   the XDG_RUNTIME_DIR location. Again we see the local XDG_RUNTIME_DIR
   value, but what we need is the remote value (if any)

 - The remote driver doesn't know whether it must connect to the legacy
   libvirtd or the modular daemons, so must always assume legacy
   libvirtd for back-compat. This means we'll always end up using the
   virtproxyd daemon adding an extra hop in the RPC layer.

 - We can not able to autospawn the libvirtd daemon for session mode
   access

To address these problems this patch introduces the 'virtd-ssh-helper'
program which takes the URI for the remote driver as a CLI parameter.
It then figures out which daemon to connect to and its socket path,
using the same code that the remote driver client would on the remote
host's build of libvirt.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: extract logic for determining daemon to connect to
Daniel P. Berrangé [Mon, 8 Jul 2019 14:30:59 +0000 (15:30 +0100)] 
remote: extract logic for determining daemon to connect to

We'll shortly want to reuse code for determining whether to connect to
the system or session daemon from places outside the remote driver
client. Pulling it out into a self contained function facilitates reuse.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: split out function for constructing socket path
Daniel P. Berrangé [Wed, 4 Mar 2020 17:45:55 +0000 (17:45 +0000)] 
remote: split out function for constructing socket path

The remoteGetUNIXSocketHelper method will be needed by source files
beyond the remote driver client.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: parse the remote transport string earlier
Daniel P. Berrangé [Wed, 8 Jul 2020 17:02:50 +0000 (18:02 +0100)] 
remote: parse the remote transport string earlier

We delay converting the remote transport string to enum form until
fairly late. As a result we're doing string comparisons when we
could be just doing enum comparisons.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: split out function for parsing URI scheme
Daniel P. Berrangé [Wed, 4 Mar 2020 17:45:55 +0000 (17:45 +0000)] 
remote: split out function for parsing URI scheme

The remoteSplitURISCheme method will be needed by source files beyond
the remote driver client.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: split off enums into separate source file
Daniel P. Berrangé [Wed, 4 Mar 2020 17:39:48 +0000 (17:39 +0000)] 
remote: split off enums into separate source file

The remoteDriverTransport and remoteDriverMode enums are going to be
needed by source files beyond the remote driver client.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: push logic for default netcat binary into common helper
Daniel P. Berrangé [Tue, 21 Jul 2020 11:15:57 +0000 (12:15 +0100)] 
remote: push logic for default netcat binary into common helper

We don't want to repeat the choice of default netcat binary setting in
three different places. This will also make it possible to do better
error reporting in the helper.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpc: merge logic for generating remote SSH shell script
Daniel P. Berrangé [Tue, 11 Feb 2020 19:05:53 +0000 (19:05 +0000)] 
rpc: merge logic for generating remote SSH shell script

Three parts of the code all build up the same SSH shell script
snippet for remote tunneling the RPC protocol, but in slightly
different ways. Combine them all into one helper method in the
virNetClient code, since this logic doesn't really belong in
the virNetSocket code.

Note that the this change means the shell snippet is passed to
the SSH binary as a single arg, instead of three separate args,
but this is functionally identical, as the three separate args
were combined into one already when passed to the remote system.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodisk storage: fix allocation size for pool format dos
Sebastian Mitterle [Sat, 29 Aug 2020 00:49:07 +0000 (00:49 +0000)] 
disk storage: fix allocation size for pool format dos

The changed condition was always false because the function was always
called with boundary values 0.

Use the free extent's start value to get its start offset from the
cylinder boundary and determine if the needed size for allocation
needs to be expanded too in case the offset doesn't fit within extra
bytes for alignment.

This fixes an issue where vol-create-from will call qemu-img convert
to create a destination volume of same capacity as the source volume
and qemu-img will error 'Cannot grow device files' due to the partition
being too small for the source although both destination partition and
source volume have the same capacity.

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodoc: add some examples for IPv6 NAT configuration
Ian Wienand [Wed, 12 Aug 2020 01:21:47 +0000 (11:21 +1000)] 
doc: add some examples for IPv6 NAT configuration

Add some expanded examples for the nat ipv6 introduced with
927acaedec7effbe67a154d8bfa0e67f7d08e6c7.

Unfortunately while for IPv4 it's well-known what addresses ranges are
useful for NAT, with IPv6 unless you enjoy digging through RFC's going
back-and-forth over unique local addresses and the meaning of the word
"site" it's generally much less obvious.  I've tried to add some
details on choosing a range inline with RFC 4193 and then some
pointers for when it maybe doesn't work in the guest as you first
expect despite you doing what the RFC's say!

Signed-off-by: Ian Wienand <iwienand@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoclient: fix memory leak in client msg
Hao Wang [Sat, 18 Jul 2020 07:43:30 +0000 (15:43 +0800)] 
client: fix memory leak in client msg

When closing client->waitDispatch in virNetClientIOEventLoopRemoveAll
or virNetClientIOEventLoopRemoveDone, VIR_FREE() is called to free
call->msg directly, resulting in leak of the memory call->msg->buffer
points to.
Use virNetMessageFree(call->msg) instead of VIR_FREE(call->msg).

Signed-off-by: Hao Wang <wanghao232@huawei.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuFirmwareFillDomain: Fill NVRAM template on migration too
Michal Privoznik [Tue, 8 Sep 2020 15:42:09 +0000 (17:42 +0200)] 
qemuFirmwareFillDomain: Fill NVRAM template on migration too

In 8e1804f9f66 I've tried to fix the following use case: domain
is started with path to UEFI only and relies on libvirt to figure
out corresponding NVRAM template to create a per-domain copy
from. The fix consisted of having a check tailored exactly for
this use case and if it's hit then using FW autoselection to
figure it out. Unfortunately, the NVRAM template is not saved in
the inactive XML (well, the domain might be transient anyway).
Then, as a part of that check we see whether the per-domain copy
doesn't exist already and if it does then no template is looked
up hence no template will appear in the live XML.

This works, until the domain is migrated. At the destination, the
per-domain copy will not exist so we need to know the template to
create the per-domain copy from. But we don't even get to the
check because we are not starting a fresh new domain and thus the
qemuFirmwareFillDomain() function quits early.

The solution is to switch order of these two checks. That is
evaluate the check for the old style before checking flags.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852910
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agovirsh: cmdScreenshot: fix cbdata passing to virshStreamSink
Ján Tomko [Wed, 9 Sep 2020 08:55:40 +0000 (10:55 +0200)] 
virsh: cmdScreenshot: fix cbdata passing to virshStreamSink

The changes for sparse stream support started passing
virshStreamCallbackDataPtr to virshStreamSink
instead of passing a simple file descriptor, but
forgot to adjust all the callers.

Fix it in cmdScreenshot as well.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 9e745a97171e10f050962c166082439d6724e245
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agocpu_ppc64: Remove error path in virCPUppc64DriverGetModels
Tim Wiederhake [Wed, 9 Sep 2020 06:37:51 +0000 (08:37 +0200)] 
cpu_ppc64: Remove error path in virCPUppc64DriverGetModels

The call to `g_strfreev` is not required, as in both cases no memory has been allocated.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Use g_auto* in loadData
Tim Wiederhake [Wed, 9 Sep 2020 06:37:50 +0000 (08:37 +0200)] 
cpu_map: Use g_auto* in loadData

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use g_autoptr() whenever possible
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:46 +0000 (17:25 -0300)] 
cpu_ppc64.c: use g_autoptr() whenever possible

Using g_autoptr() in virCPUDef pointers allows for more
cleanups in ppc64Compute() and virCPUppc64Baseline()

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use g_autofree() whenever possible
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:45 +0000 (17:25 -0300)] 
cpu_ppc64.c: use g_autofree() whenever possible

This allows for a label removal in ppc64ModelParse().

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use g_autoptr() in virCPUppc64GetHost()
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:44 +0000 (17:25 -0300)] 
cpu_ppc64.c: use g_autoptr() in virCPUppc64GetHost()

We don't need to call virCPUppc64DataFree() in a cleanup label.
This function is already assigned to the 'dataFree' interface
of cpuDriverPPC64, and it will be called by virCPUDataFree(), the
autocleanup function of virCPUDataPtr, via driver->dataFree.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use g_autoptr() with virCPUppc64MapPtr
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:43 +0000 (17:25 -0300)] 
cpu_ppc64.c: use g_autoptr() with virCPUppc64MapPtr

Use autocleanup with virCPUppc64MapPtr to simplify existing
code. Remove labels when possible.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64MapPtr
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:42 +0000 (17:25 -0300)] 
cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64MapPtr

Next patch will use g_autoptr() in virCPUppc64MapPtr pointers
for some cleanups.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use typedefs for 'struct ppc64_map'
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:41 +0000 (17:25 -0300)] 
cpu_ppc64.c: use typedefs for 'struct ppc64_map'

Introduce virCPUppc64Map and virCPUppc64MapPtr types to
improve code readability.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use g_autoptr() with virCPUppc64ModelPtr
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:40 +0000 (17:25 -0300)] 
cpu_ppc64.c: use g_autoptr() with virCPUppc64ModelPtr

Use autocleanup with virCPUppc64ModelPtr to simplify existing
code. Remove the 'error' label in ppc64ModelCopy() since it is
now obsolete.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64ModelPtr
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:39 +0000 (17:25 -0300)] 
cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64ModelPtr

Next patch will use g_autoptr() in virCPUppc64ModelPtr pointers
for some cleanups.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use typedefs for 'struct ppc64_model'
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:38 +0000 (17:25 -0300)] 
cpu_ppc64.c: use typedefs for 'struct ppc64_model'

Introduce virCPUppc64Model and virCPUppc64ModelPtr types to
improve code readability.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: modernize ppc64VendorParse()
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:37 +0000 (17:25 -0300)] 
cpu_ppc64.c: modernize ppc64VendorParse()

Use g_autoptr() in virCPUppc64VendorPtr and remove the now
uneeded 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64VendorPtr
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:36 +0000 (17:25 -0300)] 
cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64VendorPtr

Next patch will use g_autoptr() in virCPUppc64VendorPtr pointers
for some cleanups.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_ppc64.c: use typedefs for 'struct ppc64_vendor'
Daniel Henrique Barboza [Wed, 2 Sep 2020 20:25:35 +0000 (17:25 -0300)] 
cpu_ppc64.c: use typedefs for 'struct ppc64_vendor'

Introduce virCPUppc64Vendor and virCPUppc64VendorPtr types to
improve code readability.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoTranslated using Weblate (Indonesian)
Andika Triwidada [Mon, 7 Sep 2020 08:50:01 +0000 (10:50 +0200)] 
Translated using Weblate (Indonesian)

Currently translated at 2.0% (209 of 10366 strings)

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

Co-authored-by: Andika Triwidada <andika@gmail.com>
Signed-off-by: Andika Triwidada <andika@gmail.com>
4 years agocpu: Use g_auto* in virCPUGetHost
Tim Wiederhake [Mon, 7 Sep 2020 14:58:56 +0000 (16:58 +0200)] 
cpu: Use g_auto* in virCPUGetHost

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu: Use g_auto* in virCPUCompareXML
Tim Wiederhake [Mon, 7 Sep 2020 14:58:55 +0000 (16:58 +0200)] 
cpu: Use g_auto* in virCPUCompareXML

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Use g_auto* in loadIncludes
Tim Wiederhake [Mon, 7 Sep 2020 14:58:54 +0000 (16:58 +0200)] 
cpu_map: Use g_auto* in loadIncludes

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agocpu_map: Use g_auto* in cpuMapLoadInclude
Tim Wiederhake [Mon, 7 Sep 2020 14:58:53 +0000 (16:58 +0200)] 
cpu_map: Use g_auto* in cpuMapLoadInclude

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agosrc/storage/meson: fix vir_storage_file_gluster module dependencies
Pavel Hrdina [Tue, 8 Sep 2020 13:45:11 +0000 (15:45 +0200)] 
src/storage/meson: fix vir_storage_file_gluster module dependencies

The correct key for dependencies for virt_modules hash is `deps`.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agocheck for NULL before calling g_regex_unref
Ján Tomko [Tue, 8 Sep 2020 12:57:14 +0000 (14:57 +0200)] 
check for NULL before calling g_regex_unref

g_regex_unref reports an error if called with a NULL argument.

We have two cases in the code where we (possibly) call it on a NULL
argument. The interesting one is in virDomainQemuMonitorEventCleanup.

Based on VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX, we unref
data->regex, which has two problems:

* On the client side, flags is -1 so the comparison is true even if no
  regex was used, reproducible by:
  $ virsh qemu-monitor-event --timeout 1
  which results in an ugly error:
(process:1289846): GLib-CRITICAL **: 14:58:42.631: g_regex_unref: assertion 'regex != NULL' failed
* On the server side, we only create the regex if both the flag and the
  string are present, so it's possible to trigger this message by:
  $ virsh qemu-monitor-event --regex --timeout 1

Use a non-NULL comparison instead of the flag to decide whether we need
to unref the regex. And add a non-NULL check to the unref in the
VirtualBox test too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 71efb59a4de7c51b1bc889a316f1796ebf55738f
https://bugzilla.redhat.com/show_bug.cgi?id=1876907
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs: Discourage users from using fwcfg
Michal Privoznik [Mon, 7 Sep 2020 13:42:46 +0000 (15:42 +0200)] 
docs: Discourage users from using fwcfg

Even though this was brought up in upstream discussion [1] it
missed my patches: users should prefer <oemStrings/> over fwcfg.
The reason is that fwcfg is considered somewhat internal to QEMU
and it has limited number of slots and neither of these applies
to <oemStrings/>.

While I'm at it, I'm fixing the example too (because it contains
incorrect element name) and clarifying sysfs/ exposure.

1: https://www.redhat.com/archives/libvir-list/2020-May/msg00957.html

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agodocs: Rephrase the video 'none' type to clarify the reasoning
Erik Skultety [Tue, 8 Sep 2020 09:55:27 +0000 (11:55 +0200)] 
docs: Rephrase the video 'none' type to clarify the reasoning

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agorpm: Remove pointless explicit dependency on 'readline'
Neal Gompa [Mon, 7 Sep 2020 18:59:39 +0000 (14:59 -0400)] 
rpm: Remove pointless explicit dependency on 'readline'

The 'readline' package only contains the library, which rpm is
already generating the (stricter) correct dependency for.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirnuma: Report error when NUMA -> CPUs translation fails
Michal Privoznik [Mon, 7 Sep 2020 15:02:08 +0000 (17:02 +0200)] 
virnuma: Report error when NUMA -> CPUs translation fails

When starting a domain with <numatune/> set libvirt translates
given NUMA nodes into a set of host CPUs which is then used to
QEMU process affinity. But, if the numatune contains a
non-existent NUMA node then the translation fails with no error
reported. This is because virNumaNodesetToCPUset() calls
virNumaGetNodeCPUs() and expects it to report an error on
failure. Well, it does except for non-existent NUMA nodes. While
this behaviour might look strange it is actually desired because
of how we construct host capabilities. The virNumaGetNodeCPUs()
is called from virCapabilitiesHostNUMAInitReal() where we do not
want any error reported for non-existent NUMA nodes.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1724866
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
4 years agowireshark: Prefer ws_version.h over config.h
Michal Privoznik [Mon, 7 Sep 2020 15:50:24 +0000 (17:50 +0200)] 
wireshark: Prefer ws_version.h over config.h

A wireshark plugin must declare what major and minor version it
was built with as these are checked when wireshark loads plugins.
On the top of that, we use major + minor + micro to adapt to
changed API between releases. So far, we were getting these
version numbers from wireshark/config.h.

And while most distributions install wireshark/config.h file some
don't. On distros shipping it it's hack^Wsaved during built by
packaging system and installed later. But some distros are not
doing that. At least not for new enough wireshark because as of
wireshark's commit v2.9.0~1273 the ws_version.h is installed
which contains the version macros we need and is installed by
wireshark itself.

But of course, some distros which have new enough wireshark
packaged do not ship ws_version.h and stick to the hack. That is
why we can't simply bump the minimal version and switch to the
new header file. We need a configure check and adopt our code to
deal with both ways. At least for the time being.

Based on Andrea's original patch:

https://www.redhat.com/archives/libvir-list/2020-September/msg00156.html

Closes: https://gitlab.com/libvirt/libvirt/-/issues/74
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu_process: Separate VIR_PERF_EVENT_* setting into a function
Michal Privoznik [Mon, 7 Sep 2020 14:44:50 +0000 (16:44 +0200)] 
qemu_process: Separate VIR_PERF_EVENT_* setting into a function

When starting a domain, qemuProcessLaunch() iterates over all
VIR_PERF_EVENT_* values and (possibly) enables them. While there
is nothing wrong with the code, the for loop where it's done makes
it harder to jump onto next block of code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemuBlockStorageSourceCreateDetectSize: Propagate cluster size for 'qcow2'
Peter Krempa [Wed, 26 Aug 2020 14:45:51 +0000 (16:45 +0200)] 
qemuBlockStorageSourceCreateDetectSize: Propagate cluster size for 'qcow2'

Propagate the cluster size from the original image as the user might
have configured a custom cluster size for performance reasons. Propagate
the cluster size of a qcow2 image to the new overlay or copy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: block: Allow specifying cluster size when using 'blockdev-create'
Peter Krempa [Wed, 26 Aug 2020 14:43:29 +0000 (16:43 +0200)] 
qemu: block: Allow specifying cluster size when using 'blockdev-create'

'blockdev-create' allows us to create the image with a custom cluster
size if we wish to. Wire it up for 'qcow2'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqemu: monitor: Detect image cluster size from 'query-named-block-nodes'
Peter Krempa [Wed, 26 Aug 2020 14:41:17 +0000 (16:41 +0200)] 
qemu: monitor: Detect image cluster size from 'query-named-block-nodes'

Configuring the cluster size of an image may have performance
implications. This patch allows us to detect cluster size for existing
images so that we will be able to propagate it to new images which are
based on existing images e.g. during snapshots/block-copy/etc.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoRevert "news: qemu: Support TLS for NBD connections for pull mode backup"
Peter Krempa [Mon, 7 Sep 2020 14:42:59 +0000 (16:42 +0200)] 
Revert "news: qemu: Support TLS for NBD connections for pull mode backup"

Incremental backups are not enabled. There's no point documenting
individual patches implementing an incomplete feature.

This reverts commit e6285f84faeacccdef12b69a7bc38975230d6662

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agoqemu_namespace: Don't leak mknod items that are being skipped over
Michal Privoznik [Mon, 7 Sep 2020 11:35:50 +0000 (13:35 +0200)] 
qemu_namespace: Don't leak mknod items that are being skipped over

When building and populating domain NS a couple of functions are
called that append paths to a string list. This string list is
then inspected, one item at the time by
qemuNamespacePrepareOneItem() which gathers all the info for
given path (stat buffer, possible link target, ACLs, SELinux
label) using qemuNamespaceMknodItemInit(). If the path needs to
be created in the domain's private /dev then it's added onto this
qemuNamespaceMknodData list which is freed later in the process.
But, if the path does not need to be created in the domain's
private /dev, then the memory allocated by
qemuNamespaceMknodItemInit() is not freed anywhere leading to a
leak.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Allow setting affinity to fail and don't report error
Martin Kletzander [Mon, 7 Sep 2020 11:00:28 +0000 (13:00 +0200)] 
qemu: Allow setting affinity to fail and don't report error

This is just a clean-up of commit 3791f29b085c using the new parameter of
virProcessSetAffinity() introduced in commit 9514e24984ee so that there is
no error reported in the logs.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoDo not report error when setting affinity is allowed to fail
Martin Kletzander [Sat, 5 Sep 2020 05:53:58 +0000 (07:53 +0200)] 
Do not report error when setting affinity is allowed to fail

Suggested-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: migration: remove unused variable
Ján Tomko [Mon, 7 Sep 2020 09:03:38 +0000 (11:03 +0200)] 
qemu: migration: remove unused variable

../src/qemu/qemu_migration.c:4091:36: error: unused variable 'cfg' [-Werror,-Wunused-variable]
    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: d92c2bbc6597fcb951b303a9122ec1ca71514d10
4 years agolib: Prefer g_autoptr() declaration of virQEMUDriverConfigPtr
Michal Privoznik [Fri, 4 Sep 2020 06:59:08 +0000 (08:59 +0200)] 
lib: Prefer g_autoptr() declaration of virQEMUDriverConfigPtr

In the past we had to declare @cfg and then explicitly unref it.
But now, with glib we can use g_autoptr() which will do the unref
automatically and thus is more bulletproof.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu_interface: Fix @cfg refcounting in qemuInterfacePrepareSlirp()
Michal Privoznik [Fri, 4 Sep 2020 06:55:39 +0000 (08:55 +0200)] 
qemu_interface: Fix @cfg refcounting in qemuInterfacePrepareSlirp()

In the qemuInterfacePrepareSlirp() function, the qemu driver
config is obtained (via virQEMUDriverGetConfig()), but it is
never unrefed leading to mangled refcounter.

Fixes: 9145b3f1cc334e946b3f9ea45d6c24c868301e6f
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoutil: remove unused virThreadPoolNew macro
Nikolay Shirokovskiy [Thu, 9 Jul 2020 08:13:44 +0000 (11:13 +0300)] 
util: remove unused virThreadPoolNew macro

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agorpc: cleanup virNetDaemonClose method
Nikolay Shirokovskiy [Thu, 9 Jul 2020 08:13:12 +0000 (11:13 +0300)] 
rpc: cleanup virNetDaemonClose method

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: implement driver's shutdown/shutdown wait methods
Nikolay Shirokovskiy [Thu, 9 Jul 2020 08:12:26 +0000 (11:12 +0300)] 
qemu: implement driver's shutdown/shutdown wait methods

On shutdown we just stop accepting new jobs for worker thread so that on
shutdown wait we can exit worker thread faster. Yes we basically stop
processing of events for VMs but we are going to do so anyway in case of daemon
shutdown.

At the same time synchronous event processing that some API calls may require
are still possible as per VM event loop is still running and we don't need
worker thread for synchronous event processing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: avoid deadlock in qemuDomainObjStopWorker
Nikolay Shirokovskiy [Thu, 23 Jul 2020 08:02:59 +0000 (11:02 +0300)] 
qemu: avoid deadlock in qemuDomainObjStopWorker

We are dropping the only reference here so that the event loop thread
is going to be exited synchronously. In order to avoid deadlocks we
need to unlock the VM so that any handler being called can finish
execution and thus even loop thread be finished too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>