From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id EF46A9D08E for ; Fri, 2 Jun 2023 13:39:46 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D0D31295F5 for ; Fri, 2 Jun 2023 13:39:46 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 2 Jun 2023 13:39:45 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 116BF48486 for ; Fri, 2 Jun 2023 13:39:45 +0200 (CEST) Date: Fri, 02 Jun 2023 13:39:38 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20230526072724.1605613-1-aderumier@odiso.com> <20230526072724.1605613-3-aderumier@odiso.com> In-Reply-To: <20230526072724.1605613-3-aderumier@odiso.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1685703147.w34rasy2o5.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.074 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [cluster.pm, network.pm, me.zone, proxmox.com] Subject: Re: [pve-devel] [PATCH pve-manager 2/4] add permissions management for "local" network zone X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jun 2023 11:39:47 -0000 On May 26, 2023 9:27 am, Alexandre Derumier wrote: > add a default virtual zone called 'local' in the ressource tree, > and handle permissions like a true sdn zone >=20 > Signed-off-by: Alexandre Derumier > --- > PVE/API2/Cluster.pm | 12 ++++++++++++ > PVE/API2/Network.pm | 5 +++-- > www/manager6/sdn/ZoneContentView.js | 27 ++++++++++++++++++++++++++- > 3 files changed, 41 insertions(+), 3 deletions(-) >=20 > diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm > index 2e942368..e8f5e06e 100644 > --- a/PVE/API2/Cluster.pm > +++ b/PVE/API2/Cluster.pm > @@ -474,6 +474,18 @@ __PACKAGE__->register_method({ > } > } > =20 > + #add default "local" network zone > + foreach my $node (@$nodelist) { > + my $local_sdn =3D { > + id =3D> "sdn/$node/local", > + sdn =3D> 'local', > + node =3D> $node, > + type =3D> 'sdn', > + status =3D> 'ok', > + }; > + push @$res, $local_sdn; > + } > + should this als obe guarded by the type check like below? is there anything that ensures that a 'local' zone doesn't already exist as regular SDN-managed zone? > if ($have_sdn) { > if (!$param->{type} || $param->{type} eq 'sdn') { > =20 > diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm > index a43579fa..b3faba1a 100644 > --- a/PVE/API2/Network.pm > +++ b/PVE/API2/Network.pm > @@ -209,7 +209,7 @@ __PACKAGE__->register_method({ > type =3D> { > description =3D> "Only list specific interface types.", > type =3D> 'string', > - enum =3D> [ @$network_type_enum, 'any_bridge' ], > + enum =3D> [ @$network_type_enum, 'any_bridge', 'any_local_bridge' ], > optional =3D> 1, > }, > }, > @@ -254,7 +254,8 @@ __PACKAGE__->register_method({ > =20 > for my $k (sort keys $ifaces->%*) { > my $type =3D $ifaces->{$k}->{type}; > - my $match =3D $tfilter eq $type || ($tfilter eq 'any_bridge' && ($type= eq 'bridge' || $type eq 'OVSBridge')); > + my $match =3D $tfilter eq $type || ($tfilter =3D~ /^any(_local)?_bridg= e$/ && ($type eq 'bridge' || $type eq 'OVSBridge')); this line is getting a bit long, maybe it could be reformated or refactored? > + nit: this blank newline is introduced here and removed in the next patch ;) > delete $ifaces->{$k} if !($match && $can_access_vnet->($k)); > } > =20 > diff --git a/www/manager6/sdn/ZoneContentView.js b/www/manager6/sdn/ZoneC= ontentView.js > index 08fa9d81..1a994fc9 100644 > --- a/www/manager6/sdn/ZoneContentView.js > +++ b/www/manager6/sdn/ZoneContentView.js > @@ -26,6 +26,9 @@ Ext.define('PVE.sdn.ZoneContentView', { > } > =20 > var baseurl =3D "/nodes/" + me.nodename + "/sdn/zones/" + me.zone + "/c= ontent"; > + if (me.zone =3D=3D=3D 'local') { > + baseurl =3D "/nodes/" + me.nodename + "/network?type=3Dany_local_br= idge"; > + } > var store =3D Ext.create('Ext.data.Store', { > model: 'pve-sdnzone-content', > groupField: 'content', > @@ -95,7 +98,29 @@ Ext.define('PVE.sdn.ZoneContentView', { > Ext.define('pve-sdnzone-content', { > extend: 'Ext.data.Model', > fields: [ > - 'vnet', 'status', 'statusmsg', > + { > + name: 'iface', > + convert: function(value, record) { > + //map local vmbr to vnet > + if (record.data.iface) { > + record.data.vnet =3D record.data.iface; > + } > + return value; > + }, > + }, > + { > + name: 'comments', > + convert: function(value, record) { > + //map local vmbr comments to vnet alias > + if (record.data.comments) { > + record.data.alias =3D record.data.comments; > + } > + return value; > + }, > + }, > + 'vnet', > + 'status', > + 'statusmsg', > { > name: 'text', > convert: function(value, record) { > --=20 > 2.30.2 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20