Commit Graph

7517 Commits

Author SHA1 Message Date
Peter Krempa
fe25fb51b1 tests: qemuxml2argvdata: Remove use of 'pc-1.0' and 'pc-1.2' machine types
There's nothing special about the tests requiring to use very old
machine types. Most usage is cargo-culted from other tests. Switch all
the tests to use 'pc' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:13 +01:00
Peter Krempa
0a810b4a16 testutilsqemu: Remove unused non-x86 fake machine types
For tests with fake capabilities we fill in a bunch of machine types
which the tests might use. For now there's a random collection of
machine types which are not actually used. Purge the unused ones for
non-x86 machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:13 +01:00
Peter Krempa
f36ca73940 qemuxml2argvtest: Remove redundant floppy controller tests
The two test cases were added to avoid regressions such as fixed in
17dff35848. Nowadays the code is much simpler and any Q35 machine
will trigger the explicit FDC.

Remove the '2.11' machine type version and turn the '2.9' version into a
generic q35 machine.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:13 +01:00
Peter Krempa
dc5fd559eb qemuProcessPrepareQEMUCaps: Don't clear QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
All the fd-passing setup of chardevs which this hack meant to disable
was moved to the host-preparation phase which is skipped for formatting
of non-real commandlines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-07 09:25:13 +01:00
Martin Kletzander
9f6749dea0 util: Check for errors in virLogSetFromEnv
And make callers check the return value as well.  This helps error out early for
invalid environment variables.

That is desirable because it could lead to deadlocks.  This can happen when
resetting logging after fork() reports translated errors because gettext
functions are not reentrant.  Well, it is not limited to resetting logging after
fork(), it can be any translation at that phase, but parsing environment
variables is easy to make fail on purpose to show the result, it can also happen
just due to a typo.

Before this commit it is possible to deadlock the daemon on startup
with something like:

LIBVIRT_LOG_FILTERS='1:*' LIBVIRT_LOG_OUTPUTS=1:stdout libvirtd

where filters are used to enable more logging and hence make the race less rare
and outputs are set to invalid

Combined with the previous patches this changes
the following from:

...
<deadlock>

to:

...
libvirtd: initialisation failed

