[pve-devel] [RFC pve-network 4/6] sdn: dhcp: subnet: add DHCP options to subnet configuration
Stefan Hanreich
s.hanreich at proxmox.com
Fri Sep 8 15:43:02 CEST 2023
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
More information about the pve-devel
mailing list