From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id AD30A1FF16B for ; Thu, 6 Mar 2025 11:45:25 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E6DFA43C; Thu, 6 Mar 2025 11:45:04 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Thu, 6 Mar 2025 11:44:54 +0100 Message-Id: <20250306104459.1272297-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306104459.1272297-1-d.csapak@proxmox.com> References: <20250306104459.1272297-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 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 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 qemu-server 3/8] meta info: also add current pve-machine version 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" when we bump the pve machine version, we also want to include that info in the meta creation info. With that we can pin guests to the specific version they were created on. Signed-off-by: Dominik Csapak --- we could also give the kvm_version as parameter directly here, since we already need it... PVE/API2/Qemu.pm | 4 +++- PVE/QemuServer/MetaInfo.pm | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index dc8915a7..0249c0d0 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1207,7 +1207,9 @@ __PACKAGE__->register_method({ assert_scsi_feature_compatibility($opt, $conf, $storecfg, $param->{$opt}); } - $conf->{meta} = PVE::QemuServer::MetaInfo::new_meta_info_string(); + my $kvm_version = PVE::QemuServer::Helpers::kvm_user_version(); + my $pve_machine = PVE::QemuServer::Machine::get_pve_version($kvm_version); + $conf->{meta} = PVE::QemuServer::MetaInfo::new_meta_info_string($pve_machine); my $vollist = []; eval { diff --git a/PVE/QemuServer/MetaInfo.pm b/PVE/QemuServer/MetaInfo.pm index a8cb6c5e..78526eb2 100644 --- a/PVE/QemuServer/MetaInfo.pm +++ b/PVE/QemuServer/MetaInfo.pm @@ -20,6 +20,13 @@ our $meta_info_fmt = { pattern => '\d+(\.\d+)+', optional => 1, }, + 'creation-pve-machine' => { + type => 'integer', + description => "The PVE machine version current at the time this VM was created.", + default => 0, + minimum => 1, + optional => 1, + }, }; sub parse_meta_info { @@ -33,15 +40,18 @@ sub parse_meta_info { } sub new_meta_info_string { - my () = @_; # for now do not allow to override any value - - return PVE::JSONSchema::print_property_string( - { - 'creation-qemu' => PVE::QemuServer::Helpers::kvm_user_version(), - ctime => "". int(time()), - }, - $meta_info_fmt, - ); + my ($pve_machine) = @_; + + my $data = { + 'creation-qemu' => PVE::QemuServer::Helpers::kvm_user_version(), + ctime => "". int(time()), + }; + + if (defined($pve_machine) && $pve_machine > 0) { + $data->{'creation-pve-machine'} = $pve_machine; + } + + return PVE::JSONSchema::print_property_string($data, $meta_info_fmt); } 1; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel