From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 3/8] meta info: also add current pve-machine version
Date: Thu, 6 Mar 2025 11:44:54 +0100 [thread overview]
Message-ID: <20250306104459.1272297-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250306104459.1272297-1-d.csapak@proxmox.com>
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 <d.csapak@proxmox.com>
---
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
next prev parent reply other threads:[~2025-03-06 10:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 10:44 [pve-devel] [PATCH qemu-server 0/8] disable S3/S4 power states by default Dominik Csapak
2025-03-06 10:44 ` [pve-devel] [RFC PATCH qemu-server 1/8] tests: cfg2cmd: pin QEMU version Dominik Csapak
2025-03-06 12:00 ` Fiona Ebner
2025-03-06 12:07 ` Dominik Csapak
2025-03-06 12:43 ` Fiona Ebner
2025-03-06 10:44 ` [pve-devel] [PATCH qemu-server 2/8] config to command: add one '-global' option for each flag Dominik Csapak
2025-03-06 12:13 ` Fiona Ebner
2025-03-06 12:15 ` Dominik Csapak
2025-03-06 12:55 ` Fiona Ebner
2025-03-07 9:54 ` Dominik Csapak
2025-03-07 10:00 ` Fiona Ebner
2025-03-07 10:05 ` Dominik Csapak
2025-03-07 10:14 ` Fiona Ebner
2025-03-06 10:44 ` Dominik Csapak [this message]
2025-03-06 10:44 ` [pve-devel] [PATCH qemu-server 4/8] machine: correctly select pve machine version for non pinned windows guests Dominik Csapak
2025-03-06 13:10 ` Fiona Ebner
2025-03-06 13:36 ` Dominik Csapak
2025-03-06 14:10 ` Fiona Ebner
2025-03-06 14:14 ` Fiona Ebner
2025-03-06 14:15 ` Dominik Csapak
2025-03-06 14:20 ` Fiona Ebner
2025-03-07 9:55 ` Dominik Csapak
2025-03-06 10:44 ` [pve-devel] [PATCH qemu-server 5/8] machine: incorporate pve machine version when pinning " Dominik Csapak
2025-03-06 14:32 ` Fiona Ebner
2025-03-07 9:58 ` Dominik Csapak
2025-03-07 10:06 ` Fiona Ebner
2025-03-06 10:44 ` [pve-devel] [PATCH qemu-server 6/8] machine: add S3/S4 power state properties Dominik Csapak
2025-03-06 14:52 ` Fiona Ebner
2025-03-07 10:02 ` Dominik Csapak
2025-03-07 10:10 ` Fiona Ebner
2025-03-06 10:44 ` [pve-devel] [PATCH qemu-server 7/8] machine: bump pve machine version and reverse the s3/s4 defaults Dominik Csapak
2025-03-06 15:04 ` Fiona Ebner
2025-03-06 10:44 ` [pve-devel] [PATCH qemu-server 8/8] tests: cfg2cmd: add test for windows machine pinning from meta info Dominik Csapak
2025-03-06 15:10 ` Fiona Ebner
2025-03-07 14:46 ` [pve-devel] [PATCH qemu-server 0/8] disable S3/S4 power states by default Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250306104459.1272297-4-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.