diff options
| author | Stefan Hanreich <s.hanreich@proxmox.com> | 2024-04-22 15:15:33 +0200 |
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2024-04-22 15:22:08 +0200 |
| commit | 41e8c887c11ffbd446fbeb1869d15a846e2b1432 (patch) | |
| tree | 030242e7c048be648a751af2906f49d5ec6eb04e | |
| parent | 33f79ff473063821fc3e1c50e6a3d0a99c67ea21 (diff) | |
zones: add method for getting MTU
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
| -rw-r--r-- | src/PVE/Network/SDN/Zones.pm | 8 | ||||
| -rw-r--r-- | src/PVE/Network/SDN/Zones/Plugin.pm | 7 | ||||
| -rw-r--r-- | src/PVE/Network/SDN/Zones/SimplePlugin.pm | 8 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm index 5bd3536..c1c7745 100644 --- a/src/PVE/Network/SDN/Zones.pm +++ b/src/PVE/Network/SDN/Zones.pm @@ -27,6 +27,7 @@ PVE::Network::SDN::Zones::SimplePlugin->register(); PVE::Network::SDN::Zones::Plugin->init(); my $local_network_sdn_file = "/etc/network/interfaces.d/sdn"; +my $default_mtu = 1500; sub sdn_zones_config { my ($cfg, $id, $noerr) = @_; @@ -369,5 +370,12 @@ sub del_bridge_fdb { $plugin->del_bridge_fdb($plugin_config, $iface, $macaddr); } +sub get_mtu { + my ($zone_config) = @_; + + my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($zone_config->{type}); + return $plugin->get_mtu($zone_config) // $default_mtu; +} + 1; diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm index 247d0b2..26cc0da 100644 --- a/src/PVE/Network/SDN/Zones/Plugin.pm +++ b/src/PVE/Network/SDN/Zones/Plugin.pm @@ -361,4 +361,11 @@ sub datacenter_config { return PVE::Cluster::cfs_read_file('datacenter.cfg'); } + +sub get_mtu { + my ($class, $plugin_config) = @_; + + die "please implement inside plugin"; +} + 1; diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm index 65e9ad4..1416d39 100644 --- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm +++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm @@ -56,7 +56,7 @@ sub generate_sdn_config { my $mac = $vnet->{mac}; my $alias = $vnet->{alias}; - my $mtu = $plugin_config->{mtu} if $plugin_config->{mtu}; + my $mtu = $class->get_mtu($plugin_config); # vnet bridge my @iface_config = (); @@ -144,6 +144,12 @@ sub vnet_update_hook { } } +sub get_mtu { + my ($class, $plugin_config) = @_; + + return $plugin_config->{mtu}; +} + 1; |
