[pve-devel] [PATCH v3 pve-manager 2/4] api2: cluster: ressources: add "localnetwork" zone

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Jun 7 16:44:54 CEST 2023


I had the following fixup for this locally:

```
diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index a7224d7f3..07e5261f2 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -474,23 +474,22 @@ __PACKAGE__->register_method({
 	    }
 	}
 
-	#add default "localnetwork" zone
-	if ($rpcenv->check($authuser, "/sdn/zones/localnetwork", [ 'SDN.Audit' ], 1)) {
-	    foreach my $node (@$nodelist) {
-		my $local_sdn = {
-		    id => "sdn/$node/localnetwork",
-		    sdn => 'localnetwork',
-		    node => $node,
-		    type => 'sdn',
-		    status => 'ok',
-	        };
-	        push @$res, $local_sdn;
+	if (!$param->{type} || $param->{type} eq 'sdn') {
+	    #add default "localnetwork" zone
+	    if ($rpcenv->check($authuser, "/sdn/zones/localnetwork", [ 'SDN.Audit' ], 1)) {
+	      	foreach my $node (@$nodelist) {
+		    my $local_sdn = {
+		      	id => "sdn/$node/localnetwork",
+		      	sdn => 'localnetwork',
+		      	node => $node,
+		      	type => 'sdn',
+		      	status => 'ok',
+	            };
+	            push @$res, $local_sdn;
+	      	}
 	    }
-	}
-
-	if ($have_sdn) {
-	    if (!$param->{type} || $param->{type} eq 'sdn') {
 
+	    if ($have_sdn) {
 		my $nodes = PVE::Cluster::get_node_kv("sdn");
 
 		for my $node (sort keys %{$nodes}) {
```

but then when testing I realized that this makes a 'localnetwork' entry
appear in the tree in the GUI, but it's not possible to open it? or
maybe it needs the GUI patches that I haven't had the time to look at
yet ;) but maybe something to take into account in the next version,
didn't apply this one for now..

On June 7, 2023 2:03 pm, Alexandre Derumier wrote:
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/API2/Cluster.pm | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
> index 2e942368..a7224d7f 100644
> --- a/PVE/API2/Cluster.pm
> +++ b/PVE/API2/Cluster.pm
> @@ -474,6 +474,20 @@ __PACKAGE__->register_method({
>  	    }
>  	}
>  
> +	#add default "localnetwork" zone
> +	if ($rpcenv->check($authuser, "/sdn/zones/localnetwork", [ 'SDN.Audit' ], 1)) {
> +	    foreach my $node (@$nodelist) {
> +		my $local_sdn = {
> +		    id => "sdn/$node/localnetwork",
> +		    sdn => 'localnetwork',
> +		    node => $node,
> +		    type => 'sdn',
> +		    status => 'ok',
> +	        };
> +	        push @$res, $local_sdn;
> +	    }
> +	}
> +
>  	if ($have_sdn) {
>  	    if (!$param->{type} || $param->{type} eq 'sdn') {
>  
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 





More information about the pve-devel mailing list