From c7bb4ac53a7346667658079ea9197f5e364c4b84 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Thu, 16 Jan 2020 09:15:16 +0100 Subject: [PATCH] controller : evpn : only allow 1 evpn controller we can only have 1 bgp router on a server Signed-off-by: Alexandre Derumier --- PVE/Network/SDN/Controllers/EvpnPlugin.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 6369c45..034cb93 100644 --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -167,13 +167,12 @@ sub on_delete_hook { sub on_update_hook { my ($class, $controllerid, $controller_cfg) = @_; - # verify that asn is not already used by another controller - my $asn = $controller_cfg->{ids}->{$controllerid}->{asn}; + # we can only have 1 evpn controller / 1 asn by server + foreach my $id (keys %{$controller_cfg->{ids}}) { next if $id eq $controllerid; my $controller = $controller_cfg->{ids}->{$id}; - die "asn $asn is already used by $id" - if (defined($controller->{asn}) && $controller->{asn} eq $asn); + die "only 1 evpn controller can be defined" if $controller->{type} eq "evpn"; } } -- 2.39.5