public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH proxmox-ve-rs 03/11] add intermediate fabric representation
Date: Wed, 5 Mar 2025 10:09:04 +0100	[thread overview]
Message-ID: <zwcxsoezitj3efggrcdrg3yb4l4kat6fktfrnhf5my35dkyy6e@7b4fztoupvls> (raw)
In-Reply-To: <d35222d0-306e-4e5a-a717-e97446a583d1@proxmox.com>

>> [snip]
>> +#[derive(Serialize, Deserialize, Debug, Default)]
>> +pub struct FabricConfig {
>> +    openfabric: Option<openfabric::internal::OpenFabricConfig>,
>> +    ospf: Option<ospf::internal::OspfConfig>,
>> +}
>> +
>> +impl FabricConfig {
>> +    pub fn new(raw_openfabric: &str, raw_ospf: &str) -> Result<Self, anyhow::Error> {
>> +        let openfabric =
>> +            openfabric::internal::OpenFabricConfig::default(raw_openfabric)?;
>> +        let ospf = ospf::internal::OspfConfig::default(raw_ospf)?;
>
>Maybe rename the two methods to new, since default usually has no
>arguments and this kinda breaks with this convention?

Good point.

>> +#[derive(Error, Debug)]
>> +pub enum IntegerRangeError {
>> +    #[error("The value must be between {min} and {max} seconds")]
>> +    OutOfRange { min: i32, max: i32 },
>> +    #[error("Error parsing to number")]
>> +    ParsingError(#[from] ParseIntError),
>> +}
>> +
>> +#[derive(Serialize, Deserialize, Hash, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
>
>derive Copy for ergonomics

Done – also for all the other types.

>> +    impl TryFrom<InterfaceProperties> for Interface {
>> +        type Error = OpenFabricConfigError;
>> +
>> +        fn try_from(value: InterfaceProperties) -> Result<Self, Self::Error> {
>> +            Ok(Interface {
>> +                name: value.name.clone(),
>> +                passive: value.passive(),
>> +                hello_interval: value.hello_interval,
>> +                csnp_interval: value.csnp_interval,
>> +                hello_multiplier: value.hello_multiplier,
>> +            })
>> +        }
>> +    }
>
>are we anticipating this to be fallible in the future?

Hmm not really. These simple properties all have the same type in the
SectionConfig so they are validated already. Same goes for a few other
SectionConfig -> IntermediateConfig conversions.
Changed them to simple From impls.

Note that a few (e.g. Node) conversions need to be TryFrom as we need to
parse the router_id as an IpV4Addr.

Thanks for the review!


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

  reply	other threads:[~2025-03-05  9:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 13:39 [pve-devel] [RFC cluster/manager/network/proxmox{-ve-rs, -perl-rs} 00/11] Add SDN Fabrics Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH proxmox-ve-rs 01/11] add crate with common network types Gabriel Goller
2025-03-03 15:08   ` Stefan Hanreich
2025-03-05  8:28     ` Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH proxmox-ve-rs 02/11] add proxmox-frr crate with frr types Gabriel Goller
2025-03-03 16:29   ` Stefan Hanreich
2025-03-04 16:28     ` Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH proxmox-ve-rs 03/11] add intermediate fabric representation Gabriel Goller
2025-02-28 13:57   ` Thomas Lamprecht
2025-02-28 16:19     ` Gabriel Goller
2025-03-04 17:30     ` Gabriel Goller
2025-03-05  9:03       ` Wolfgang Bumiller
2025-03-04  8:45   ` Stefan Hanreich
2025-03-05  9:09     ` Gabriel Goller [this message]
2025-02-14 13:39 ` [pve-devel] [PATCH proxmox-perl-rs 04/11] fabrics: add CRUD and generate fabrics methods Gabriel Goller
2025-03-04  9:28   ` Stefan Hanreich
2025-03-05 10:20     ` Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH pve-cluster 05/11] cluster: add sdn fabrics config files Gabriel Goller
2025-02-28 12:19   ` Thomas Lamprecht
2025-02-28 12:52     ` Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH pve-network 06/11] add config file and common read/write methods Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH pve-network 07/11] merge the frr config with the fabrics frr config on apply Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH pve-network 08/11] add api endpoints for fabrics Gabriel Goller
2025-03-04  9:51   ` Stefan Hanreich
2025-02-14 13:39 ` [pve-devel] [PATCH pve-manager 09/11] sdn: add Fabrics view Gabriel Goller
2025-03-04  9:57   ` Stefan Hanreich
2025-03-07 15:57     ` Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH pve-manager 10/11] sdn: add fabric edit/delete forms Gabriel Goller
2025-03-04 10:07   ` Stefan Hanreich
2025-03-07 16:04     ` Gabriel Goller
2025-02-14 13:39 ` [pve-devel] [PATCH pve-manager 11/11] network: return loopback interface on network endpoint Gabriel Goller
2025-03-03 16:58 ` [pve-devel] [RFC cluster/manager/network/proxmox{-ve-rs, -perl-rs} 00/11] Add SDN Fabrics 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=zwcxsoezitj3efggrcdrg3yb4l4kat6fktfrnhf5my35dkyy6e@7b4fztoupvls \
    --to=g.goller@proxmox.com \
    --cc=pve-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal