[pve-devel] [PATCH qemu-server v2] implement PVE Version addition for QEMU machine
Stefan Reiter
s.reiter at proxmox.com
Mon Nov 25 16:36:15 CET 2019
On 11/25/19 4:13 PM, Thomas Lamprecht wrote:
> With our QEMU 4.1.1 package we can pass a additional internal version
> to QEMU's machine, it will be split out there and ignored, but
> returned on a QMP 'query-machines' call.
>
> This allows us to use it for increasing the granularity with which we
> can roll-out HW layout changes/additions for VMs. Until now we
> required a machine version bump, happening normally every major
> release of QEMU, with seldom, for us irrelevant, exceptions.
> This often delays rolling out a feature, which would break
> live-migration, by several months. That can now be avoided, the new
> "pve-version" component of the machine can be bumped at will, and
> thus we are much more flexible.
>
> That versions orders after the ($major, $minor) version components
> from an stable release - it can thus also be reset on the next
> release.
>
> The implementation extends the qemu-machine REGEX, remembers
> "pve-version" when doing a "query-machines" and integrates support
> into the min_version and extract_version helpers.
>
> We start out with a version of 1.
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>
> changes v1 -> v2:
> * drop an unrelated hunk mistakenly included from rebase
> * set version also when config machine is set explicitly to 'pc' or 'q35'
> * fix a missing '?' in the qemu-machine option pattern part for q35
> * fix comment and some typos
>
> PVE/QemuServer.pm | 17 ++++++++------
> PVE/QemuServer/Helpers.pm | 6 ++---
> PVE/QemuServer/Machine.pm | 27 +++++++++++++++++-----
> test/cfg2cmd/i440fx-win10-hostpci.conf.cmd | 2 +-
> test/cfg2cmd/minimal-defaults.conf.cmd | 2 +-
> test/cfg2cmd/q35-linux-hostpci.conf.cmd | 2 +-
> test/cfg2cmd/q35-win10-hostpci.conf.cmd | 2 +-
> test/cfg2cmd/spice-linux-4.1.conf.cmd | 2 +-
> 8 files changed, 39 insertions(+), 21 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 89254fb..55684b8 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -93,7 +93,7 @@ PVE::JSONSchema::register_standard_option('pve-qm-image-format', {
> PVE::JSONSchema::register_standard_option('pve-qemu-machine', {
> description => "Specifies the Qemu machine type.",
> type => 'string',
> - pattern => '(pc|pc(-i440fx)?-\d+(\.\d+)+(\.pxe)?|q35|pc-q35-\d+(\.\d+)+(\.pxe)?|virt(?:-\d+(\.\d+)+)?)',
> + pattern => '(pc|pc(-i440fx)?-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|q35|pc-q35-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|virt(?:-\d+(\.\d+)+)?(\+pve\d+)?)',
> maxLength => 40,
> optional => 1,
> });
> @@ -1875,7 +1875,7 @@ sub print_drivedevice_full {
> }
>
> # for compatibility only, we prefer scsi-hd (#2408, #2355, #2380)
> - my $version = PVE::QemuServer::Machine::extract_version($machine_type) // kvm_user_version();
> + my $version = PVE::QemuServer::Machine::extract_version($machine_type, kvm_user_version());
> if ($path =~ m/^iscsi\:\/\// &&
> !min_version($version, 4, 1)) {
> $devicetype = 'generic';
> @@ -3361,13 +3361,14 @@ my $default_machines = {
> };
>
> sub get_vm_machine {
> - my ($conf, $forcemachine, $arch) = @_;
> + my ($conf, $forcemachine, $arch, $add_pve_version) = @_;
>
> my $machine = $forcemachine || $conf->{machine};
>
> - if (!$machine) {
> + if (!$machine || $machine =~ m/^(?:pc|q35)$/) {
I think technically this would have to include 'virt' too - but that's
only used for aarch AFAICT?
Anyway,
Reviewed-by: Stefan Reiter <s.reiter at proxmox.com>
if you want :)
> [...]
More information about the pve-devel
mailing list