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 80AF41FF15C for ; Fri, 11 Jul 2025 11:40:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0A88EC947; Fri, 11 Jul 2025 11:41:30 +0200 (CEST) Date: Fri, 11 Jul 2025 11:40:56 +0200 From: Gabriel Goller To: Wolfgang Bumiller Message-ID: Mail-Followup-To: Wolfgang Bumiller , pve-devel@lists.proxmox.com References: <20250702145101.894299-1-g.goller@proxmox.com> <20250702145101.894299-25-g.goller@proxmox.com> <2ngeb6fvpt5nbffuh4gmwpml47s3pdjluh37uhxtp4h3vsgb5p@uqtctzp2idyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2ngeb6fvpt5nbffuh4gmwpml47s3pdjluh37uhxtp4h3vsgb5p@uqtctzp2idyz> User-Agent: NeoMutt/20241002-35-39f9a6 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.015 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Subject: Re: [pve-devel] [PATCH proxmox-ve-rs v4 18/22] common: sdn: fabrics: implement validation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: pve-devel@lists.proxmox.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" >> [snip] >> diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs >> index 3342a7053d3f..a2132e8aff3f 100644 >> --- a/proxmox-ve-config/src/sdn/fabric/mod.rs >> +++ b/proxmox-ve-config/src/sdn/fabric/mod.rs >> @@ -1,11 +1,13 @@ >> pub mod section_config; >> >> -use std::collections::BTreeMap; >> +use std::collections::{BTreeMap, HashSet}; >> use std::marker::PhantomData; >> use std::ops::Deref; >> >> use serde::{Deserialize, Serialize}; >> >> +use crate::common::valid::Validatable; >> + >> use crate::sdn::fabric::section_config::{ >> fabric::{ >> Fabric, FabricDeletableProperties, FabricId, FabricSection, FabricSectionUpdater, >> @@ -34,15 +36,38 @@ pub enum FabricConfigError { >> FabricDoesNotExist(String), >> #[error("node '{0}' does not exist in fabric '{1}'")] >> NodeDoesNotExist(String, String), >> + #[error("node IP {0} is outside the IP prefix {1} of the fabric")] >> + NodeIpOutsideFabricRange(String, String), >> #[error("node has a different protocol than the referenced fabric")] >> ProtocolMismatch, >> #[error("fabric '{0}' already exists in config")] >> DuplicateFabric(String), >> #[error("node '{0}' already exists in config for fabric {1}")] >> DuplicateNode(String, String), >> + #[error("fabric {0} contains nodes with duplicated IPs")] >> + DuplicateNodeIp(String), >> + #[error("fabric '{0}' does not have an IP prefix configured for the node IP {1}")] >> + FabricNoIpPrefixForNode(String, String), >> + #[error("node '{0}' does not have an IP configured for this fabric prefix {1}")] >> + NodeNoIpForFabricPrefix(String, String), >> + #[error("fabric '{0}' does not have an IP prefix configured")] >> + FabricNoIpPrefix(String), >> + #[error("node '{0}' does not have an IP configured")] >> + NodeNoIp(String), >> + #[error("interface is already in use by another fabric")] >> + DuplicateInterface, >> + #[error("IPv6 is currently not supported for protocol {0}")] >> + NoIpv6(String), > >^ "NoIpv6" is a weird variant name for this. Maybe use Ipv6Unsupported. Agree, changed it. >I also wonder if we really need all those messages as separate variants. >As a followup to the previous thoughts on error types: Generally I think >only errors which are worth distinguishing need their own variants. We >definitely don't need one for every single message. IMO what we could do is split it up in multiple enums and have a sort of tree structure at the end. >The ones here could probably all just be a single `Invalid(String)`. >(Or if we don't want to expose `String` here, >`Validation(ValidationError)`, with the inner one being a newtype >wrapper around the `String`. Hmm but then why create custom error types at all? This is the same as having strings where we can't distinguish between errors. >Internally there can be a helper >`fn FabricConfigError::validation(impl Into)`. >> // should usually not occur, but we still check for it nonetheless >> #[error("mismatched fabric_id")] >> FabricIdMismatch, >> + // this is technically possible, but we don't allow it >> + #[error("duplicate OSPF area")] >> + DuplicateOspfArea, >> + #[error("IP prefix {0} in fabric '{1}' overlaps with IPv4 prefix {2} in fabric '{3}'")] >> + OverlappingIp4Prefix(String, String, String, String), >> + #[error("IPv6 prefix {0} in fabric '{1}' overlaps with IPv6 prefix {2} in fabric '{3}'")] >> + OverlappingIp6Prefix(String, String, String, String), >> } >> >> /// An entry in a [`FabricConfig`]. >> @@ -367,6 +392,93 @@ impl From for FabricEntry { >> } >> } >> [snip] Thanks! _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel