From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C5FA41FF183 for ; Wed, 16 Jul 2025 12:02:23 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A719AC104; Wed, 16 Jul 2025 12:03:27 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Wed, 16 Jul 2025 12:03:13 +0200 Message-ID: <20250716100320.50736-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager] pve8to9: add check for to-be-dropped QEMU machine versions X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Fiona Ebner --- PVE/CLI/pve8to9.pm | 132 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm index 91b50cd9..eb6d67e5 100644 --- a/PVE/CLI/pve8to9.pm +++ b/PVE/CLI/pve8to9.pm @@ -26,6 +26,7 @@ use PVE::Storage::Plugin; use PVE::Tools qw(run_command split_list file_get_contents trim); use PVE::QemuConfig; use PVE::QemuServer; +use PVE::QemuServer::Machine; use PVE::VZDump::Common; use PVE::LXC; use PVE::LXC::Config; @@ -797,6 +798,135 @@ sub check_custom_pool_roles { } } +my sub check_qemu_machine_versions { + log_info("Checking VM configurations for outdated machine versions"); + + # QEMU 11.2 is expected to be the last release in Proxmox VE 9, so machine version 6.0 is the + # smallest that is supported until the end of the Proxmox VE 9 release cycle. + my @baseline = (6, 0); + + my $old_configured = []; + my $old_hibernated = []; + my $old_online_snapshot = {}; + my $old_offline_snapshot = {}; + + my $vms = PVE::QemuServer::config_list(); + for my $vmid (sort { $a <=> $b } keys $vms->%*) { + my $conf = PVE::QemuConfig->load_config($vmid); + + # first, actually configured machine version + my $machine_type = PVE::QemuServer::Machine::get_vm_machine($conf, undef, $conf->{arch}); + if ( + PVE::QemuServer::Machine::extract_version($machine_type) # no version means latest + && !PVE::QemuServer::Machine::is_machine_version_at_least($machine_type, @baseline) + ) { + push $old_configured->@*, $vmid; + } + + # second, if hibernated, running machine version + if ($conf->{vmstate}) { + my $machine_type = PVE::QemuServer::Machine::get_vm_machine( + $conf, + $conf->{runningmachine}, + $conf->{arch}, + ); + if ( + PVE::QemuServer::Machine::extract_version($machine_type) # no version means latest + && !PVE::QemuServer::Machine::is_machine_version_at_least( + $machine_type, @baseline, + ) + ) { + push $old_hibernated->@*, $vmid; + } + } + + # third, snapshots using old machine versions + if (defined($conf->{snapshots})) { + for my $snap (keys $conf->{snapshots}->%*) { + my $snap_conf = $conf->{snapshots}->{$snap}; + + my $machine_type = PVE::QemuServer::Machine::get_vm_machine( + $snap_conf, + $snap_conf->{runningmachine}, + $snap_conf->{arch}, + ); + if ( # no version means latest + PVE::QemuServer::Machine::extract_version($machine_type) + && !PVE::QemuServer::Machine::is_machine_version_at_least( + $machine_type, @baseline, + ) + ) { + if ($snap_conf->{vmstate}) { + push $old_online_snapshot->{$vmid}->@*, $snap; + } else { + push $old_offline_snapshot->{$vmid}->@*, $snap; + } + } + } + } + } + + if ( + !scalar($old_configured->@*) + && !scalar($old_hibernated->@*) + && !scalar(keys $old_offline_snapshot->%*) + && !scalar(keys $old_online_snapshot->%*) + ) { + log_pass("All VM machine versions are recent enough"); + return; + } + + my $basline_txt = join('.', @baseline); + my $next_pve_major = ($min_pve_major + 1); + + log_notice( + "QEMU machine versions older than $basline_txt are expected to be dropped during the" + . " Proxmox VE $next_pve_major release life cycle. For more information, see" + . " https://pve.proxmox.com/pve-docs/chapter-qm.html#qm_machine_type" + . " and https://pve.proxmox.com/wiki/QEMU_Machine_Version_Upgrade"); + + if (scalar($old_configured->@*)) { + my $vmid_list_txt = join(',', $old_configured->@*); + log_warn( + "VMs with the following IDs have an old machine version configured. The machine version" + . " might need to be updated to be able to start the VM in Proxmox VE" + . " $next_pve_major: $vmid_list_txt"); + } + + if (scalar($old_hibernated->@*)) { + my $vmid_list_txt = join(',', $old_hibernated->@*); + log_warn( + "VMs with the following IDs are hibernated with an old machine version and it might not" + . " be possible to resume them in Proxmox VE $next_pve_major: $vmid_list_txt"); + } + + if (scalar(keys $old_online_snapshot->%*)) { + my $vmid_txts = []; + for my $vmid (sort keys $old_online_snapshot->%*) { + my $snapshot_list_txt = join(',', $old_online_snapshot->{$vmid}->@*); + push $vmid_txts->@*, "$vmid: $snapshot_list_txt"; + } + my $vmid_list_txt = join("; ", $vmid_txts->@*); + log_warn( + "VMs with the following IDs have live snapshots with an old machine version and it" + . " might not be possible to rollback to these snapshots in Proxmox VE" + . " $next_pve_major: $vmid_list_txt"); + } + + if (scalar(keys $old_offline_snapshot->%*)) { + my $vmid_txts = []; + for my $vmid (sort keys $old_offline_snapshot->%*) { + my $snapshot_list_txt = join(',', $old_offline_snapshot->{$vmid}->@*); + push $vmid_txts->@*, "$vmid: $snapshot_list_txt"; + } + my $vmid_list_txt = join("; ", $vmid_txts->@*); + log_warn( + "VMs with the following IDs have snapshots with an old machine version configured." + . " The machine version might need to be updated after rollback to be able to start" + . " the VM in Proxmox VE $next_pve_major: $vmid_list_txt"); + } +} + my sub check_max_length { my ($raw, $max_length, $warning) = @_; log_warn($warning) if defined($raw) && length($raw) > $max_length; @@ -864,6 +994,8 @@ sub check_node_and_guest_configurations { } else { log_pass("No legacy 'lxc.cgroup' keys found."); } + + check_qemu_machine_versions(); } sub check_storage_content { -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel