qemu-server/test/cfg2cmd
Dominik Csapak 818ce80ec1 fix efidisks on storages with minimum sizes bigger than OVMF_VARS.fd
on storages where the minimum size of images is bigger than the real
OVMF_VARS.fd file, they get padded to their minimum size

when using such an image, qemu maps it fully to the vm, but the efi
does not find the vars region and creates a file on the first efi
partition it finds

this breaks some settings in the ovmf, such as resolution

to fix this, we have to specify the size for the pflash, so that
qemu only maps the first n bytes in the vm (this only works for
raw files, not for qcow2)

we also have to use the correct size when converting between storages
in 'clone_disk' (used for move disk and cloning vms) and when
live migrating to different storages

when we now expect that the source image is always correctly used/created
(e.g. raw with size=x in pflash argument) then we always create the
target correctly

when encountering users which have a non-valid image (e.g. a efidisk
moved from zfs to qcow2 before this patch), we have to tell them to
recreate the efidisk and the settings on it

we have to version_guard it to 4.1+pve2 (since we haven't bumped yet
since the change to pve2)

also add 2 tests, one for the old version and one for the new

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Stefan Reiter <s.reiter@proxmox.com>
Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
[ Thomas: rebased to master ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-30 09:41:55 +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 fix efidisks on storages with minimum sizes bigger than OVMF_VARS.fd 2020-03-30 09:41:55 +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 fix efidisks on storages with minimum sizes bigger than OVMF_VARS.fd 2020-03-30 09:41:55 +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 Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +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 Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01:00
old-qemu.conf Simplify QEMU version check and require 3.0+ 2020-02-12 11:19:29 +01:00
pinned-version.conf refactor: split qemu_machine_feature_enabled 2019-11-20 18:32:35 +01:00
pinned-version.conf.cmd Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01: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 Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01:00
q35-linux-hostpci.conf cfg2cmd: fix descriptions of cfg2cmd test cases 2019-10-02 08:35:27 +02:00
q35-linux-hostpci.conf.cmd Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01: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 Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01:00
README.adoc add config to command tests 2018-12-11 10:44:04 +01:00
simple1.conf Simplify QEMU version check and require 3.0+ 2020-02-12 11:19:29 +01:00
simple1.conf.cmd drop vnc x509 param, deprecated in 2.5 removed in 4.0 2019-06-06 09:52:44 +02:00
spice-enhancments.conf cfg2cmd test: fix spice enhancement test 2019-11-25 07:45:44 +01:00
spice-enhancments.conf.cmd test cfg2cmd: add spice enhancement test 2019-10-09 16:51:03 +02:00
spice-linux-4.1.conf cfg2cmd: minor cleanup 2019-12-09 11:42:49 +01:00
spice-linux-4.1.conf.cmd Use 'QEMU version' -> '+pve-version' mapping for machine types 2020-02-12 10:32:57 +01: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 followup: adding qxl max_outputs breaks live-migration/restore 2019-11-20 15:33:48 +01:00
spice-win.conf cfg2cmd: add win10 spice test 2019-11-19 16:12:20 +01:00
spice-win.conf.cmd cfg2cmd: add win10 spice test 2019-11-19 16:12:20 +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