]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agoutil: iscsi: use two vars in CreateIfaceIQN
Ján Tomko [Fri, 10 Dec 2021 16:25:04 +0000 (17:25 +0100)]
util: iscsi: use two vars in CreateIfaceIQN

Do not mix automatic and manual cleanup.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: dnsmasq: refactor CapsRefresh
Ján Tomko [Fri, 10 Dec 2021 16:21:27 +0000 (17:21 +0100)]
util: dnsmasq: refactor CapsRefresh

Use two variables with automatic cleanup instead of reusing one.

Remove the pointless cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: use g_auto in virCommand example
Ján Tomko [Mon, 13 Dec 2021 18:47:25 +0000 (19:47 +0100)]
docs: use g_auto in virCommand example

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: storagevolxml2argvtest: do not reuse cmd
Ján Tomko [Mon, 13 Dec 2021 18:31:11 +0000 (19:31 +0100)]
tests: storagevolxml2argvtest: do not reuse cmd

Reduce the scope of the variable to avoid mixing automatic and manual
cleanup.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: use g_auto in testCompareXMLToConfFiles
Ján Tomko [Mon, 13 Dec 2021 18:30:23 +0000 (19:30 +0100)]
tests: use g_auto in testCompareXMLToConfFiles

Use g_auto for dnsmasq context and remove the cmd variable.
It was unused since its introduction in:
commit 8b32c80df089a3612a0448c1a92abc2071d6b6a9

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovmware: refactor vmwareExtractVersion
Ján Tomko [Mon, 13 Dec 2021 17:33:11 +0000 (18:33 +0100)]
vmware: refactor vmwareExtractVersion

Use g_auto for cleanup and remove the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovmware: use g_auto in vmwareLoadDomains
Ján Tomko [Mon, 13 Dec 2021 17:32:53 +0000 (18:32 +0100)]
vmware: use g_auto in vmwareLoadDomains

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovmware: refactor vmwareUpdateVMStatus
Ján Tomko [Mon, 13 Dec 2021 17:14:05 +0000 (18:14 +0100)]
vmware: refactor vmwareUpdateVMStatus

Use g_auto and get rid of the cleanup label, as well as the ret
variable.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovz: utils: use g_auto for virCommand
Ján Tomko [Mon, 13 Dec 2021 15:25:43 +0000 (16:25 +0100)]
vz: utils: use g_auto for virCommand

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzVEGetStringParam
Ján Tomko [Mon, 13 Dec 2021 18:28:27 +0000 (19:28 +0100)]
openvz: refactor openvzVEGetStringParam

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: use g_auto in openvzDomainMigratePerform3Params
Ján Tomko [Mon, 13 Dec 2021 18:27:02 +0000 (19:27 +0100)]
openvz: use g_auto in openvzDomainMigratePerform3Params

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzGetVEStatus
Ján Tomko [Mon, 13 Dec 2021 18:26:06 +0000 (19:26 +0100)]
openvz: refactor openvzGetVEStatus

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzDomainSetBarrierLimit
Ján Tomko [Mon, 13 Dec 2021 18:24:34 +0000 (19:24 +0100)]
openvz: refactor openvzDomainSetBarrierLimit

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzDomainGetBarrierLimit
Ján Tomko [Mon, 13 Dec 2021 18:24:07 +0000 (19:24 +0100)]
openvz: refactor openvzDomainGetBarrierLimit

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzConnectListDefinedDomains
Ján Tomko [Mon, 13 Dec 2021 18:22:28 +0000 (19:22 +0100)]
openvz: refactor openvzConnectListDefinedDomains

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzConnectListDomains
Ján Tomko [Mon, 13 Dec 2021 18:13:24 +0000 (19:13 +0100)]
openvz: refactor openvzConnectListDomains

