The datacenter_config() functions in SDN::Zones::Plugin is a simple
wrapper that reads datacenter.cfg via cfs.
This allows mocking datacenter.cfg in tests.
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
use strict;
use warnings;
use PVE::Network::SDN::Zones::VxlanPlugin;
+use PVE::Network::SDN::Zones::Plugin;
use PVE::Exception qw(raise raise_param_exc);
use PVE::JSONSchema qw(get_standard_option);
use PVE::Tools qw($IPV4RE);
}
if (!defined($zone_cfg->{ids}->{$zoneid}->{'mac'})) {
- my $dc = PVE::Cluster::cfs_read_file('datacenter.cfg');
+ my $dc = PVE::Network::SDN::Zones::Plugin->datacenter_config();
$zone_cfg->{ids}->{$zoneid}->{'mac'} = PVE::Tools::random_ether_addr($dc->{mac_prefix});
}
}
return @bridge_ifaces;
}
+
+sub datacenter_config {
+ return PVE::Cluster::cfs_read_file('datacenter.cfg');
+}
+
1;
raise_param_exc({ tag => "vlan tag is not allowed on simple zone"}) if defined($tag);
if (!defined($vnet->{mac})) {
- my $dc = PVE::Cluster::cfs_read_file('datacenter.cfg');
+ my $dc = PVE::Network::SDN::Zones::Plugin::datacenter_config();
$vnet->{mac} = PVE::Tools::random_ether_addr($dc->{mac_prefix});
}
}