[pve-devel] [PATCH pve-network 2/2] zones: status: add a special message if vnet is not generated

Alexandre Derumier aderumier at odiso.com
Mon Jun 12 19:43:47 CEST 2023


if vnet has not been generated (this should never happend)
warn the user to check if "source /etc/network/interfaces.d/sdn'
exist

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/Network/SDN/Zones.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index 7d70e49..e26e21f 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -267,7 +267,11 @@ sub status {
 	my $err_msg = $plugin->status($plugin_config, $zone, $id, $vnet, $status);
 	if (@{$err_msg} > 0) {
 	    $vnet_status->{$id}->{status} = 'error';
-	    $vnet_status->{$id}->{statusmsg} = join(',', @{$err_msg});
+	    if (grep(/^missing ${id}$/, @$err_msg)) {
+		$vnet_status->{$id}->{statusmsg} = "vnet $id is not generated. Do you have included 'source /etc/network/interfaces.d/sdn' ?";
+	    } else {
+		$vnet_status->{$id}->{statusmsg} = join(',', @{$err_msg});
+	    }
 	    $zone_status->{$zone}->{status} = 'error';
 	}
     }
-- 
2.30.2





More information about the pve-devel mailing list