From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 6BF401FF15E
	for <inbox@lore.proxmox.com>; Fri, 26 Jul 2024 14:23:39 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id DD9031DF5E;
	Fri, 26 Jul 2024 14:23:40 +0200 (CEST)
Mime-Version: 1.0
Date: Fri, 26 Jul 2024 14:23:07 +0200
Message-Id: <D2ZGUFLLIP3I.2F6WMF8WPHEWF@proxmox.com>
To: "Proxmox VE development discussion" <pve-devel@lists.proxmox.com>
From: "Shannon Sterz" <s.sterz@proxmox.com>
X-Mailer: aerc 0.17.0-69-g65571b67d7d3-dirty
References: <20240703080147.81154-1-a.lauterer@proxmox.com>
 <20240703080147.81154-6-a.lauterer@proxmox.com>
In-Reply-To: <20240703080147.81154-6-a.lauterer@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.049 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
Subject: Re: [pve-devel] [PATCH manager v3 5/6] fix #3893: api: network: add
 bridge_vids parameter
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On Wed Jul 3, 2024 at 10:01 AM CEST, Aaron Lauterer wrote:
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> changes since v2:
> * added checks to handle empty lists
>
>  PVE/API2/Network.pm | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
> index f39f04f5..dd3855d1 100644
> --- a/PVE/API2/Network.pm
> +++ b/PVE/API2/Network.pm
> @@ -66,6 +66,11 @@ my $confdesc = {
>  	type => 'boolean',
>  	optional => 1,
>      },
> +    bridge_vids => {
> +	description => "Specify the allowed vlans. For example: '2 4 100-200'. Only used if the bridge is VLAN aware.",

nit: i think this should be "VLANs" as you seem to capitalize this
abbreviation everywhere else.

> +	optional => 1,
> +	type => 'string', format => 'pve-vlan-id-or-range-list',
> +    },
>      bridge_ports => {
>  	description => "Specify the interfaces you want to add to your bridge.",
>  	optional => 1,
> @@ -469,6 +474,10 @@ __PACKAGE__->register_method({
>  		    if ! grep { $_ eq $iface } @ports;
>  	    }
>
> +	    if ($param->{bridge_vids} && !PVE::Tools::check_list_empty($param->{bridge_vids})) {
> +		raise_param_exc({ bridge_vids => "VLAN list items are empty" });
> +	    }
> +
>  	    $ifaces->{$iface} = $param;
>
>  	    PVE::INotify::write_file('interfaces', $config);
> @@ -558,7 +567,11 @@ __PACKAGE__->register_method({
>  	    foreach my $k (keys %$param) {
>  		$ifaces->{$iface}->{$k} = $param->{$k};
>  	    }
> -
> +
> +	    if ($param->{bridge_vids} && !PVE::Tools::check_list_empty($param->{bridge_vids})) {
> +		raise_param_exc({ bridge_vids => "VLAN list items are empty" });
> +	    }
> +
>  	    PVE::INotify::write_file('interfaces', $config);
>  	};
>



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel