Signed-off-by: Alexandre Derumier <aderum...@odiso.com>
---
 PVE/API2/Network/SDN/Subnets.pm | 2 ++
 PVE/Network/SDN/Ipams.pm        | 2 ++
 PVE/Network/SDN/SubnetPlugin.pm | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Network/SDN/Subnets.pm b/PVE/API2/Network/SDN/Subnets.pm
index ab4117c..2dd80a3 100644
--- a/PVE/API2/Network/SDN/Subnets.pm
+++ b/PVE/API2/Network/SDN/Subnets.pm
@@ -182,6 +182,8 @@ __PACKAGE__->register_method ({
            my $opts = PVE::Network::SDN::SubnetPlugin->check_config($id, 
$param, 0, 1);
            $cfg->{ids}->{$id} = $opts;
 
+           raise_param_exc({ ipam => "you can't change ipam"}) if 
$opts->{ipam} && $scfg->{ipam} && $opts->{ipam} ne $scfg->{ipam};
+
            PVE::Network::SDN::SubnetPlugin->on_update_hook($id, $opts, $scfg);
 
            PVE::Network::SDN::Subnets::write_config($cfg);
diff --git a/PVE/Network/SDN/Ipams.pm b/PVE/Network/SDN/Ipams.pm
index a979d46..302c4d2 100644
--- a/PVE/Network/SDN/Ipams.pm
+++ b/PVE/Network/SDN/Ipams.pm
@@ -34,6 +34,8 @@ sub sdn_ipams_config {
 
 sub config {
     my $config = cfs_read_file("sdn/ipams.cfg");
+    #add default internal pve
+    $config->{ids}->{pve}->{type} = 'pve';
     return $config;
 }
 
diff --git a/PVE/Network/SDN/SubnetPlugin.pm b/PVE/Network/SDN/SubnetPlugin.pm
index 97d8cb8..341e9e0 100644
--- a/PVE/Network/SDN/SubnetPlugin.pm
+++ b/PVE/Network/SDN/SubnetPlugin.pm
@@ -109,7 +109,7 @@ sub options {
        dnszone => { optional => 1 },
        reversednszone => { optional => 1 },
        dnszoneprefix => { optional => 1 },
-       ipam => { optional => 1 },
+       ipam => { optional => 0 },
     };
 }
 
-- 
2.20.1


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

Reply via email to