[pdm-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: handle new unknown enum variants

Lukas Wagner l.wagner at proxmox.com
Wed Nov 12 13:25:45 CET 2025


Reviewed-by: Lukas Wagner <l.wagner at 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 at 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),
>      }
>  }





More information about the pdm-devel mailing list