[pve-devel] [PATCH proxmox-ve-rs 12/21] sdn: add config module

Gabriel Goller g.goller at proxmox.com
Thu Jun 27 12:54:36 CEST 2024


On 26.06.2024 14:15, Stefan Hanreich wrote:
>diff --git a/proxmox-ve-config/src/sdn/config.rs b/proxmox-ve-config/src/sdn/config.rs
>new file mode 100644
>index 0000000..8454adf
>--- /dev/null
>+++ b/proxmox-ve-config/src/sdn/config.rs
>@@ -0,0 +1,571 @@
> [snip]
>+impl Display for DhcpType {
>+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
>+        f.write_str(match self {
>+            DhcpType::Dnsmasq => "dnsmasq",
>+        })
>+    }
>+}
>+
>+/// struct for deserializing a zone entry of the SDN running config

I think we usually begin doc-strings with a capital letter :)

>+#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)]
>+pub struct ZoneRunningConfig {
>+    #[serde(rename = "type")]
>+    ty: ZoneType,
>+    dhcp: DhcpType,
>+}
>+
>+/// struct for deserializing the zones of the SDN running config
>+#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Default)]
>+pub struct ZonesRunningConfig {
>+    ids: HashMap<ZoneName, ZoneRunningConfig>,
>+}
>+
>+/// represents the dhcp-range property string used in the SDN configuration
>+#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)]
>+pub struct DhcpRange {
>+    #[serde(rename = "start-address")]
>+    start: IpAddr,
>+    #[serde(rename = "end-address")]
>+    end: IpAddr,
>+}
>+
>+impl ApiType for DhcpRange {
>+    const API_SCHEMA: proxmox_schema::Schema = ObjectSchema::new(
>+        "DHCP range",
>+        &[
>+            (
>+                "end-address",
>+                false,
>+                &StringSchema::new("start address of DHCP range").schema(),

Shouldn't this be "end address..." or is this intended?
Same below.

>+            ),
>+            (
>+                "start-address",
>+                false,
>+                &StringSchema::new("end address of DHCP range").schema(),
>+            ),
>+        ],
>+    )
>+    .schema();
>+}
>+




More information about the pve-devel mailing list