]> git.proxmox.com Git - qemu-server.git/commit
Use 'QEMU version' -> '+pve-version' mapping for machine types
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 10 Feb 2020 15:05:35 +0000 (16:05 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 12 Feb 2020 09:32:57 +0000 (10:32 +0100)
commitac0077cc3389e7544fe496b11716f72f5a26887e
treec0fee9fbe444f80770841ddc89a216331c800d03
parent8541f8cddb17c0c3e594c4cafb81d998ee13ab83
Use 'QEMU version' -> '+pve-version' mapping for machine types

The previously introduced approach can fail for pinned versions when a
new QEMU release is introduced. The saner approach is to use a mapping
that gives one pve-version for each QEMU release.

Fortunately, the old system has not been bumped yet, so we can still
change it without too much effort.

QEMU versions without a mapping are assumed to be pve0, 4.1 is mapped to
pve1 since thats what we had as our default previously.

Pinned machine versions (i.e. pc-i440fx-4.1) are always assumed to be
pve0, for specific pve-versions they'd have to be pinned as well (i.e.
pc-i440fx-4.1+pve1).

The new logic also makes the pve-version dynamic, and starts VMs with
the lowest possible 'feature-level', i.e. if a feature is only available
with 4.1+pve2, but the VM isn't using it, we still start it with
4.1+pve0.

We die if we don't support a version that is requested from us. This
allows us to use the pve-version as live-migration blocks (i.e. bumping
the version and then live-migrating a VM which uses the new feature (so
is running with the bumped version) to an outdated node will present the
user with a helpful error message and fail instead of silently modifying
the config and only failing *after* the migration).

$version_guard is introduced in config_to_command to use for features
that need to check pve-version, it automatically handles selecting the
newest necessary pve-version for the VM.

Tests have to be adjusted, since all of them now resolve to pve0 instead
of pve1. EXPECT_ERROR matching is changed to use 'eq' instead of regex
to allow special characters in error messages.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
12 files changed:
PVE/QemuServer.pm
PVE/QemuServer/Machine.pm
test/cfg2cmd/i440fx-win10-hostpci.conf.cmd
test/cfg2cmd/minimal-defaults-to-new-machine.conf
test/cfg2cmd/minimal-defaults-unsupported-pve-version.conf [new file with mode: 0644]
test/cfg2cmd/minimal-defaults.conf.cmd
test/cfg2cmd/pinned-version.conf.cmd
test/cfg2cmd/q35-linux-hostpci-multifunction.conf.cmd
test/cfg2cmd/q35-linux-hostpci.conf.cmd
test/cfg2cmd/q35-win10-hostpci.conf.cmd
test/cfg2cmd/spice-linux-4.1.conf.cmd
test/run_config2command_tests.pl