Use g_auto where possible, reduce scope of some variables and remove
pointless ret and rc variables.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzDomainSetNetwork
Ján Tomko [Mon, 13 Dec 2021 18:08:49 +0000 (19:08 +0100)]
openvz: refactor openvzDomainSetNetwork

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzSetDiskQuota
Ján Tomko [Mon, 13 Dec 2021 18:06:11 +0000 (19:06 +0100)]
openvz: refactor openvzSetDiskQuota

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzSetInitialConfig
Ján Tomko [Mon, 13 Dec 2021 18:00:53 +0000 (19:00 +0100)]
openvz: refactor openvzSetInitialConfig

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzDomainDefineCmd
Ján Tomko [Fri, 10 Dec 2021 16:11:07 +0000 (17:11 +0100)]
openvz: refactor openvzDomainDefineCmd

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzGetVEID
Ján Tomko [Mon, 13 Dec 2021 17:47:47 +0000 (18:47 +0100)]
openvz: refactor openvzGetVEID

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzLoadDomains
Ján Tomko [Mon, 13 Dec 2021 17:46:43 +0000 (18:46 +0100)]
openvz: refactor openvzLoadDomains

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoopenvz: refactor openvzExtractVersionInfo
Ján Tomko [Mon, 13 Dec 2021 17:39:29 +0000 (18:39 +0100)]
openvz: refactor openvzExtractVersionInfo

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: Generate command line for dirty-ring-size
Hyman Huang(黄勇) [Tue, 23 Nov 2021 14:36:59 +0000 (09:36 -0500)]
qemu: Generate command line for dirty-ring-size

On QEMU command line it's represented by the dirty-ring-size
attribute of KVM accelerator.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: support dirty ring feature
Hyman Huang(黄勇) [Tue, 23 Nov 2021 14:36:58 +0000 (09:36 -0500)]
qemu: support dirty ring feature

Dirty ring feature was introduced in qemu-6.1.0, this patch
add the corresponding feature named 'dirty-ring', which enable
dirty ring feature when starting VM.

To enable the feature, the following XML needs to be added to
the guest's domain description:

<features>
   <kvm>
     <dirty-ring state='on' size='xxx'>
   </kvm>
</features>

If property "state=on", property "size" must be specified, which
should be power of 2 and range in [1024, 65526].

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: Turn virDomainDef.kvm_features into a struct
Michal Privoznik [Tue, 14 Dec 2021 09:24:30 +0000 (10:24 +0100)]
conf: Turn virDomainDef.kvm_features into a struct

In future commits we will need to store not just an array of
VIR_TRISTATE_SWITCH_* but also an additional integer. Follow the
example of TCG and introduce a structure where both the array an
integer can live.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoexamples: hellolibvirt: fix argc check
Ján Tomko [Tue, 14 Dec 2021 10:59:43 +0000 (11:59 +0100)]
examples: hellolibvirt: fix argc check

https://gitlab.com/libvirt/libvirt/-/issues/255

Reported-by: Jeremy Alcim
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: remove virFirewallOnceInit()
Laine Stump [Wed, 17 Nov 2021 18:20:53 +0000 (13:20 -0500)]
util: remove virFirewallOnceInit()

There is no longer anything to initialize at binary startup time.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: remove currentBackend from virfirewall.c
Laine Stump [Tue, 16 Nov 2021 19:27:00 +0000 (14:27 -0500)]
util: remove currentBackend from virfirewall.c

Since the currentBackend (direct vs. firewalld) setting is no longer
used for anything, we don't need to set it (either explicitly from
tests, or implicitly during init), and can completely remove it.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: remove check for iptables binary during virFirewallInit
Laine Stump [Tue, 16 Nov 2021 19:12:05 +0000 (14:12 -0500)]
util: remove check for iptables binary during virFirewallInit

It's unclear exactly why this check exists; possibly a parallel to a
long-removed check for the firewall-cmd binary (added to viriptables.c
with the initial support for firewalld in commit bf156385a03 in 2012,
and long since removed), or possibly because virFirewallOnceInit() was
intended to be called at daemon startup, and it seemed like a good
idea to just log this error once when trying to determine whether to
use firewalld, or direct iptables commands, and then not waste time
building commands that could never be executed. The odd thing is that
it would sometimes result in logging an error when it couldn't find a
binary that wasn't needed anyway (e.g., if all the rules were iptables
rules, but ebtables and/or ip6tables weren't also installed).

If we just remove this check, then virCommandRun() will end up logging
an error and failing if the needed binary isn't found when we try to
execute it, which seems like it should just as good (or at least good
enough, especially since we eventually want to get rid of iptables
completely).

So let's remove it!

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: move and rename virFirewallBackendSynchronize()
Laine Stump [Wed, 17 Nov 2021 21:58:40 +0000 (16:58 -0500)]
util: move and rename virFirewallBackendSynchronize()

This function doesn't have anything to do with manipulating
virFirewall objects, but rather should be called in response to dbus
events about the firewalld service. Move this function into
virfirewalld.c, and rename it to virFirewallDSynchronize().

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: simplify virFirewallBackendSynchronize()
Laine Stump [Tue, 16 Nov 2021 19:05:26 +0000 (14:05 -0500)]
util: simplify virFirewallBackendSynchronize()

