public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager] sdn: ipam: fix ipam grouping identical subnets in different vnets
@ 2023-11-28  8:58 Stefan Hanreich
  2023-11-28  9:02 ` Hannes Dürr
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2023-11-28  8:58 UTC (permalink / raw)
  To: pve-devel

When SDN is configured with the same subnet in two different VNets the
IPAM tree would render them wrongly.

Reported-By: Hannes Duerr <h.duerr@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 www/manager6/tree/DhcpTree.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/www/manager6/tree/DhcpTree.js b/www/manager6/tree/DhcpTree.js
index d0b80803d..60029d3f4 100644
--- a/www/manager6/tree/DhcpTree.js
+++ b/www/manager6/tree/DhcpTree.js
@@ -60,7 +60,11 @@ Ext.define('PVE.sdn.DhcpTree', {
 			    zones[element.zone].children.push(vnet);
 			}
 
-			if (!(element.subnet in subnets)) {
+			if (!(element.vnet in subnets)) {
+			    subnets[element.vnet] = {};
+			}
+
+			if (!(element.subnet in subnets[element.vnet])) {
 			    let subnet = {
 				name: element.subnet,
 				zone: element.zone,
@@ -71,13 +75,13 @@ Ext.define('PVE.sdn.DhcpTree', {
 				children: [],
 			    };
 
-			    subnets[element.subnet] = subnet;
+			    subnets[element.vnet][element.subnet] = subnet;
 			    vnets[element.vnet].children.push(subnet);
 			}
 
 			element.type = 'mapping';
 			element.iconCls = 'x-tree-icon-none';
-			subnets[element.subnet].children.push(element);
+			subnets[element.vnet][element.subnet].children.push(element);
 		    });
 
 		    me.getView().setRootNode(root);
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH pve-manager] sdn: ipam: fix ipam grouping identical subnets in different vnets
  2023-11-28  8:58 [pve-devel] [PATCH pve-manager] sdn: ipam: fix ipam grouping identical subnets in different vnets Stefan Hanreich
@ 2023-11-28  9:02 ` Hannes Dürr
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Dürr @ 2023-11-28  9:02 UTC (permalink / raw)
  To: Stefan Hanreich, pve-devel

Tested-by: Hannes Duerr <h.duerr@proxmox.com>

On 11/28/23 09:58, Stefan Hanreich wrote:
> When SDN is configured with the same subnet in two different VNets the
> IPAM tree would render them wrongly.
>
> Reported-By: Hannes Duerr <h.duerr@proxmox.com>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
>   www/manager6/tree/DhcpTree.js | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/www/manager6/tree/DhcpTree.js b/www/manager6/tree/DhcpTree.js
> index d0b80803d..60029d3f4 100644
> --- a/www/manager6/tree/DhcpTree.js
> +++ b/www/manager6/tree/DhcpTree.js
> @@ -60,7 +60,11 @@ Ext.define('PVE.sdn.DhcpTree', {
>   			    zones[element.zone].children.push(vnet);
>   			}
>   
> -			if (!(element.subnet in subnets)) {
> +			if (!(element.vnet in subnets)) {
> +			    subnets[element.vnet] = {};
> +			}
> +
> +			if (!(element.subnet in subnets[element.vnet])) {
>   			    let subnet = {
>   				name: element.subnet,
>   				zone: element.zone,
> @@ -71,13 +75,13 @@ Ext.define('PVE.sdn.DhcpTree', {
>   				children: [],
>   			    };
>   
> -			    subnets[element.subnet] = subnet;
> +			    subnets[element.vnet][element.subnet] = subnet;
>   			    vnets[element.vnet].children.push(subnet);
>   			}
>   
>   			element.type = 'mapping';
>   			element.iconCls = 'x-tree-icon-none';
> -			subnets[element.subnet].children.push(element);
> +			subnets[element.vnet][element.subnet].children.push(element);
>   		    });
>   
>   		    me.getView().setRootNode(root);




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-28  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28  8:58 [pve-devel] [PATCH pve-manager] sdn: ipam: fix ipam grouping identical subnets in different vnets Stefan Hanreich
2023-11-28  9:02 ` Hannes Dürr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal