qemu-server/test/cfg2cmd
Dominik Csapak 3ab3dd55c4 fix #3352: templates: minimize config when starting templates
templates can only be started in context of a pbs backup, and there we
don't need or want to use most of the config, since they cannot be
started normally anyway.

We minimize the config by copying some specific relevant options (see
the comments for why the options were chosen) and all disk
configurations.

Since we change the qemu commandline for templates, we now have to adapt
the tests involving templates.

Without this, users can get into a situation where the template cannot
be backed up when there are some resources not available (such as cpu
cores, kvm, pci devices, etc.) even if the backup process does not need
them.

This change has some nice side effects, such as we don't need to
allocate the full amount of memory anymore for templates that have a
hostpci device configured, the configured bridges don't have to exist,
etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2024-07-01 10:48:27 +02:00
..
bootorder-empty.conf cfg2cmd: add tests for new boot order property 2020-10-14 12:30:50 +02:00
bootorder-empty.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
bootorder-legacy.conf cfg2cmd: add test for legacy-style bootorder 2020-10-14 12:30:50 +02:00
bootorder-legacy.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
bootorder.conf cfg2cmd: add tests for new boot order property 2020-10-14 12:30:50 +02:00
bootorder.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
cputype-icelake-client-deprecation.conf test: add qemu 7.1 default netdev rx|tx_queue_size=1024 2022-11-13 16:42:24 +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: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
memory-hotplug-hugepages.conf tests: add memory tests 2023-02-15 14:34:25 +01:00
memory-hotplug-hugepages.conf.cmd tests: add memory tests 2023-02-15 14:34:25 +01:00
memory-hotplug.conf tests: add memory tests 2023-02-15 14:34:25 +01:00
memory-hotplug.conf.cmd cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag 2023-06-07 17:35:41 +02:00
memory-hugepages-1g.conf tests: add memory tests 2023-02-15 14:34:25 +01:00
memory-hugepages-1g.conf.cmd tests: add memory tests 2023-02-15 14:34:25 +01:00
memory-hugepages-2m.conf tests: add memory tests 2023-02-15 14:34:25 +01:00
memory-hugepages-2m.conf.cmd tests: add memory tests 2023-02-15 14:34:25 +01:00
minimal-defaults-to-new-machine.conf Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01:00
minimal-defaults-unsupported-pve-version.conf Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +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 tests: cfg2cmd: add multi-q base test for 7.0 machine version 2022-11-13 16:41:41 +01:00
netdev-7.0-multiqueues.conf.cmd tests: cfg2cmd: add multi-q base test for 7.0 machine version 2022-11-13 16:41:41 +01:00
netdev-7.1-multiqueues.conf test: add qemu 7.1 multiqueue netdev test 2022-11-13 16:43:12 +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: add qemu 7.1 default netdev rx|tx_queue_size=1024 2022-11-13 16:42:24 +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 cfg2cmd: add simple MTU test 2020-06-04 11:19:13 +02:00
netdev.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
old-qemu.conf Simplify QEMU version check and require 3.0+ 2020-02-12 11:19:29 +01:00
ostype-usb13-error.conf tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +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: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02: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 tests: cfg2cmd: add a few q35 related tests 2021-11-04 15:30:30 +01:00
q35-simple-6.0.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +01:00
q35-simple-7.0.conf tests: cfg2cmd: add a few q35 related tests 2021-11-04 15:30:30 +01:00
q35-simple-7.0.conf.cmd ovmf cmd assembly: reorder arguments 2022-12-12 11:41:50 +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 tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +01:00
q35-usb2.conf.cmd tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +01:00
q35-usb3.conf tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +01:00
q35-usb3.conf.cmd tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +01:00
q35-usb13-error.conf tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +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: usb: cover more ports on checking xhci 7.1+ 2022-11-11 09:10:18 +01:00
qemu-xhci-7.1.conf.cmd cfg2cmd: netdev: fix value for tx_queue_size 2023-07-27 13:14:12 +02:00
qemu-xhci-q35-7.1.conf tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +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: add template drive read-only tests 2021-06-23 12:37:40 +02:00
simple1-template.conf.cmd fix #3352: templates: minimize config when starting templates 2024-07-01 10:48:27 +02:00
simple1.conf Simplify QEMU version check and require 3.0+ 2020-02-12 11:19:29 +01:00
simple1.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
simple-balloon-free-page-reporting.conf add test for virtio-balloon free-page-reporting=on. (qemu 6.2) 2022-04-27 11:09:04 +02:00
simple-balloon-free-page-reporting.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
simple-btrfs.conf cfg2cmd: add btrfs-store and test for cache mode 2021-06-24 18:42:55 +02:00
simple-btrfs.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
simple-virtio-blk.conf tests: add cfg2cmd test for virtio-blk disk with iothread on 2020-09-02 13:27:27 +02:00
simple-virtio-blk.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
spice-enhancments.conf cfg2cmd test: fix spice enhancement test 2019-11-25 07:45:44 +01:00
spice-enhancments.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
spice-linux-4.1.conf cfg2cmd: minor cleanup 2019-12-09 11:42:49 +01:00
spice-linux-4.1.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
spice-usb3.conf cfg2cmd: support USB 3 SPICE ports with 4.0 machine feature 2019-09-26 11:54:53 +02:00
spice-usb3.conf.cmd fix #4115: enable option to name QEMU threads after their main purpose 2022-06-17 14:25:49 +02:00
spice-win.conf cfg2cmd: add win10 spice test 2019-11-19 16:12:20 +01:00
spice-win.conf.cmd cfg2cmd: replace deprecated no-hpet option with hpet=off machine flag 2023-06-07 17:35:41 +02:00
usb13-error.conf tests: add tests for various combinations of configs for usb 2022-11-11 08:52:01 +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