Commit Graph

43838 Commits

Author SHA1 Message Date
Daniel P. Berrangé
e28ce3885d qemu: inline the qemuBuildCpuFeature code
With the previous refactorings, there's no real benefit from the
qemuBuildCpuFeature helper method. Only one of the callers really
needs the CPU feature name re-writing logic, the others can just
use the right name directly.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 13:19:37 +01:00
Daniel P. Berrangé
ff3e93a26b qemu: remove use of (+|-)name syntax for -cpu featres
The -cpu arg gained support for feature=on|off syntax for the x86
emulator in 2.4.0

  commit 38e5c119c2925812bd441450ab9e5e00fc79e662
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Mon Mar 23 17:29:32 2015 -0300

    target-i386: Register QOM properties for feature flags

Most other targets gained this syntax even earlier in 1.4.1

  commit 1590bbcb02921dfe8e3cf66e3a3aafd31193babf
  Author: Andreas Färber <afaerber@suse.de>
  Date:   Mon Mar 3 23:33:51 2014 +0100

    cpu: Implement CPUClass::parse_features() for the rest of CPUs

    CPUs who do not provide their own implementation of feature parsing
    will treat each option as a QOM property and set it to the supplied
    value.

There appears no reason to keep supporting "+|-feature" syntax,
given the current minimum QEMU version.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 13:01:41 +01:00
Daniel P. Berrangé
a81784ea3a qemu: always use hyphens in hyperv feature names
QEMU switched from using underscores in x86 CPU features to hyphens
in the 2.8.0 series with two commits

  commit fc7dfd205f3287893c436d932a167bffa30579c8 (HEAD, refs/bisect/bad)
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:40 2016 -0300

    target-i386: Remove underscores from feat_names arrays

  commit 54b8dc7c19cd781e96f1e9b001ca6001d804eb19
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:38 2016 -0300

    target-i386: Register aliases for feature names with underscores

Libvirt names use underscores so we conditionally tranlate the
names when talking to new QEMU. Since the min QEMU was raised to
version 2.11.0, all QEMU versions we talk to expect hypens, so
the translation can be done unconditionally.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 13:01:33 +01:00
Daniel P. Berrangé
7bf6292fb3 qemu: always translate underscores to hyphens in CPU features
QEMU switched from using underscores in x86 CPU features to hyphens
in the 2.8.0 series with two commits

  commit fc7dfd205f3287893c436d932a167bffa30579c8 (HEAD, refs/bisect/bad)
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:40 2016 -0300

    target-i386: Remove underscores from feat_names arrays

  commit 54b8dc7c19cd781e96f1e9b001ca6001d804eb19
  Author: Eduardo Habkost <ehabkost@redhat.com>
  Date:   Fri Sep 30 15:49:38 2016 -0300

    target-i386: Register aliases for feature names with underscores

Libvirt names use underscores so we conditionally tranlate the
names when talking to new QEMU. Since the min QEMU was raised to
version 2.11.0, all QEMU versions we talk to expect hypens, so
the translation can be done unconditionally.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 13:01:22 +01:00
Daniel P. Berrangé
28a1059ddd ci: switch all non-released distros to be non-gating
The non-released distros have reasonably frequent package installation
failures that can last for days at a time. This makes them unsuitable
for use as gating CI jobs.

This ensures all of the jobs in Debian Sid, Fedora Rawhide, openSUSE
Tumbleweed and FreeBSD Current are marked "allow-failure: true".

This means the jobs still run, but any failure will not be considered
fatal to the pipeline.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 12:57:56 +01:00
Daniel P. Berrangé
13eab52429 ci: refresh configuration from manifest
The layering of the cross containers is fixed to move arch specific
ccache setup out of the common base layer.

