[pve-devel] [RFC pve-network 4/6] sdn: dhcp: subnet: add DHCP options to subnet configuration

DERUMIER, Alexandre alexandre.derumier at groupe-cyllene.com
Mon Sep 11 06:03:36 CEST 2023


I think that some common options could also be declared at subnet level
or even at zone level.

(I'm think about static routes for example, they could be defined at
subnet level,   maybe dnsserver,ntpserver could be defined at zone
level, ....)

to avoid to redefined them each time for each range.


So maybe be able to defined them at uppper level, and be able to
override them at range level. 



Le vendredi 08 septembre 2023 à 15:43 +0200, Stefan Hanreich a écrit :
> Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
> ---
>  src/PVE/Network/SDN/SubnetPlugin.pm | 43
> +++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/src/PVE/Network/SDN/SubnetPlugin.pm
> b/src/PVE/Network/SDN/SubnetPlugin.pm
> index 15b370f..527db4f 100644
> --- a/src/PVE/Network/SDN/SubnetPlugin.pm
> +++ b/src/PVE/Network/SDN/SubnetPlugin.pm
> @@ -61,6 +61,34 @@ sub private {
>      return $defaultData;
>  }
> 
> +my $dhcp_range_fmt = {
> +    server => {
> +       type => 'pve-configid',
> +       description => 'ID of the DHCP server responsible for
> managing this range',
> +    },
> +    'start-address' => {
> +       type => 'ip',
> +       description => 'Start address for the DHCP IP range',
> +    },
> +    'end-address' => {
> +       type => 'ip',
> +       description => 'End address for the DHCP IP range',
> +    },
> +    'lease-time' => {
> +       type => 'integer',
> +       description => 'Lifetime for the DHCP leases of this subnet
> (in seconds)',
> +       minimum => 1,
> +       optional => 1,
> +    },
> +    'dns-server' => {
> +       type => 'ip',
> +       description => 'IP address for the DNS server',
> +       optional => 1,
> +    },
> +};
> +
> +PVE::JSONSchema::register_format('pve-sdn-dhcp-range',
> $dhcp_range_fmt);
> +
>  sub properties {
>      return {
>          vnet => {
> @@ -84,6 +112,19 @@ sub properties {
>              type => 'string', format => 'dns-name',
>              description => "dns domain zone prefix  ex: 'adm' ->
> <hostname>.adm.mydomain.com",
>          },
> +       'dhcp-range' => {
> +           type => 'array',
> +           description => 'A list of DHCP ranges for this subnet',
> +           items => {
> +               type => 'string',
> +               format => 'pve-sdn-dhcp-range',
> +           }
> +       },
> +       'dhcp-dns-server' => {
> +           type => 'ip',
> +           description => 'IP address for the DNS server',
> +           optional => 1,
> +       },
>      };
>  }
> 
> @@ -94,6 +135,8 @@ sub options {
>  #      routes => { optional => 1 },
>         snat => { optional => 1 },
>         dnszoneprefix => { optional => 1 },
> +       'dhcp-range' => { optional => 1 },
> +       'dhcp-dns-server' => { optional => 1 },
>      };
>  }
> 
> --
> 2.39.2
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://antiphishing.cetsi.fr/proxy/v3?i=MlZSTzBhZFZ6Nzl4c3EyN7fbSKDePLMxi5u5_onpAoI&r=cm1qVmRYUWk2WXhYZVFHWA0PXtTaYxz7-FIOTkZBm34_dHdSch-gXn7ST9eGhQLN&f=S1Zkd042VWdrZG5qQUxxWk5ps4t67kNuHsBZzdzhpquLKuXqTZLIq2K1DfKr9N61yBafm7AuAITd6bHtRU4zEQ&u=https%3A//lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel&k=F1is
> 



More information about the pve-devel mailing list