$scfg->{zone} = $id;
$scfg->{digest} = $cfg->{digest};
+ if ($scfg->{nodes}) {
+ $scfg->{nodes} = PVE::Storage::Plugin->encode_value($scfg->{type}, 'nodes', $scfg->{nodes});
+ }
+
return $scfg;
};
#generate configuration
my $config = {};
+ my $nodename = PVE::INotify::nodename();
+
foreach my $id (keys %{$vnet_cfg->{ids}}) {
my $vnet = $vnet_cfg->{ids}->{$id};
my $zone = $vnet->{zone};
next;
}
+ next if defined($plugin_config->{nodes}) && !$plugin_config->{nodes}->{$nodename};
+
my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
$plugin->generate_sdn_config($plugin_config, $zone, $id, $vnet, $uplinks, $config);
}
my $status = ifquery_check();
my $vnet_cfg = PVE::Cluster::cfs_read_file('sdn/vnets.cfg');
+ my $zone_cfg = PVE::Cluster::cfs_read_file('sdn/zones.cfg');
+ my $nodename = PVE::INotify::nodename();
my $vnet_status = {};
my $transport_status = {};
foreach my $id (keys %{$vnet_cfg->{ids}}) {
my $zone = $vnet_cfg->{ids}->{$id}->{zone};
+ next if defined($zone_cfg->{ids}->{$zone}->{nodes}) && !$zone_cfg->{ids}->{$zone}->{nodes}->{$nodename};
+
$vnet_status->{$id}->{zone} = $zone;
$transport_status->{$zone}->{status} = 'available' if !defined($transport_status->{$zone}->{status});
sub options {
return {
+ nodes => { optional => 1},
'uplink-id' => { optional => 0 },
'vrf' => { optional => 0 },
'vrf-vxlan' => { optional => 0 },
sub options {
return {
+ nodes => { optional => 1},
'dp-id' => { optional => 0 },
'uplink-id' => { optional => 0 },
'controller' => { optional => 0 },
type => 'string', format => 'pve-configid',
type => 'string',
},
+ nodes => get_standard_option('pve-node-list', { optional => 1 }),
zone => get_standard_option('pve-sdn-zone-id',
{ completion => \&PVE::Network::SDN::Zones::complete_sdn_zone }),
},
return $defaultData;
}
+sub decode_value {
+ my ($class, $type, $key, $value) = @_;
+
+ if ($key eq 'nodes') {
+ my $res = {};
+
+ foreach my $node (PVE::Tools::split_list($value)) {
+ if (PVE::JSONSchema::pve_verify_node_name($node)) {
+ $res->{$node} = 1;
+ }
+ }
+
+ return $res;
+ }
+
+ return $value;
+}
+
+sub encode_value {
+ my ($class, $type, $key, $value) = @_;
+
+ if ($key eq 'nodes') {
+ return join(',', keys(%$value));
+ }
+
+ return $value;
+}
+
sub parse_section_header {
my ($class, $line) = @_;
sub options {
return {
+ nodes => { optional => 1},
'uplink-id' => { optional => 0 },
'tag' => { optional => 0 },
'vlan-protocol' => { optional => 1 },
sub options {
return {
+ nodes => { optional => 1},
'uplink-id' => { optional => 0 },
};
}
sub options {
return {
+ nodes => { optional => 1},
'uplink-id' => { optional => 0 },
'multicast-address' => { optional => 1 },
'unicast-address' => { optional => 1 },