A missing Cirrus CI variable substitution is added, though this is
irrelevant given libvirt's package list.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-10-20 12:57:16 +01:00
Peter Krempa
ab8d520eb5 qemuMonitorBlockStatsUpdateCapacity: Remove 'backingChain' argument
Always fetch the stats for all backing chain members. Callers from
qemu_driver.c already always passed 'true' and the caller from the
migration code won't mind when we fetch all stats.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
5f5631707f qemuMonitorGetAllBlockStatsInfo: Remove 'backingChain' argument
All (proper) callers pass true so we can remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
4e950ba4b4 qemuMonitorJSONQueryBlockstats: Refactor cleanup
Use automatic memory clearing and remove the cleanup label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
d7050b0d08 qemuDomainGetStatsBlock: Refactor cleanup
Use automatic memory clearing for the temporary variables and remove the
cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
c93bf61647 qemuMonitorJSONBlockStatsUpdateCapacityOne: Refactor cleanup
Use automatic memory clearing for the temporary variable and remove the
cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
3beb56f3e8 qemuMonitorJSONBlockStatsUpdateCapacity: Refactor cleanup
Use automatic memory clearing for the temporary variable and remove the
cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
65ff87c51c qemuDomainGetStatsBlock: Always fetch stats for the full backing chain
Similarly to the fix to 'qemuDomainBlocksStatsGather' we should be
always fetching the full backing chain so that we can avoid any
automatic filter notes which would prevent us from fetching the stats
for the correct nodename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Peter Krempa
579e05536b qemuDomainBlocksStatsGather: Always fetch stats for the full backing chain
In certain cases such as when running a backup blockjob qemu installs a
filter node between the frontend and the top node of the backend of the
disk. The stats gathering code didn't instruct the monitor code to fetch
the stats for all the layers, so since the top layer now doesn't have
stats we were reporting wrong stats such as allocation.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2015281
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-20 13:43:37 +02:00
Stefan Berger
c66115b6e8 qemu: tpm: Run swtpm_setup --create-config-files in session mode
Using swtpm v0.7.0 we can run swtpm_setup to create default config files
for swtpm_setup and swtpm-localca in session mode. Now a user can start
a VM with an attached TPM without having to run this program on the
command line before. This program needs to run once.

This patch addresses the issue raised in
https://bugzilla.redhat.com/show_bug.cgi?id=2010649

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-10-20 13:31:26 +02:00
Peng Liang
e8b5c09a03 qemu: Move pid file of virtiofsd to stateDir
Libvirt will put the pid file of virtiofsd to per-domain directory.
However, the ownership of the per-domain directory is the user to run
the QEMU process and the user has the write permission of the directory.
If VM escape occurs, the attacker can
1. write arbitrary content to the pid file (if running QEMU using root),
   then the attacker can kill any process by writing appropriate pid to
   the pid file;
2. spoof the pid file (if running QEMU using a regular user), then the
   virtiofsd process will never be cleared even if the VM is destroyed.

So, move the pid file of virtiofsd from per-domain directory to
stateDir.

Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-19 09:12:31 +02:00
Peng Liang
74e1ebee7f qemu: Move pid file of pr-helper to stateDir
Libvirt will put the pid file of pr-helper to per-domain directory.
However, the ownership of the per-domain directory is the user to run
the QEMU process and the user has the write permission of the directory.
If VM escape occurs, the attacker can
1. write arbitrary content to the pid file (if running QEMU using root),
   then the attacker can kill any process by writing appropriate pid to
   the pid file;
2. spoof the pid file (if running QEMU using a regular user), then the
   pr-helper process will never be cleared even if the VM is destroyed.

So, move the pid file of pr-helper from per-domain directory to
stateDir.

Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-19 09:12:26 +02:00
Peter Krempa
8eb08e0fc5 virNodeDeviceDefParse: Don't call post-parse callbacks with NULL def
When parsing of the node device XML fails we'd still call the post-parse
and validation callbacks which makes no sense. Additionally the
callbacks were expecting a non-NULL pointer which leads to a crash.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2014139
Fixes: d5ae634ba2
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-10-18 17:40:46 +02:00
Peter Krempa
289aa4bc5b virsh: Add QMP command wrapping for 'qemu-monitor-command'
Issuing simple QMP commands is pain as they need to be wrapped by the
JSON wrapper:

 { "execute": "COMMAND" }

and optionally also:

 { "execute": "COMMAND", "arguments":...}

For simple commands without arguments we can add syntax sugar to virsh
which allows simple usage of QMP and additionally prepares also for
passing through of the 'arguments' section:

 virsh qemu-monitor-command $VM query-status

is equivalent to

 virsh qemu-monitor-command $VM '{"execute":"query-status"}'

and

 virsh qemu-monitor-command $VM query-named-block-nodes '{"flat":true}'
 or
 virsh qemu-monitor-command $VM query-named-block-nodes '"flat":true'

is equivalent to

 virsh qemu-monitor-command $VM '{"execute":"query-named-block-nodes", "arguments":{"flat":true}}'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-18 16:04:17 +02:00
Peter Krempa
82c2196840 NEWS: Mention conversion of '-device' to JSON starting with QEMU-6.2
Normally this would be considered an internal detail which we don't
document in the news, but in this case I'd like to make people aware of
the change so that they preferrably report them ASAP.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:59 +02:00
Peter Krempa
6f34a991c7 testCompareXMLToArgvValidateSchemaCommand: Add validation for '-device'
Now that we use JSON with -device we can validate it at least partially
(since the schema for 'device_add' is for now incomplete) against the
QMP schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:59 +02:00
Peter Krempa
c9b13e0557 qemu: Use JSON directly for '-device'
Starting with QEMU-6.2 started accepting a JSON object as argument for
'-device' which will also become the only syntax considered stable by
qemu in the future.

Since libvirt was recently converted to generate the properties via JSON
to begin wit we can start using it on the commandline as well, by simply
enabling the QEMU_CAPS_DEVICE_JSON capability, which we do by probing
for the 'json-cli' feature flag of 'device_add'.

Normally a change which changes a commandline output should be happening
only after the impacted real-caps test files are forked in the version
preceding the change, but in this case it's not necessary as the logic
for generating the device properties stays identical and we just change
the output format (avoid conversion). Additionally we still have a lot
of tests validating the conversion to the old commandline options.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Peter Krempa
697e796981 qemuMonitorTestProcessCommandDefaultValidate: Partially validate 'device_add'
Use the 'allowIncomplete' argument of testQEMUSchemaValidateCommand to
validate at least properties which are already described by the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Peter Krempa
b17fd211e2 testQEMUSchemaValidateCommand: Add possibility for partial QMP validation
The QMP schema for 'device_add' is not complete yet. Allow validation of
incomplete schema so that we can enable at least some validation. Once
there's more schema in the future all present members are still
validated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Peter Krempa
387c900de9 qemucapabilitiestest: Update qemu-6.2 cycle capability test data
Update to v6.1.0-1510-gc148a05721 which most notably adds the 'json-cli'
feature for 'device_add' QMP command meaning that -device accepts JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-18 14:00:58 +02:00
Michal Privoznik
8fbffeae07 qemu: Decrease scope of variables in qemuConnectGetAllDomainStats()
There are two variables (@vm and @domflags) in qemuConnectGetAllDomainStats()
that are used only within the for() loop but declared for entire function.
Bring them into the loop to make it obvious they are not used outside of it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-10-18 12:09:39 +02:00
Michal Privoznik
c2c67fe4fd objecteventtest: Don't overwrite @ret on failure
Our general pattern is to initialize @ret to -1 and set it to 0
only at the end of a function. Some functions in
objecteventtest.c do not follow this pattern.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-10-18 12:09:33 +02:00
Michal Privoznik
5ae12eba7f objecteventtest: Drop lifecycleEventCounter_reset()
The sole purpose of the lifecycleEventCounter_reset() function is
to zero out given lifecycleEventCounter struct. Well, we can let
the compiler zero it out when declaring a variable and just
remove the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-10-18 12:09:23 +02:00
Hiroki Narukawa
91f3944935 NEWS: document bug fix about virsh domstats on qemu < 5.2.0
I think that virsh domstats problem on qemu < 5.2.0 is what users want
to find which version fixes.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-18 10:37:21 +02:00
Hiroki Narukawa
fd56272203 qemu_driver: add check for qemu capabilities requirements
query-dirty-rate command is used for virsh domstats by default, but this
is available only on qemu >=5.2.0.

By this commit, qemu domain stats will check capabilities requirements before issuing actual query.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-18 10:37:19 +02:00
Hiroki Narukawa
f29d7c3e69 qemu_driver: add required capabilities to qemuDomainGetStatsWorkers
One of qemuDomainGetStatsWorkers requires capabilities to run.

This commit adds capability information to qemuDomainGetStatsWorkers.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-18 10:37:17 +02:00
Hiroki Narukawa
06b45f2c5e qemu_capabilities: Add QEMU_CAPS_QUERY_DIRTY_RATE capability
query-dirty-rate command is used for virsh domstats by default, but this
is available only on qemu >=5.2.0.

In this commit, add capability flag for query-dirty-rate first.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-18 10:37:14 +02:00
Jim Fehlig
2703b0b5bf qemu: Do not report eof when processing monitor IO
There have been countless reports from users concerned about the following
error reported by libvirtd when qemu domains are shutdown

internal error: End of file from qemu monitor

While the error is harmless, users often mistaken it for real problem with
their deployments. EOF from the monitor can't be entirely ignored since
other threads may be using the monitor and must be able to detect the EOF
condition.

One potential fix is to delay reporting EOF until the monitor is used
after EOF is detected. This patch adds a 'goteof' member to the
qemuMonitor structure, which is set when EOF is detected on the monitor
socket. If another thread later tries to send data on the monitor, the
EOF error is reported.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-15 11:16:31 -06:00
Michal Privoznik
0a9d5f87b9 virnetsocket: Use g_auto* more
There are few functions in virnetsocket.c where an object/memory
is freed by explicit call. Use g_autoptr()/g_autofree/VIR_AUTOCLOSE
to do that automatically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-15 16:03:47 +02:00
Michal Privoznik
44d8324f13 virnetsocket: Don't free virCommand in virNetSocketNewConnectCommand()
The aim of virNetSocketNewConnectCommand() is to execute passed
command and attach socket pair/pipe to it so that client socket
can be opened (this is used for connections with alternative
transports, e.g. ssh). The virCommand is created in a caller and
then passed to virNetSocketNewConnectCommand() where it is freed
using virCommandFree(). This approach is wrong on two levels:

1) The deallocation happens on a different level than allocation,
2) There's a WIN32 stub that just reports an error and doesn't
   free the command.

However, with g_autoptr() trickery the command can be freed in
caller.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-15 16:03:22 +02:00
Hiroki Narukawa
d9afe162ab qemu_validate: Fix capability check for disk queue_size
Commit ad209e7d adds QEMU_CAPS_VIRTIO_BLK_QUEUE_SIZE capability, but
the following commit 2d6d67e1 missed to use it and uses
QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES instead.

This commit fixes the mistake.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-15 14:38:35 +02:00
Michal Privoznik
0cddf1978c qemu: capabilities: Retire QEMU_CAPS_VIRTIO_PCI_ATS
The capability reflects whether QEMU is capable of -device
virtio-*,ats=. Since the property was introduced in QEMU commit
v2.9.0-rc0~162^2~32 we can safely assume the property is always
present as the minimal version required is 2.11.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:49:11 +02:00
Michal Privoznik
8607dc3706 qemuxml2argvtest: Drop negative virtio-*-ats tests
There are some tests cases in qemuxml2argvtest that aim to check
whether our validator rejects <driver ats=''/> when
QEMU_CAPS_VIRTIO_PCI_ATS capability is not present.  Well, such
scenario can't happen really because the capability will always
be present.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:49:07 +02:00
Michal Privoznik
02c4c29823 qemu: capabilities: Retire QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM
The capability reflects whether QEMU is capable of -device
virtio-*,iommu_platform=. Since the property was introduced in
QEMU commit v2.9.0-rc0~162^2~37 we can safely assume the property
is always present as the minimal version required is 2.11.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:49:04 +02:00
Michal Privoznik
4b91b98889 qemuxml2argvtest: Drop negative virtio-*-iommu tests
There are some tests cases in qemuxml2argvtest that aim to check
whether our validator rejects <driver iommu=''/> when
QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM capability is not present.
Well, such scenario can't happen really because the capability
will always be present.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:48:59 +02:00
Michal Privoznik
01bfd5e33d test: Drop unused .args or .xml files
There are a few files containing expected output for test cases
that no longer exist. Remove them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-10-15 12:48:47 +02:00
Han Han
d139171d80 qemu: Add support for virtio device option page-per-vq
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925363

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-15 09:40:58 +02:00
Han Han
388cdd11f3 conf: Add page_per_vq for driver element
Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Gavi Teitz <gavi@nvidia.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-10-15 09:40:55 +02:00
Kristina Hanicova
61cb54e3cb qemu_migration: drop unnecessary 'migrate_speed' variable
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-10-13 12:43:54 +02:00
Kristina Hanicova
8c26fd7823 qemu_migration: set bandwidth in priv during migration
We did not set priv->migMaxBandwidth if '--bandwidth' was
specified as an option in the 'migrate' virsh command. This
caused in printing the wrong value if virsh command
'migrate-getspeed' was called during the migration. This patch
first sets the value to the given bandwidth (if one was
specified) and restores the previous value after the migration.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-10-13 12:19:13 +02:00
Peter Krempa
926864ba45 qemuBuildFloppyCommandLineControllerOptionsExplicit: Generate via JSON
QEMU declares the bootindex types as:

  bootindexA=<int32>
  bootindexB=<int32>

The driveA/driveB parameters were deprecated and removed in qemu-6.0.
We'll keep them for compatibility, but they are not used with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 20:54:53 +02:00
Peter Krempa
245e8a12fd qemuBuildFloppyCommandLineControllerOptions: Extract formatting of implicit/explicit fdc
qemuBuildFloppyCommandLineControllerOptions was generating config for
both the implicit and explicit fdc. The explicit FDC is using '-device'
and thus will need to be converted to JSON.

Split up the lookup of the floppy drive configs from the actual command
generation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 20:54:53 +02:00
Peter Krempa
9e359909d5 qemuBuildSmartcardCommandLine: Generate via JSON
QEMU declares the props we control as:

'ccid-card-emulated'
  backend=<str>
  cert1=<str>
  cert2=<str>
  cert3=<str>
  db=<str>

'ccid-card-passthru'
  chardev=<str>          - ID of a chardev to use as a backend

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 20:54:53 +02:00
Peter Krempa
cefa20b727 qemuBuildIOMMUCommandLine: Generate via JSON
QEMU declares the following types for fields we control:

  intremap=<OnOffAuto>   - on/off/auto (default: "auto")
  caching-mode=<bool>    -  (default: false)
  eim=<OnOffAuto>        - on/off/auto (default: "auto")
  device-iotlb=<bool>    -  (default: false)
  aw-bits=<uint8>        -  (default: 39)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 20:54:53 +02:00
Peter Krempa
5d51f836b0 qemuBuildVMCoreInfoCommandLine: Generate via JSON
While this device doesn't have any properties it must be converted to
use qemuBuildDeviceCommandlineFromJSON so that we can validate it in the
future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 20:54:53 +02:00