This function doesn't need to check for a backend - synchronization
with firewalld should always be done whenever firewalld is registered
and available, not just when the firewalld backend is selected.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: eliminate pointless switch in virFirewallApplyRule
Laine Stump [Tue, 16 Nov 2021 17:19:18 +0000 (12:19 -0500)]
util: eliminate pointless switch in virFirewallApplyRule

Since commit b19863640 both useful cases of the switch statement in
this function have made the same call (and the other/default case is
just an error that can never happen). Eliminate the switch to help
eliminate use of currentBackend.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: document why virgdbus must be mocked in networkxml2firewalltest.c
Laine Stump [Mon, 15 Nov 2021 18:28:12 +0000 (13:28 -0500)]
tests: document why virgdbus must be mocked in networkxml2firewalltest.c

It isn't intuitive (to me) that a test just converting xml text into
iptables commands should need to call dbus, so rather than forcing the
next person to look through the commit logs and/or run the test under
gdb to understand why this is needed, just add a short comment in the
source.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: remove unnecessary ret variables and cleanup labels
Laine Stump [Mon, 15 Nov 2021 01:05:32 +0000 (20:05 -0500)]
tests: remove unnecessary ret variables and cleanup labels

Several functions were simplified to remove the only cleanup code at
the cleanup label, making it unnecessary.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: remove firewalld backend tests from virfirewalltest.c
Laine Stump [Sun, 14 Nov 2021 20:50:26 +0000 (15:50 -0500)]
tests: remove firewalld backend tests from virfirewalltest.c

