From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-api-types 1/2] fix PVE8 node status API call
Date: Fri, 29 Aug 2025 12:06:51 +0200 [thread overview]
Message-ID: <20250829100702.1123171-1-d.csapak@proxmox.com> (raw)
PVE9 added a new non-optional field that does not exist in 8, so for now
overwrite that specific struct with a custom one where 'available' is
optional. This makes the deserialization work again for PVE8 too
In the future we need to think about how to handle different APIs
between version in a better way.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pve-api-types/generate.pl | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index b761a88..966c4d0 100644
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -264,6 +264,35 @@ Schema2Rust::derive('NetworkInterface' => 'Clone', 'PartialEq');
api(GET => '/nodes/{node}/storage', 'list_storages', 'return-name' => 'StorageInfo');
Schema2Rust::derive('StorageInfo' => 'Clone', 'PartialEq');
+# FIXME: PVE9 introduced a new non optional property, but that does not
+# exist in PVE8, so make it optional here for older PVEs to work
+Schema2Rust::generate_struct(
+ 'NodeStatusMemory',
+ {
+ type => 'object',
+ properties => {
+ 'available' => {
+ type => 'integer',
+ description => 'The available memory in bytes.',
+ optional => 1,
+ },
+ 'free' => {
+ type => 'integer',
+ description => 'The free memory in bytes.',
+ },
+ 'total' => {
+ type => 'integer',
+ description => 'The total memory in bytes.',
+ },
+ 'used' => {
+ type => 'integer',
+ description => 'The used memory in bytes.',
+ },
+ },
+ },
+ {},
+ {},
+);
api(GET => '/nodes/{node}/status', 'node_status', 'return-name' => 'NodeStatus');
Schema2Rust::register_api_override('ClusterMetrics', '/properties/data/items', { type => "ClusterMetricsData"});
--
2.47.2
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next reply other threads:[~2025-08-29 10:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 10:06 Dominik Csapak [this message]
2025-08-29 10:06 ` [pdm-devel] [PATCH proxmox-api-types 2/2] regenerate Dominik Csapak
2025-09-01 12:26 ` [pdm-devel] applied-series: [PATCH proxmox-api-types 1/2] fix PVE8 node status API call Wolfgang Bumiller
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=20250829100702.1123171-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox