[pve-devel] [PATCH pve-network 3/7] vlanplugin: add status

Alexandre Derumier aderumier at odiso.com
Mon Feb 10 17:26:06 CET 2020


we use vlan-aware, so vnets status need to be done on main bridge status
---
 PVE/Network/SDN/Zones/VlanPlugin.pm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm b/PVE/Network/SDN/Zones/VlanPlugin.pm
index 0fb4aa7..b5f00ca 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -41,6 +41,26 @@ sub generate_sdn_config {
     return "";
 }
 
+sub status {
+    my ($class, $plugin_config, $zone, $id, $vnet, $err_config, $status, $vnet_status, $zone_status) = @_;
+
+    my $bridge = $plugin_config->{bridge};
+    $vnet_status->{$id}->{zone} = $zone;
+    $zone_status->{$zone}->{status} = 'available' if !defined($zone_status->{$zone}->{status});
+
+    if($err_config) {
+	$vnet_status->{$id}->{status} = 'pending';
+	$vnet_status->{$id}->{statusmsg} = $err_config;
+	$zone_status->{$zone}->{status} = 'pending';
+    } elsif ($status->{$bridge}->{status} && $status->{$bridge}->{status} eq 'pass') {
+	$vnet_status->{$id}->{status} = 'available';
+    } else {
+	$vnet_status->{$id}->{status} = 'error';
+	$vnet_status->{$id}->{statusmsg} = 'missing bridge';
+	$zone_status->{$zone}->{status} = 'error';
+    }
+}
+
 1;
 
 
-- 
2.20.1




More information about the pve-devel mailing list