When libvirt added support for firewalld, all iptables/ebtables rules
were added via the firewalld "passthrough" API when firewalld was
enabled (the "firewalld backend"), or run directly by libvirt when
firewalld was disabled (the so-called "direct
backend"). virfirewalltest.c dutifully ran each test twice, once with
the each backend enabled.

But commit b19863640d changed the code to *always* directly run
iptables/ebtables commands, and never use the firewalld passthrough
API, effectively making the direct and firewalld backends identical,
except that when libvirt receives notice that firewalld has restarted
or reloaded its rules, the firewalld backend sends an extra "iptables
-V" command via firewalld's passthrough API (and waits for a response)
prior to running all the rest of the iptables commands directly; this
assures that a newly-restarted firewalld has finished its work on the
filter tables before libvirt starts messing with it. (Because this
code is only executed in response to an event from dbus, it isn't
tested in the unit tests).

In spite of this, we still go through all the virfirewall tests twice
though - once for the direct backend, and once for the firewalld
backend, even though these take the same codepath.

In commit b19863640d I had left this double-testing in thinking that
someday we might go back to actually doing something useful with the
firewalld backend in the course of adding support for native nftables,
but I've now realized that for the case of nftables we will be *even
more* divorced from firewalld, so there is really no point in keeping
this code around any longer. (It's likely/probable that the tests will
be done twice again in the future, but it will be enough different
that it is better to remove this code and re-implement from scratch
when adding the nftables backend, rather than trying to directly
modify the existing code and end up with something even more
confusing).

This patch eliminates all the test duplication in virfirewalltest.c,
including mocking dbus, which is unnecessary since none of the tests
use dbus (for now we ensure that by explicitly setting the virfirewall
backend to DIRECT before any of the tests have run. Eventually the
concept of a "firewalld backend" will disappear completely, but that's
for another patch.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: rename iptables operators to something less generic
Laine Stump [Tue, 9 Nov 2021 20:18:42 +0000 (15:18 -0500)]
util: rename iptables operators to something less generic

Rather than calling these "ADD" and "REMOVE", which could be confused
with some other random items with the same names, make them more
specific by prepending "VIR_NETFILTER_" (because they will also be
used by the nftables backend) and rename them to match the
iptables/nftables operators they signify, i.e. INSERT and DELETE, just
to eliminate confusion (in particular, in case someone ever decides
that we need to also use the nftables "add" operator, which appends a
rule to a chain rather than inserting it at the beginning of the
chain).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: rename/move iptablesFormatNetwork to virSocketAddrFormatWithPrefix
Laine Stump [Sun, 14 Nov 2021 18:09:47 +0000 (13:09 -0500)]
util: rename/move iptablesFormatNetwork to virSocketAddrFormatWithPrefix

This function formats an address + prefix as, e.g. 192.168.122.0/24,
which is useful in places other than iptables. Move it to
virsocketaddr.c and make it public so that others can use it. While
moving, the bit that masks off the host bits of the address is made
optional, so that the function is more generally useful.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonetwork: eliminate code that uses default iptables chains
Laine Stump [Mon, 8 Nov 2021 17:15:29 +0000 (12:15 -0500)]
network: eliminate code that uses default iptables chains

The network driver has put all its rules into private chains (created
by libvirt) since commit 7431b3eb9a, which was included in
libvirt-5.1.0. When the conversion was made, code was included that
would attempt to delete existing rules in the default chains, to make
it possible to upgrade libvirt without restarting the host OS.

Almost 3 years has passed, and it is doubtful that anyone will be
attempting to upgrade directly from a pre-5.1.0 libvirt to something
as new as 8.0.0 (possibly with the exception of upgrading the entire
OS to a new release, which would include also rebooting), so it is now
safe to remove this code.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: use automatic cleanup for virCommand
Ján Tomko [Mon, 13 Dec 2021 13:06:20 +0000 (14:06 +0100)]
qemu: use automatic cleanup for virCommand

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosecurity: apparmor: use automatic cleanup in load_profile
Ján Tomko [Mon, 13 Dec 2021 13:06:17 +0000 (14:06 +0100)]
security: apparmor: use automatic cleanup in load_profile

Use g_auto for virCommand and char * and drop the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agostorage: util: steal cmd in CreateQemuImgCmdFromVol
Ján Tomko [Fri, 10 Dec 2021 16:19:18 +0000 (17:19 +0100)]
storage: util: steal cmd in CreateQemuImgCmdFromVol

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agostorage: logical: use two cmd vars in GetPoolSources
Ján Tomko [Fri, 10 Dec 2021 16:17:13 +0000 (17:17 +0100)]
storage: logical: use two cmd vars in GetPoolSources

Do not mix manual and automatic freeing.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: use g_auto for virCommand in virLXCProcessEnsureRootFS
Ján Tomko [Mon, 13 Dec 2021 13:04:47 +0000 (14:04 +0100)]
lxc: use g_auto for virCommand in virLXCProcessEnsureRootFS

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: refactor virLXCProcessBuildControllerCmd
Ján Tomko [Fri, 10 Dec 2021 13:49:23 +0000 (14:49 +0100)]
lxc: refactor virLXCProcessBuildControllerCmd

Use automatic cleanup and remove the labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: use g_auto in lxcContainerChild
Ján Tomko [Fri, 10 Dec 2021 17:33:06 +0000 (18:33 +0100)]
lxc: use g_auto in lxcContainerChild

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: refactor virBhyveProcessBuildBhyveCmd
Ján Tomko [Fri, 10 Dec 2021 13:44:48 +0000 (14:44 +0100)]
bhyve: refactor virBhyveProcessBuildBhyveCmd

Use automatic cleanup for virCommand, steal it on success
and remove the error label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: use g_auto in virBhyveProcessStop
Ján Tomko [Fri, 10 Dec 2021 17:31:03 +0000 (18:31 +0100)]
bhyve: use g_auto in virBhyveProcessStop

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: use g_auto in virBhyveProcessStartImpl
Ján Tomko [Fri, 10 Dec 2021 17:29:18 +0000 (18:29 +0100)]
bhyve: use g_auto in virBhyveProcessStartImpl

Use g_auto and VIR_AUTOCLOSE where possible.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: refactor bhyveConnectDomainXMLToNative
Ján Tomko [Fri, 10 Dec 2021 17:26:02 +0000 (18:26 +0100)]
bhyve: refactor bhyveConnectDomainXMLToNative

Use g_auto and remove the ret variable, as well as the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: refactor bhyveProbeCapsFromHelp
Ján Tomko [Fri, 10 Dec 2021 16:41:56 +0000 (17:41 +0100)]
bhyve: refactor bhyveProbeCapsFromHelp

Use g_auto and remove the 'ret' variable, as well as the out label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: refactor bhyveProbeCapsDeviceHelper
Ján Tomko [Fri, 10 Dec 2021 16:41:56 +0000 (17:41 +0100)]
bhyve: refactor bhyveProbeCapsDeviceHelper

Use g_auto and remove the 'ret' variable, as well as the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: refactor virBhyveProbeGrubCaps
Ján Tomko [Fri, 10 Dec 2021 16:39:57 +0000 (17:39 +0100)]
bhyve: refactor virBhyveProbeGrubCaps

Use g_auto and remove the 'ret' variable, as well as the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoNEWS: Document TCG features
Michal Privoznik [Thu, 2 Dec 2021 08:47:39 +0000 (09:47 +0100)]
NEWS: Document TCG features

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Generate command line for tb-cache feature
Michal Privoznik [Thu, 4 Nov 2021 10:43:52 +0000 (11:43 +0100)]
qemu: Generate command line for tb-cache feature

Generating command line is pretty easy - just put tb-size=XXX
onto -accel tcg part. Note, that QEMU expects the size in MiB.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/229
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Validate TCG feature is enabled only for TCG domains
Michal Privoznik [Tue, 30 Nov 2021 12:37:54 +0000 (13:37 +0100)]
qemu: Validate TCG feature is enabled only for TCG domains

After previous commit it's possible for domains to fine tune TCG
features (well, just one - tb-cache). Check that domain has TCG
enabled, otherwise the feature makes no sense.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoconf: Introduce TCG domain features
Michal Privoznik [Wed, 3 Nov 2021 12:15:41 +0000 (13:15 +0100)]
conf: Introduce TCG domain features

It may come handy to be able to tweak TCG options, in this
specific case the size of translation block cache size (tb-size).
Since we can expect more knobs to tweak let's put them under
common element, like this:

  <domain>
    <features>
      <tcg>
        <tb-cache unit='MiB'>128</tb-cache>
      </tcg>
    </features>
  </domain>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoremote_driver: Implement virStreamInData() callback
Michal Privoznik [Mon, 6 Dec 2021 16:16:09 +0000 (17:16 +0100)]
remote_driver: Implement virStreamInData() callback

When using the monolithic daemon the driver for virStream is
always virFDStreamDrv and thus calling virStreamInData() results
in calling virFDStreamInData().

But things are different with split daemon, especially when a
client connects to one of hypervisor daemons (e.g. virtqemud) and
then lets the daemon connect to the storage daemon for
vol-upload/vol-download. Here, the hypervisor daemon acts like
both client and server. This is reflected by stream->driver
pointing to remoteStreamDrv, which doesn't have streamInData
callback implemented and thus vol-upload/vol-download with sparse
flag fails.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2026537
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agorpc: Introduce virNetClientStreamInData()
Michal Privoznik [Tue, 7 Dec 2021 13:04:35 +0000 (14:04 +0100)]
rpc: Introduce virNetClientStreamInData()

The aim of this function is to look at a virNetClientStream and
tell whether the incoming packet (if there's one) contains data
(type VIR_NET_STREAM) or a hole (type VIR_NET_STREAM_HOLE) and
how big the section is. This function will be called from the
remote driver in one of future commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirStreamInData: Allow callback to not rewind the stream
Michal Privoznik [Tue, 7 Dec 2021 13:43:33 +0000 (14:43 +0100)]
virStreamInData: Allow callback to not rewind the stream

So far, virStreamInData() is effectively a wrapper over
virFDStreamInData() which means it deals with files which can be
rewound (lseek()-ed) to whatever position we need. And in fact,
that's what virFDStreamInData() does - it makes sure that the FD
is left unchanged in terms of position in the file.  Skipping the
hole happens soon after - in daemonStreamHandleRead() when
virStreamSendHole() is called.

But this is about to change. Soon we will have another implementation
where we won't be dealing with FDs but virNetMessage queue and it will
be handy to pop message at the beginning of the queue. Implement and
document this new behavior.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: qemuBuildChardevCommand: use chrSourcePriv unconditionally
Ján Tomko [Mon, 13 Dec 2021 12:29:06 +0000 (13:29 +0100)]
qemu: qemuBuildChardevCommand: use chrSourcePriv unconditionally

In the QEMU driver, we allocate private source data unconditionally
for every chardev and the rest of the function just assumes it's there.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoRemove empty cleanup sections
Ján Tomko [Fri, 10 Dec 2021 15:21:59 +0000 (16:21 +0100)]
Remove empty cleanup sections

After recent cleanups, there are some pointless cleanup sections.

Clean them up.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobhyve: bhyveConnectCompareCPU: remove cleanup label
Ján Tomko [Fri, 10 Dec 2021 15:12:59 +0000 (16:12 +0100)]
bhyve: bhyveConnectCompareCPU: remove cleanup label

Return the desired values directly and clean up the redundant
else branches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: remove cleanup from lxcNodeGetSecurityModel
Ján Tomko [Fri, 10 Dec 2021 15:32:16 +0000 (16:32 +0100)]
lxc: remove cleanup from lxcNodeGetSecurityModel

Return the values directly.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: use g_auto for virLXCDriverGetConfig
Ján Tomko [Fri, 10 Dec 2021 13:56:46 +0000 (14:56 +0100)]
lxc: use g_auto for virLXCDriverGetConfig

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: define cleanup function for virLXCDriverConfig
Ján Tomko [Fri, 10 Dec 2021 13:51:38 +0000 (14:51 +0100)]
lxc: define cleanup function for virLXCDriverConfig

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoUse g_auto for stealing virCaps
Ján Tomko [Fri, 10 Dec 2021 14:07:13 +0000 (15:07 +0100)]
Use g_auto for stealing virCaps

Convert all the functions that generate virCaps to use g_auto
and g_steal_pointer.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoUse g_auto for freeing virCaps
Ján Tomko [Fri, 10 Dec 2021 14:04:07 +0000 (15:04 +0100)]
Use g_auto for freeing virCaps

Convert all the users who unref their virCaps object unconditionally.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolxc: fix error value of lxcNodeGetSecurityModel
Ján Tomko [Fri, 10 Dec 2021 15:30:46 +0000 (16:30 +0100)]
lxc: fix error value of lxcNodeGetSecurityModel

When adding the ACL check and caps getter, we assumed that
the default return value is -1, not 0 as usual.

Fix the return value on error by assigning them explicitly.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonss: Use shared_library() for nss_libvirt_lib
Andrea Bolognani [Sat, 11 Dec 2021 00:10:40 +0000 (01:10 +0100)]
nss: Use shared_library() for nss_libvirt_lib

shared_module() is intended for shared objects that are
loaded at runtime using dlopen() whereas NSS plugins need to
be full-fledged shared libraries with, among other things, a
proper SONAME.

Meson seems to have become more strict about this recently,
because libnss_libvirt.so.2 gets a SONAME when I build it with
Meson 0.59.4 on Fedora 34 but doesn't when I use Meson 0.60.2
on Debian testing instead.

Either way, shared_library() was always the right function
to use for NSS plugins.

Fixes: 36780c931900555706fd6db9fc2ce2b4cabf9045
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemuProcessPrepareHost: Create domain private dirs as early as possible
Michal Privoznik [Mon, 13 Dec 2021 11:17:14 +0000 (12:17 +0100)]
qemuProcessPrepareHost: Create domain private dirs as early as possible

As of ff024b60cc3 we are opening chardevs before starting QEMU.
However, we are also doing that before domain private directories
are created. This leaves us unable to create guest agent socket
which lives under priv->channelTargetDir.

While creating the dirs can be moved just before
qemuProcessPrepareHostBackendChardev() it's better to do it as
the very first step so that this kind of error is prevented in
future.

Fixes: ff024b60cc39d5d41b1e68728a00a47e103ec4dd
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoRevert "virt-ssh-helper: Add manual page"
Ján Tomko [Fri, 10 Dec 2021 22:07:48 +0000 (23:07 +0100)]
Revert "virt-ssh-helper: Add manual page"

This was pushed by mistake with incorrect claim of my R-b.

This reverts commit dadcd352604d9a4620a8a1d714e6324818cf9246.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-pki-query-dn: Add manual page
Andrea Bolognani [Thu, 9 Dec 2021 17:36:34 +0000 (18:36 +0100)]
virt-pki-query-dn: Add manual page

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-qemu-run: Improve manual page
Andrea Bolognani [Fri, 10 Dec 2021 10:05:54 +0000 (11:05 +0100)]
virt-qemu-run: Improve manual page

Specifically:

  * use the correct notation and markup for commands, options
    and arguments;
  * rename arguments meta-variables to be more descriptive;
  * sort options so that the most common ones come first;
  * use consistent vertical spacing;
  * fix a typo.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-qemu-run: Improve usage information
Andrea Bolognani [Fri, 10 Dec 2021 10:56:31 +0000 (11:56 +0100)]
virt-qemu-run: Improve usage information

Specifically, include non-option argument 'GUEST-XML-FILE'
in usage summary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Add manual page
Andrea Bolognani [Fri, 10 Dec 2021 14:56:29 +0000 (15:56 +0100)]
virt-ssh-helper: Add manual page

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Improve usage information
Andrea Bolognani [Fri, 10 Dec 2021 10:59:33 +0000 (11:59 +0100)]
virt-ssh-helper: Improve usage information

Specifically:

  * include non-option argument 'URI' in usage summary;
  * mention that it's an internal tool not meant to be
    called directly;
  * exit earlier if required arguments are absent.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Don't use optind
Andrea Bolognani [Fri, 10 Dec 2021 13:53:31 +0000 (14:53 +0100)]
virt-ssh-helper: Don't use optind

It's a getopt interface and we're not using getopt, at least
directly, so even though it works relying on it feels wrong.

GOption takes care of removing any trace of the arguments it
consumes from argc and argv, leaving behind only non-option
arguments, so we can just use those standard variables.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Enable unprivileged userfaultfd for post-copy migration
Jiri Denemark [Thu, 2 Dec 2021 14:43:27 +0000 (15:43 +0100)]
qemu: Enable unprivileged userfaultfd for post-copy migration

Userfaultfd is by default allowed only for privileged processes. Since
libvirt runs QEMU unprivileged, we need to enable unprivileged access to
userfaultfd to enable post-copy migration.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: command: Use 'qemuBuildChrChardevCommand' to build TPM backend
Peter Krempa [Fri, 5 Nov 2021 16:12:37 +0000 (17:12 +0100)]
qemu: command: Use 'qemuBuildChrChardevCommand' to build TPM backend

Since the backend of the TPM is a chardev we can use the common helper
to instantiate it.

This commit also ensures proper ordering so that the backend chardev is
formatted before it's being referenced.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Implement chardev source setup for tpm
Peter Krempa [Wed, 8 Dec 2021 09:07:44 +0000 (10:07 +0100)]
qemu: Implement chardev source setup for tpm

Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks
so that we can later use 'qemuBuildChardevCommand' for TPM devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use qemuBuildChrChardevCommand for vhost-user-gpu backend chardev
Peter Krempa [Fri, 5 Nov 2021 14:40:40 +0000 (15:40 +0100)]
qemu: Use qemuBuildChrChardevCommand for vhost-user-gpu backend chardev

Now that the API for qemuBuildChrChardevCommand is sane enough, we can
use it to centralize formatting of '-chardev' generally.

The 'virDomainVideoDef' doesn't use 'virDomainChrSourceDef' internally so
we create it for this occasion manually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use qemuBuildChrChardevCommand for virtiofs backend chardev
Peter Krempa [Fri, 5 Nov 2021 14:40:40 +0000 (15:40 +0100)]
qemu: Use qemuBuildChrChardevCommand for virtiofs backend chardev

Now that the API for qemuBuildChrChardevCommand is sane enough, we can
use it to centralize formatting of '-chardev' generally.

The 'virDomainFSDef' doesn't use 'virDomainChrSourceDef' internally so
we create it for this occasion manually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use qemuBuildChrChardevCommand for vhost-user disk backend
Peter Krempa [Thu, 4 Nov 2021 16:12:13 +0000 (17:12 +0100)]
qemu: Use qemuBuildChrChardevCommand for vhost-user disk backend

Now that the API for qemuBuildChrChardevCommand is sane enough, we can
use it to centralize formatting of '-chardev' generally.

For virtiofs we don't have a centrally stored chardev source so we
allocate one inline for temporary use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Implement chardev source setup for disk
Peter Krempa [Wed, 8 Dec 2021 09:07:44 +0000 (10:07 +0100)]
qemu: Implement chardev source setup for disk

Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks
so that we can later use 'qemuBuildChardevCommand' for vhost-user disks
instead of a custom formatter.

Since we don't pass the FD for the vhost-user connection to qemu all of
the setup can be skipped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Remove unused 'cfg' parameter
Peter Krempa [Mon, 22 Nov 2021 13:46:24 +0000 (14:46 +0100)]
qemuBuildChardevCommand: Remove unused 'cfg' parameter

Now that the parameter is unused we can remove it as well as from each
caller that doesn't need it any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Store TLS config options for chardevs in qemuDomainChrSourcePrivate
Peter Krempa [Mon, 22 Nov 2021 13:41:23 +0000 (14:41 +0100)]
qemu: Store TLS config options for chardevs in qemuDomainChrSourcePrivate

When setting up TLS options from config in qemuDomainPrepareChardevSourceOne
we can also extract the x509 certificate path and default tlsVerify
setting so that 'qemuBuildChardevCommand' doesn't need to access the
config object any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Split creation of the command and setup of other objects
Peter Krempa [Fri, 19 Nov 2021 16:35:21 +0000 (17:35 +0100)]
qemuBuildChardevCommand: Split creation of the command and setup of other objects

Completely seprate the creation of the commandline string from the setup
of other objects instantiated on the commandline.

'qemuBuildChardevCommand' will aggregate the setup of individual
parameters such as -add-fd and setup of TLS and the -chardev parameter
itself while the code formatting the commandline will be moved into
qemuBuildChardevStr.

'fdset' names are then stored in qemuDomainChrSourcePrivate.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Don't prefix alias
Peter Krempa [Fri, 5 Nov 2021 14:28:43 +0000 (15:28 +0100)]
qemuBuildChardevCommand: Don't prefix alias

Make the callers construct the alias for the chardev so that the
function can be used also for code paths which use a different
convention.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Move earlier
Peter Krempa [Thu, 4 Nov 2021 16:04:37 +0000 (17:04 +0100)]
qemuBuildChardevCommand: Move earlier

Make it accessible sooner inside qemu_command.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChrChardevStr: Directly generate command line
Peter Krempa [Thu, 4 Nov 2021 12:59:47 +0000 (13:59 +0100)]
qemuBuildChrChardevStr: Directly generate command line

'qemuBuildChrChardevStr' used a hybrid approach where some arguments
were directly added to '@cmd' while the commandline itself was returned
as a string.

This patch renames qemuBuildChrChardevStr to qemuBuildChardevCommand
and adds the argument directly to @cmd inside the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildConsoleCommandLine: Remove identical code
Peter Krempa [Thu, 4 Nov 2021 13:12:05 +0000 (14:12 +0100)]
qemuBuildConsoleCommandLine: Remove identical code

Unify the cases for SCLP/SCLPLM/VIRTIO consoles as the code is
identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add _LATEST version for 'name-escape' case
Peter Krempa [Mon, 15 Nov 2021 16:00:56 +0000 (17:00 +0100)]
qemuxml2argvtest: Add _LATEST version for 'name-escape' case

It was impossible to use _LATEST when commit d7c814f7f75 was modernizing
the cases as improper separation in the code caused that files were
created in the host during the testsuite run.

Now that the host manipulation when instantiating chardevs is separated
we can add the missing version.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add DO_TEST_CAPS_LATEST versions for all character device tests
Peter Krempa [Tue, 26 Oct 2021 12:38:41 +0000 (14:38 +0200)]
qemuxml2argvtest: Add DO_TEST_CAPS_LATEST versions for all character device tests

Now that the test cases won't cause host modification we can add the
contemporary versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChrChardevStr: Remove unused arguments and clean up callers
Peter Krempa [Thu, 4 Nov 2021 09:51:34 +0000 (10:51 +0100)]
qemuBuildChrChardevStr: Remove unused arguments and clean up callers

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChrChardevStr: Remove 'cdevflags' argument
Peter Krempa [Wed, 3 Nov 2021 15:42:31 +0000 (16:42 +0100)]
qemuBuildChrChardevStr: Remove 'cdevflags' argument

The argument and corresponding enum are not used any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Store chardev 'wait' flag in chardev source private data
Peter Krempa [Wed, 3 Nov 2021 13:12:16 +0000 (14:12 +0100)]
qemu: Store chardev 'wait' flag in chardev source private data

We have just one case when we wish to wait for incomming connections for
a listening socket and that is for vhost-user network devices.

Passing this via a flag to qemuBuildChrChardevStr is unwieldy. Add a
field to qemuDomainChrSourcePrivate and populate it for our special
case inside of qemuDomainPrepareChardevSourceOne.

Since we wait for incomming connections only on startup of a new VM we
also need to pass in a flag whether qemuDomainPrepareChardevSourceOne
is called on a new start or on hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Refactor chardev definition preparing
Peter Krempa [Thu, 18 Nov 2021 14:16:20 +0000 (15:16 +0100)]
qemu: domain: Refactor chardev definition preparing

Use the qemuDomainDeviceBackendChardevForeach helper to iterate all
eligible structs and convert the setup of the TLS defaults from the
config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: remove the unused 'chardevStdioLogd' argument/variable
Peter Krempa [Wed, 3 Nov 2021 12:59:41 +0000 (13:59 +0100)]
qemu: command: remove the unused 'chardevStdioLogd' argument/variable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: Remove unused QEMU_BUILD_CHARDEV_FILE_LOGD and QEMU_BUILD_CHARDEV_UNIX...
Peter Krempa [Wed, 3 Nov 2021 12:24:24 +0000 (13:24 +0100)]
qemu: command: Remove unused QEMU_BUILD_CHARDEV_FILE_LOGD and QEMU_BUILD_CHARDEV_UNIX_FD_PASS

'qemuBuildChrChardevStr' doesn't use these flags any more. Stop passing
them.

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