Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com>
Tested-By: Stefan Hanreich <s.hanre...@proxmox.com>
Reviewed-by: Shannon Sterz <s.st...@proxmox.com>
---
changes since
v3:
* changed "vlans" to "VLANs" in description
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..a1dad4b5 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.",
+ 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);
};
--
2.39.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel