5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-03 01:17:58 +03:00
qemu-server/test/cfg2cmd
Fiona Ebner 9f887d3738 cfg2cmd: print drive commandline: improve format detection
For a Proxmox VE managed volume, prefer the format from the storage
layer rather than the 'format' option set on the drive. Fail if there
is a mismatch between the detected and configured format, because this
is not expected for managed volumes. Having this early hard failure
protects against undesirable issues with live migration and reboot
where the format of a drive would suddenly be different.

For a not Proxmox VE managed volume, use the same logic as before,
i.e. use the 'format' option for the drive with 'raw' as a fallback:
Only root can configure such devices.

Both also apply to the case where the 'cdrom' flag is set to avoid
autodetection by QEMU.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
FG: typo fix in comment
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-12-09 09:07:08 +01:00
..
bootorder-empty.conf test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
bootorder-empty.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
bootorder-legacy.conf test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
bootorder-legacy.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
bootorder.conf test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
bootorder.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
cputype-icelake-client-deprecation.conf cfg2cmd tests: various typo fixes 2024-12-05 12:20:54 +01:00
cputype-icelake-client-deprecation.conf.cmd test: add qemu 7.1 default netdev rx|tx_queue_size=1024 2022-11-13 16:42:24 +01:00
custom-cpu-model-defaults.conf cfg2cmd: add test cases for custom CPU models 2020-04-07 17:27:58 +02:00
custom-cpu-model-defaults.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
custom-cpu-model-host-phys-bits.conf tests: cfg2cmd: check also warnings 2020-08-21 10:38:27 +02:00
custom-cpu-model-host-phys-bits.conf.cmd cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag 2023-06-07 17:35:41 +02:00
custom-cpu-model.conf tests: cfg2cmd: check also warnings 2020-08-21 10:38:27 +02:00
custom-cpu-model.conf.cmd cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag 2023-06-07 17:35:41 +02:00
efi-raw-old.conf fix efidisks on storages with minimum sizes bigger than OVMF_VARS.fd 2020-03-30 09:41:55 +02:00
efi-raw-old.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +01:00
efi-raw-template.conf test: add template drive read-only tests 2021-06-23 12:37:40 +02:00
efi-raw-template.conf.cmd fix #3352: templates: minimize config when starting templates 2024-07-01 10:48:27 +02:00
efi-raw.conf fix efidisks on storages with minimum sizes bigger than OVMF_VARS.fd 2020-03-30 09:41:55 +02:00
efi-raw.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +01:00
efi-secboot-and-tpm-q35.conf use non SMM ovmf code file for i440fx machines 2021-10-21 12:38:58 +02:00
efi-secboot-and-tpm-q35.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +01:00
efi-secboot-and-tpm.conf use non SMM ovmf code file for i440fx machines 2021-10-21 12:38:58 +02:00
efi-secboot-and-tpm.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +01:00
efidisk-on-rbd.conf cfg2cmd: add test for efidisk rbd cache handling 2021-06-16 15:24:57 +02:00
efidisk-on-rbd.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
i440fx-viommu-intel.conf fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
i440fx-viommu-virtio.conf fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
i440fx-viommu-virtio.conf.cmd fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
i440fx-win10-hostpci.conf cfg2cmd: fix descriptions of cfg2cmd test cases 2019-10-02 08:35:27 +02:00
i440fx-win10-hostpci.conf.cmd cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag 2023-06-07 17:35:41 +02:00
ide.conf test: add tests with multiple IDE CD-ROM drives 2023-07-20 12:20:25 +02:00
ide.conf.cmd cfg2cmd: print drive commandline: improve format detection 2024-12-09 09:07:08 +01:00
memory-hotplug-hugepages.conf test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
memory-hotplug-hugepages.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
memory-hotplug.conf test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
memory-hotplug.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
memory-hugepages-1g.conf cfg2cmd tests: various typo fixes 2024-12-05 12:20:54 +01:00
memory-hugepages-1g.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
memory-hugepages-2m.conf cfg2cmd tests: various typo fixes 2024-12-05 12:20:54 +01:00
memory-hugepages-2m.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
minimal-defaults-to-new-machine.conf cfg2cmd tests: various typo fixes 2024-12-05 12:20:54 +01:00
minimal-defaults-unsupported-pve-version.conf cfg2cmd tests: various typo fixes 2024-12-05 12:20:54 +01:00
minimal-defaults.conf add config to command tests 2018-12-11 10:44:04 +01:00
minimal-defaults.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
netdev-7.0-multiqueues.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
netdev-7.0-multiqueues.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
netdev-7.1-multiqueues.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
netdev-7.1-multiqueues.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
netdev-7.1.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
netdev-7.1.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
netdev.conf test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
netdev.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
old-qemu.conf cfg2cmd: require at least QEMU binary version 5.0 2024-12-05 12:13:20 +01:00
ostype-usb13-error.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
pinned-version-pxe-pve.conf cfg2cmd: fix +pveN machine types with pxe 2021-04-18 17:58:56 +02:00
pinned-version-pxe-pve.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
pinned-version-pxe.conf cfg2cmd: fix +pveN machine types with pxe 2021-04-18 17:58:56 +02:00
pinned-version-pxe.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
pinned-version.conf refactor: split qemu_machine_feature_enabled 2019-11-20 18:32:35 +01:00
pinned-version.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
q35-ide.conf test: add tests with multiple IDE CD-ROM drives 2023-07-20 12:20:25 +02:00
q35-ide.conf.cmd cfg2cmd: print drive commandline: improve format detection 2024-12-09 09:07:08 +01:00
q35-linux-hostpci-mapping.conf add test for mapped pci devices 2023-06-19 07:21:49 +02:00
q35-linux-hostpci-mapping.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
q35-linux-hostpci-multifunction.conf cfg2cmd test: add tests for multifunction devices 2019-12-09 11:30:14 +01:00
q35-linux-hostpci-multifunction.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
q35-linux-hostpci-template.conf tests: cfg2cmd: add test for templates with more options 2024-07-01 10:48:27 +02:00
q35-linux-hostpci-template.conf.cmd fix #3352: templates: minimize config when starting templates 2024-07-01 10:48:27 +02:00
q35-linux-hostpci-x-pci-overrides.conf pci: allow override of PCI vendor/device ids 2022-01-25 10:59:23 +01:00
q35-linux-hostpci-x-pci-overrides.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
q35-linux-hostpci.conf enable cluster mapped PCI devices for guests 2023-06-16 16:24:02 +02:00
q35-linux-hostpci.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
q35-simple-6.0.conf test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests 2024-12-05 12:13:20 +01:00
q35-simple-6.0.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests 2024-12-05 12:13:20 +01:00
q35-simple-7.0.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
q35-simple-7.0.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
q35-simple-pinned-6.1.conf tests: cfg2cmd: add a few q35 related tests 2021-11-04 15:30:30 +01:00
q35-simple-pinned-6.1.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +01:00
q35-simple.conf tests: cfg2cmd: add a few q35 related tests 2021-11-04 15:30:30 +01:00
q35-simple.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
q35-usb2.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
q35-usb2.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
q35-usb3.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
q35-usb3.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
q35-usb13-error.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
q35-viommu-intel.conf fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
q35-viommu-intel.conf.cmd fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
q35-viommu-virtio.conf fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
q35-viommu-virtio.conf.cmd fix #3784: config: Parameter for guest vIOMMU + test-cases 2024-04-11 16:40:17 +02:00
q35-win10-hostpci.conf cfg2cmd test: hostpci, also specify exact PCIe devices 2019-09-09 08:40:07 +02:00
q35-win10-hostpci.conf.cmd cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag 2023-06-07 17:35:41 +02:00
qemu-xhci-7.1.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
qemu-xhci-7.1.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
qemu-xhci-q35-7.1.conf test: cfg2cmd: don't use QEMU binary version less than 8.0 for tests 2024-12-05 12:13:20 +01:00
qemu-xhci-q35-7.1.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
README.adoc add config to command tests 2018-12-11 10:44:04 +01:00
seabios_serial.conf cfg2cmd: turn smm off when SeaBIOS and serial display are used 2021-11-11 10:32:17 +01:00
seabios_serial.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
simple1-template.conf test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
simple1-template.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
simple1.conf test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
simple1.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 4.0 for tests 2024-12-05 12:13:20 +01:00
simple-balloon-free-page-reporting.conf test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests 2024-12-05 12:13:20 +01:00
simple-balloon-free-page-reporting.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests 2024-12-05 12:13:20 +01:00
simple-btrfs.conf test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests 2024-12-05 12:13:20 +01:00
simple-btrfs.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 7.0 for tests 2024-12-05 12:13:20 +01:00
simple-virtio-blk.conf test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
simple-virtio-blk.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 6.0 for tests 2024-12-05 12:13:20 +01:00
spice-enhancments.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-enhancments.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-linux-4.1.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-linux-4.1.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-usb3.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-usb3.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-win.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
spice-win.conf.cmd test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
usb13-error.conf test: cfg2cmd: don't use QEMU binary version less than 5.0 for tests 2024-12-05 12:13:20 +01:00
vnc-clipboard-spice.conf tests: cfg2cmd: rename vnc-clipboard to lower-case and add description 2023-11-20 16:36:51 +01:00
vnc-clipboard-spice.conf.cmd tests: cfg2cmd: rename vnc-clipboard to lower-case and add description 2023-11-20 16:36:51 +01:00
vnc-clipboard-std.conf tests: cfg2cmd: rename vnc-clipboard to lower-case and add description 2023-11-20 16:36:51 +01:00
vnc-clipboard-std.conf.cmd tests: cfg2cmd: rename vnc-clipboard to lower-case and add description 2023-11-20 16:36:51 +01:00

QemuServer Config 2 Command Test
================================
Thomas Lamprecht <t.lamprecht@proxmox.com>

Overview
--------

This is a relatively simple configuration to command test program.
It's main goals are to better enforce stability of commands, thus reducing
the likelihood that, for example, a migration breaking change which forgot to
bump/check the KVM/QEMU version, slips through

Further you get a certain regression and functional test coverage. You get a
safety net against breaking older or not often (manual) tested setups and
features.

NOTE: The safety net is only as good as the test count *and* quality.


Test Specification
------------------

A single test consists of two files, the input VM config `FILE.conf` and the
expected output command `FILE.conf.cmd`

Input
~~~~~

The `FILE.conf` are standard Proxmox VE VM configuration files, so you can just
copy over a config file from `/etc/pve/qemu-server` to add a configuration you
want to have tested.

Output
~~~~~~

For the expected output `FILE.conf.cmd` we check the KVM/QEMU command produced.
As a single long line would be pretty hard to check for (problematic) changes
by humans, we use a pretty format, i.e., where each key value pair is on it's
own line. With this approach we can just diff expected and actual command and
one can pin point pretty fast in which component (e.g., net, drives, CPU, ...)
the issue is, if any. Such an output would look like:

----
/usr/bin/kvm \
  -id 101 \
  -name vm101 \
  ...
----

TIP: If the expected output file does not exist we have nothing to check, but
for convenience we will write it out. This should happen from clean code, and
the result should not get applied blindly, but only after a (quick) sanity
check.


Environment
~~~~~~~~~~~

It makes sense to have a stable and controlled environment for tests, thus you
one can use the 'description' in VM configurations to control this. The
description consists of all lines beginning with a '#' as first non-whitespace
character. Any environment variable follows the following format:

----
# NAME: VALUE
... rest of config...
----

There are the following variables you can control:

* *TEST*: a one line description for your test, gets outputted one testing and
  should described in a short way any specialty about this specific test,
  i.e., what does this test wants to ensure.

* *QEMU_VERSION*: the version we fake for this test, if not set we use the
  actual one installed on the host.

* *HOST_ARCH*: the architecture we should fake for the test (aarch64 or x86_64),
  defaults to `x86_64` to allow making this optional and still guarantee
  stable tests

The storage environment is currently hardcoded in the test code, you can
extend it there if it's needed.

// vim: noai:tw=78