all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api
@ 2025-12-01 15:00 Dominik Csapak
  2025-12-01 15:00 ` [pdm-devel] [PATCH proxmox 2/2] fix #7080: pve-api-types: mark 'has-dbus-vmstate' optional Dominik Csapak
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-12-01 15:00 UTC (permalink / raw)
  To: pdm-devel

this can be useful to manually modify some parts of the return schema

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pve-api-types/generator-lib/Schema2Rust.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
index fe3c4ff1..208b0596 100644
--- a/pve-api-types/generator-lib/Schema2Rust.pm
+++ b/pve-api-types/generator-lib/Schema2Rust.pm
@@ -1881,6 +1881,14 @@ sub api : prototype($$$;%) {
     create_method($api_url, $method, $rust_method_name, %extra);
 }
 
+# Get the return schema of a method to manipulate it.
+sub get_return_type : prototype($$) {
+    my ($method, $api_url) = @_;
+
+    (undef, $method) = walk_api($method, $api_url);
+    return $method->{returns};
+}
+
 # Fills $ALL_PATHS recursively from an api node.
 my sub collect_paths : prototype($$);
 sub collect_paths : prototype($$) {
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pdm-devel] [PATCH proxmox 2/2] fix #7080: pve-api-types: mark 'has-dbus-vmstate' optional
  2025-12-01 15:00 [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
@ 2025-12-01 15:00 ` Dominik Csapak
  2025-12-01 15:02 ` [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
  2025-12-01 23:10 ` [pdm-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-12-01 15:00 UTC (permalink / raw)
  To: pdm-devel

this was introduced in PVE9. Since PVE8 does not return this at all,
de-serialization fails on PDM. To work around this, mark it as optional
in the api type so de-serialization works again. (We currently don't use
this value in PDM anyway)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pve-api-types/generate.pl            | 4 ++++
 pve-api-types/src/generated/types.rs | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index f72a776a..e92f776d 100755
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -244,6 +244,10 @@ api(PUT => '/nodes/{node}/qemu/{vmid}/resize', 'qemu_resize', 'param-name' => 'Q
 api(POST => '/nodes/{node}/qemu/{vmid}/status/start',    'start_qemu_async',    'output-type' => 'PveUpid', 'param-name' => 'StartQemu');
 api(POST => '/nodes/{node}/qemu/{vmid}/status/stop',     'stop_qemu_async',     'output-type' => 'PveUpid', 'param-name' => 'StopQemu');
 api(POST => '/nodes/{node}/qemu/{vmid}/status/shutdown', 'shutdown_qemu_async', 'output-type' => 'PveUpid', 'param-name' => 'ShutdownQemu');
+
+# PVE9 introduced a non-optional return value, mark it optional manually so we can still use it with PVE8
+my $r = (Schema2Rust::get_return_type(GET => '/nodes/{node}/qemu/{vmid}/migrate'))->{properties};
+$r->{'has-dbus-vmstate'}->{optional} = '1';
 api(GET => '/nodes/{node}/qemu/{vmid}/migrate',           'qemu_migrate_preconditions', 'return-name' => 'QemuMigratePreconditions');
 Schema2Rust::derive('QemuMigratePreconditionsNotAllowedNodesBlockingHaResources' => 'Clone', 'PartialEq');
 Schema2Rust::derive('QemuMigratePreconditionsNotAllowedNodes' => 'Clone', 'PartialEq');
diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs
index 01c7f0cd..557f90f7 100644
--- a/pve-api-types/src/generated/types.rs
+++ b/pve-api-types/src/generated/types.rs
@@ -13047,6 +13047,7 @@ serde_plain::derive_fromstr_from_deserialize!(QemuConfigVirtiofsCache);
         },
         "has-dbus-vmstate": {
             default: false,
+            optional: true,
         },
         local_disks: {
             items: {
@@ -13098,8 +13099,9 @@ pub struct QemuMigratePreconditions {
     /// Whether the VM host supports migrating additional VM state, such as
     /// conntrack entries.
     #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
     #[serde(rename = "has-dbus-vmstate")]
-    pub has_dbus_vmstate: bool,
+    pub has_dbus_vmstate: Option<bool>,
 
     /// List local disks including CD-Rom, unused and not referenced disks
     pub local_disks: Vec<QemuMigratePreconditionsLocalDisks>,
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api
  2025-12-01 15:00 [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
  2025-12-01 15:00 ` [pdm-devel] [PATCH proxmox 2/2] fix #7080: pve-api-types: mark 'has-dbus-vmstate' optional Dominik Csapak
@ 2025-12-01 15:02 ` Dominik Csapak
  2025-12-01 23:10 ` [pdm-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-12-01 15:02 UTC (permalink / raw)
  To: pdm-devel

forgot to append a trailer:

Originally-by: Wolfgang Bumiller <w.bumiller@proxmox.com>

On 12/1/25 4:00 PM, Dominik Csapak wrote:
> this can be useful to manually modify some parts of the return schema
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>   pve-api-types/generator-lib/Schema2Rust.pm | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
> index fe3c4ff1..208b0596 100644
> --- a/pve-api-types/generator-lib/Schema2Rust.pm
> +++ b/pve-api-types/generator-lib/Schema2Rust.pm
> @@ -1881,6 +1881,14 @@ sub api : prototype($$$;%) {
>       create_method($api_url, $method, $rust_method_name, %extra);
>   }
>   
> +# Get the return schema of a method to manipulate it.
> +sub get_return_type : prototype($$) {
> +    my ($method, $api_url) = @_;
> +
> +    (undef, $method) = walk_api($method, $api_url);
> +    return $method->{returns};
> +}
> +
>   # Fills $ALL_PATHS recursively from an api node.
>   my sub collect_paths : prototype($$);
>   sub collect_paths : prototype($$) {



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pdm-devel] applied: [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api
  2025-12-01 15:00 [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
  2025-12-01 15:00 ` [pdm-devel] [PATCH proxmox 2/2] fix #7080: pve-api-types: mark 'has-dbus-vmstate' optional Dominik Csapak
  2025-12-01 15:02 ` [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
@ 2025-12-01 23:10 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-12-01 23:10 UTC (permalink / raw)
  To: pdm-devel, Dominik Csapak

On Mon, 01 Dec 2025 16:00:13 +0100, Dominik Csapak wrote:
> this can be useful to manually modify some parts of the return schema
> 
> 

Applied, thanks!

[1/2] pve-api-types: generator lib: add method to get return schema of api
      commit: 5a4335a943a02ed944a80a81926796d695857f44
[2/2] fix #7080: pve-api-types: mark 'has-dbus-vmstate' optional
      commit: ed357145ac7c6524a2655d861ac7de8dd48916f7


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-01 23:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-01 15:00 [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
2025-12-01 15:00 ` [pdm-devel] [PATCH proxmox 2/2] fix #7080: pve-api-types: mark 'has-dbus-vmstate' optional Dominik Csapak
2025-12-01 15:02 ` [pdm-devel] [PATCH proxmox 1/2] pve-api-types: generator lib: add method to get return schema of api Dominik Csapak
2025-12-01 23:10 ` [pdm-devel] applied: " Thomas Lamprecht

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal