From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Proxmox Datacenter Manager development discussion"
<pdm-devel@lists.proxmox.com>,
"Stefan Hanreich" <s.hanreich@proxmox.com>
Subject: Re: [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: handle new unknown enum variants
Date: Wed, 12 Nov 2025 13:25:45 +0100 [thread overview]
Message-ID: <DE6PQO3OFOD7.1JLWFVV2YL3SW@proxmox.com> (raw)
In-Reply-To: <20251112092225.17890-6-s.hanreich@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
One comment inline.
On Wed Nov 12, 2025 at 10:22 AM CET, Stefan Hanreich wrote:
> pve-api-types now generates a fallback enum variant in order to handle
> encountering unknown values for enums more gracefully. Fix all
> occurrences of enums that have changed that lead to compiler errors.
>
> In the case of migrations an error is thrown, since it is impossible
> to tell if it is okay to proceed migrating a guest with an unknown
> state. In other cases simply log / print the unknown value.
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> server/src/metric_collection/rrd_task.rs | 4 ++++
> ui/src/pve/utils.rs | 1 +
> ui/src/widget/migrate_window.rs | 6 ++++++
> 3 files changed, 11 insertions(+)
>
> diff --git a/server/src/metric_collection/rrd_task.rs b/server/src/metric_collection/rrd_task.rs
> index 507d6b2..f48968b 100644
> --- a/server/src/metric_collection/rrd_task.rs
> +++ b/server/src/metric_collection/rrd_task.rs
> @@ -140,6 +140,10 @@ fn store_metric_pve(cache: &RrdCache, remote_name: &str, data_point: &ClusterMet
> ClusterMetricsDataType::Gauge => DataSourceType::Gauge,
> ClusterMetricsDataType::Counter => DataSourceType::Counter,
> ClusterMetricsDataType::Derive => DataSourceType::Derive,
> + ClusterMetricsDataType::UnknownEnumValue(value) => {
> + log::warn!("encountered unknown metric type: {value}");
> + return;
> + }
> };
>
At lunch, we briefly talked about whether it would be possible to store
datapoints with an unknown data type enum value in some form until PDM
is updated and is able to understand the new variant.
If we wanted to do this, we would need to store the raw datapoints,
since we cannot just dump data with an unknown type into proxmox_rrd.
I think just bailing out and logging is fine, since
- it's pretty unlikely that there will be a new enum variant here
- keeping the raw datapoints around could mean that we have to store
large amounts of data for an unknown time period
> cache.update_value(
> diff --git a/ui/src/pve/utils.rs b/ui/src/pve/utils.rs
> index 5923855..ef536da 100644
> --- a/ui/src/pve/utils.rs
> +++ b/ui/src/pve/utils.rs
> @@ -289,5 +289,6 @@ pub(crate) fn render_content_type(ty: &StorageContent) -> String {
> StorageContent::Snippets => tr!("Snippets"),
> StorageContent::Vztmpl => tr!("Container template"),
> StorageContent::None => tr!("None"),
> + StorageContent::UnknownEnumValue(value) => tr!("unknown content type ({0})", value),
> }
> }
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-11-12 12:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 9:22 [pdm-devel] [RFC proxmox{, -yew-comp, -datacenter-manager}/yew-mobile-gui 0/6] Add fallback variant to enum properties in Proxmox VE Rust API types Stefan Hanreich
2025-11-12 9:22 ` [pdm-devel] [PATCH proxmox 1/3] pve-api-types: add FixedString type Stefan Hanreich
2025-11-12 10:50 ` Wolfgang Bumiller
2025-11-12 16:39 ` Stefan Hanreich
2025-11-12 9:22 ` [pdm-devel] [PATCH proxmox 2/3] pve-api-types: generate fallback variant for enums Stefan Hanreich
2025-11-12 9:22 ` [pdm-devel] [PATCH proxmox 3/3] pve-api-types: regenerate Stefan Hanreich
2025-11-12 9:22 ` [pdm-devel] [PATCH proxmox-yew-comp 1/1] pve: qemu: handle fallback enum variants Stefan Hanreich
2025-11-12 9:22 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: handle new unknown " Stefan Hanreich
2025-11-12 12:25 ` Lukas Wagner [this message]
2025-11-12 9:22 ` [pdm-devel] [PATCH pve-yew-mobile-gui 1/1] tree-wide: handle fallback enum values Stefan Hanreich
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=DE6PQO3OFOD7.1JLWFVV2YL3SW@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
--cc=s.hanreich@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.