From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 464431FF179 for ; Wed, 12 Nov 2025 10:21:47 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 49B5A1B99E; Wed, 12 Nov 2025 10:22:33 +0100 (CET) From: Stefan Hanreich To: pdm-devel@lists.proxmox.com Date: Wed, 12 Nov 2025 10:22:09 +0100 Message-ID: <20251112092225.17890-6-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251112092225.17890-1-s.hanreich@proxmox.com> References: <20251112092225.17890-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.173 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: handle new unknown enum variants X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 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 --- 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; + } }; 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), } } diff --git a/ui/src/widget/migrate_window.rs b/ui/src/widget/migrate_window.rs index cb12a15..5fe7278 100644 --- a/ui/src/widget/migrate_window.rs +++ b/ui/src/widget/migrate_window.rs @@ -122,6 +122,9 @@ impl PdmMigrateWindow { match status.status { pdm_client::types::IsRunning::Running => tr!("Online"), pdm_client::types::IsRunning::Stopped => tr!("Offline"), + pdm_client::types::IsRunning::UnknownEnumValue(value) => { + bail!("encountered unknown guest status: {value}") + } } } crate::pve::GuestType::Lxc => { @@ -131,6 +134,9 @@ impl PdmMigrateWindow { match status.status { pdm_client::types::IsRunning::Running => tr!("Restart"), pdm_client::types::IsRunning::Stopped => tr!("Offline"), + pdm_client::types::IsRunning::UnknownEnumValue(value) => { + bail!("encountered unknown guest status: {value}") + } } } }; -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel