[pve-devel] [PATCH proxmox-perl-rs v4 5/5] pve-rs: sdn: fabrics: add helper for network API endpoint

Gabriel Goller g.goller at proxmox.com
Fri Jul 4 18:31:07 CEST 2025


>> diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
>> index 099c1a7ab515..f5abb1b72099 100644
>> --- a/pve-rs/src/bindings/sdn/fabrics.rs
>> +++ b/pve-rs/src/bindings/sdn/fabrics.rs
>> @@ -46,6 +46,34 @@ pub mod pve_rs_sdn_fabrics {
>>
>>      perlmod::declare_magic!(Box<PerlFabricConfig> : &PerlFabricConfig as "PVE::RS::SDN::Fabrics::Config");
>>
>> +    /// Represents a interface as returned by the `GET /nodes/{node}/network` endpoint in PVE.
>
>an*

Done.

>> +    ///
>> +    /// This is used for returning fabrics in the endpoint, so they can be used from various places
>> +    /// in the PVE UI (e.g. migration network settings).
>> +    #[derive(Serialize, Deserialize)]
>
>It seems we currently only serialize this, so could drop the
>`Deserialize` here since it's a private helper type anyway right now.

Agree.

>> +    struct PveInterface {
>> +        iface: String,
>> +        #[serde(rename = "type")]
>> +        ty: String,
>> +        active: bool,
>> +        #[serde(skip_serializing_if = "Option::is_none")]
>> +        cidr: Option<Ipv4Cidr>,
>> +        #[serde(skip_serializing_if = "Option::is_none")]
>> +        cidr6: Option<Ipv6Cidr>,
>> +    }
>> +
>> +    impl From<ConfigFabric> for PveInterface {
>> +        fn from(fabric: ConfigFabric) -> Self {
>> +            Self {
>> +                iface: fabric.id().to_string(),
>> +                ty: "fabric".to_string(),
>> +                active: true,
>> +                cidr: fabric.ip_prefix(),
>> +                cidr6: fabric.ip6_prefix(),
>> +            }
>> +        }
>> +    }
>> +
>> [snip]




More information about the pve-devel mailing list