]> git.proxmox.com Git - pve-network.git/commitdiff
subnet: make IPAM required and use PVE IPAM as default
authorAlexandre Derumier <aderumier@odiso.com>
Mon, 5 Oct 2020 15:09:01 +0000 (17:09 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 6 Oct 2020 16:17:19 +0000 (18:17 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/API2/Network/SDN/Subnets.pm
PVE/Network/SDN/Ipams.pm
PVE/Network/SDN/SubnetPlugin.pm

index bc2b18f57c53c267948a9b3449eb0ffe91968e35..3c958bdd9f7818d97cf86345a06f76e53059e7f2 100644 (file)
@@ -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);
index a979d4626aae73da9440f369cb6cd72c453d4598..302c4d2dc087e9cbd2a1ac73d2f0d958bad9f9ed 100644 (file)
@@ -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;
 }
 
index 97d8cb81c59022e45703f9ba15731d9cb90f3856..341e9e0b71d046507938df8ed47200aa7ede893b 100644 (file)
@@ -109,7 +109,7 @@ sub options {
        dnszone => { optional => 1 },
        reversednszone => { optional => 1 },
        dnszoneprefix => { optional => 1 },
-       ipam => { optional => 1 },
+       ipam => { optional => 0 },
     };
 }