The error message is improved in future commits and is also possible thanks to
this patch.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-01-05 14:08:40 +01:00
Jim Fehlig
00f324bc3c qemu: Implement the virDomainSetLaunchSecurityState API
Set a launch secret in guest memory using the sev-inject-launch-secret
QMP API. Only supported with qemu >= 6.0.0 and SEV-enabled guests in a
paused state.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 10:56:00 -07:00
Jim Fehlig
a26d99c2b1 qemu_capabilities: Introduce QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET
The 'sev-inject-launch-secret' qmp command is only available with
qemu >= 6.0.0. Introduce a capability for sev-inject-launch-secret.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 10:56:00 -07:00
Michal Privoznik
51f7f7d109 qemuxml2xmloutdata: Turn kvm-features*.xml into symlinks
There's no real difference between input and output XMLs for
kvm-features and kvm-features-off test cases. Do what we usually
do in such case - turn the output file into a symlink of the
input file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-04 16:40:10 +01:00
Michal Privoznik
dcc278d04e qemuxml2xmloutdata: Turn tpm-*.xml files into symlinks
Make the tpm-*.xml files symlinks to their respective input XMLs
from qemuxml2argvdata/ directory. Neither of the XMLs relies on
autofill of any TPM data.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 10:23:11 +01:00
Michal Privoznik
d00e6dfe6b qemuxml2xmltest: Introduce tpm-emulator-spapr test
We already have the input xml because of xml2arg test. However,
the corresponding xml2xml test case is missing. Make the expected
XML a symlink to the input XML and clean the latter up a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 09:43:35 +01:00
Peter Krempa
c574a25932 tests: Remove 'qemucapsfixreplies'
The 'qemucapabilitiesnumbering' tool now replaces the role of this
script and provides way to programmatically modify the replies file on
top.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
06fb078fea tests: Tool for programatic modification of qemucapabilitiesdata/*.replies
The tool is assembled from individual bits used for tests and actual
capturing of the replies files. The tool ensures correct numbering and
formatting of entries.

In normal usage mode it masks as a test which validates formatting and
numbering of the tests/qemucapabilitiesdata/*.replies files. This tool
was actually used to produce commits 096ac87a1a and aa21615ccb.

In case a manual modification of the replies file is needed the
'modify()' function provides a convenient way to do programatic
modification of the caps file.

As an example the modify() function has commented-out code which
provides a basic scaffold to do modifications along with a how-to.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
984952842f qemumonitortestutils: Extract parser for the monitor conversation dump file
Make the parser reusable by extracting it and making it parse into
command,reply tuples.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
93093b8089 tests: qemumonitortestutils.h: Reformat header file
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Andrea Bolognani
a8f4298175 tests: virtimetest: Mention GLib version containing fix
We now know exactly which GLib version we need to depend on
for the workaround to no longer be necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-03 09:39:35 +01:00
Andrea Bolognani
9be0889234 tests: virtimetest: Skip more tests near year's end
All of these are affected by the same issue as the ones that
we're already skipping during this specific time interval.

Suggested-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-03 09:38:48 +01:00
Andrea Bolognani
4e0acd34c9 tests: virtimetest: Move comment
Will keep things reasonable as we perform further code
movements.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-03 09:38:44 +01:00
Peter Krempa
a8b4a41731 util: json: Don't copy string in virJSONValueNewString
With 'g_strdup' not needing error handling we can ask callers to pass a
copy of the string which will be adopted by the JSON value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
66566e84b8 storage: Introduce 'extended_l2' feature for storage volume
QCOW2 images now support 'extended_l2' which splits the default clusters
into 32 subcluster allocation units. This allows the allocation units to
be smaller without increasing the size of L2 table too much and thus also
the cache requirements for holding the full L2 table in memory.

Unfortunately it's incompatible with qemu versions older than 5.2 thus
can't be used as default.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-21 13:23:09 +01:00
Michal Privoznik
5ce184f33c vsh-table: Ensure NULL terminated arguments to vshTable*()
There are two functions that take variable arguments:
vshTableNew() and vshTableRowAppend(). Both expect the list of
arguments to be NULL terminated. Annotate them with
G_GNUC_NULL_TERMINATED to enable compile time check for this.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-17 15:05:58 +01:00
Michal Privoznik
eb9bbde772 vshtabletest: Fix potential memleak
In testVshTableNew() we test whether vshTableNew(NULL) allocates
a table. This is expected to fail (and return NULL), because
passing nothing but NULL to vshTableNew() is viewed as error.
Nevertheless, if vshTableNew() did not fail and returned an
allocated table it would be leaked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-17 15:05:42 +01:00
Michal Privoznik
c1355849e4 qemu_command: do use host-nodes for system memory
After previous commit, it's no longer possible to change nodeset
for strict numatune. Therefore, we can start generating
host-nodes onto command line again.

This partially reverts d73265af6e.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-12-17 13:21:55 +01:00
Michal Privoznik
8237cdd8d4 qemucapabilitiesdata: Fix command name in caps_3.0.0.ppc64.replies
Under the qemucapabilitiesdata we have a replies file for
QEMU-3.0.0.ppc64. At least we think so. In fact, the file
contains replies from a development snapshot release that
predates 3.0.0 (specifically it's v2.12.0-1689-g518d23a) and as
such does not reflect any change that was made to QEMU after the
snapshot and before the official relase. One of such changes was
renaming 'exit-preconfig' command to 'x-exit-preconfig' (QEMU
commit v3.0.0-rc1~21^2~3). Ideally, we would just regenerate
capabilities using the official release but since this is a PPC64
machine and pretty old version anyway let's just fix the command
name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-12-17 09:39:53 +01:00
Daniel P. Berrangé
e4e873e9b6 qemu: format sev-guest.kernel-hashes property
Set the kernel-hashes property on the sev-guest object if the config
asked for it explicitly. While QEMU machine types currently default to
having this setting off, it is not guaranteed to remain this way.

We can't assume that the QEMU capabilities were generated on an AMD host
with SEV, so we must force set the QEMU_CAPS_SEV_GUEST. This also means
that the 'sev' info in the qemuCaps struct might be NULL, but this is
harmless from POV of testing the CLI generator.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-16 18:10:33 +00:00
Daniel P. Berrangé
a4efca7695 tests: allow setting extra capabilities on top of versioned caps
In the QEMU tests a test can either use an explicitly listed set of
capabilities, or can request those matching a particular QEMU
version. Sometimes it is desirable to be able to list extra caps
on top of those implied by a particular version.

This is useful, for example, when QEMU won't report certain features
unless it was run on particular hardware or kernels, and those were
not used when a caps snapshot was imported to the libvirt source tree.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-16 18:10:33 +00:00
Daniel P. Berrangé
1826716c1f qemu: probe for sev-guest.kernel-hashes property
This sev-guest object property indicates whether QEMU should
expose the kernel, ramdisk, cmdline hashes to the firmware
for measurement.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-16 18:06:53 +00:00
Peter Krempa
8557431995 qemuxml2argvtest: disk-missing-target: Add two disks with same bus
A recent code movement introduced a bug which reproduces only when there
are two disks on the same bus missing the target. Improve the test case
for the missing target test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-16 15:58:06 +01:00
Peter Krempa
f8915af663 qemucapstest: Update qemu capabilities probe dump for qemu-6.2 release
qemu-6.2 is out, update the caps dump for the final time.

Notable changes:
- 'unstable' feature flag for various QMP schema entries
- 'aio-max-batch' iothread property
- 'kernel-hashes' knob for the 'sev-guest' object
- 'native-hotplug' of 'pcie-root-port' is now unstable again
- 'page-sampling/dirty-ring/dirty-bitmap' mode for 'calc-dirty-rate'
- 'toolsversion' field for the 'vmdk' disk format driver
- CPU changes resulting in 'core-capability' being present on the cpu
  of the machine this dump was done on

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-16 09:57:35 +01:00
Ján Tomko
6b59d6cac1 tests: do not test dnsmasq older than 2.67
Prepare to retire older versions by droping older tests.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-12-15 15:28:17 +01:00
Daniel P. Berrangé
7826148a72 qemu: report max number of SEV guests
Different CPU generations have different limits on the number
of SEV/SEV-ES guests that can be run. Since both limits come
from the same overall set, there is typically also BIOS config
to set the tradeoff betweeen SEV and SEV-ES guest limits.

This is important information to expose for a mgmt application
scheduling guests to hosts.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-14 16:04:17 +00:00
Daniel P. Berrangé
34cb8f6fcd conf: extend domain capabilities for max SEV guest count
There are limits on the number of SEV/SEV-ES guests that can
be run on machines, which may be influenced by firmware
settings. This is important to expose to users.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-14 16:04:17 +00:00
Daniel P. Berrangé
cc9679ef14 qemu: add monitor APIs for query-sev
We're only returning the set of fields needed to perform an
attestation, per the SEV API docs.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-14 16:04:17 +00:00
Tim Wiederhake
565524fb5f tests: Add tests for hyperv-passthrough
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-14 16:50:45 +01:00
Tim Wiederhake
5050b71da0 virDomainDefFormatFeatures: Write attribute "mode" of element "hyperv"
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-14 16:50:45 +01:00
Ján Tomko
7e41c10b95 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>
2021-12-14 16:41:06 +01:00
Ján Tomko
8843cd113e 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 8b32c80df0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-12-14 16:41:06 +01:00
Hyman Huang(黄勇)
359e9f5cf4 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>
2021-12-14 13:18:53 +01:00
Hyman Huang(黄勇)
5d18d740d8 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>
2021-12-14 13:17:41 +01:00
Laine Stump
d566cc55bf 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>
2021-12-13 13:37:31 -05:00
Laine Stump
3d37406626 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>
2021-12-13 13:37:31 -05:00
Laine Stump
f8151c637c 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>
2021-12-13 13:37:31 -05:00
Laine Stump
35eb484f8c 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>
2021-12-13 13:37:31 -05:00
Michal Privoznik
58bf03f85e 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>
2021-12-13 17:10:03 +01:00
Michal Privoznik
f106788069 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>
2021-12-13 17:01:02 +01:00
Ján Tomko
7d825985b4 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>
2021-12-13 14:44:01 +01:00
Ján Tomko
eb52b9f8af 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>
2021-12-13 14:44:01 +01:00
Peter Krempa
1ee3314c10 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>
2021-12-10 16:37:42 +01:00
Peter Krempa
5c62df7e78 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>
2021-12-10 16:37:42 +01:00
Peter Krempa
9a89ec8997 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>
2021-12-10 16:37:42 +01:00
Peter Krempa
5f2cc74257 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>
2021-12-10 16:37:42 +01:00