public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [RFC series 0/2] Show more vlan infos
@ 2021-04-12 13:14 Aaron Lauterer
  2021-04-12 13:14 ` [pve-devel] [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device Aaron Lauterer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Aaron Lauterer @ 2021-04-12 13:14 UTC (permalink / raw)
  To: pve-devel

The main motivation here is to make the VLAN tags configured for an
interface better visible. The approach taken in this RFC is to use the
already existing vlan-id and vlan-raw-device values. These were only
present if the vlan device was configured with those explicit options,
available with ifupdown2.

For the other way, using the dot notation, the type was detected
correctly, but no further information about the vlan id and the used
device was present. Therefore the Inotify.pm has been changed to set the
same values for the dot notation interfaces. This results in the API
delivering the same information, not matter which type of vlan interface
it is.

Since the vlan-id and vlan-raw-device values are filtered for dot
notation interfaces when writing out the network config, I don't see
much harm here.

But should this approach be problematic for some reason that I have not
yet discovered, there is an alternative approach handling this in the
GUI only. Then the GUI would show the same information for both type of
vlan interfaces but the API would stay the same.

widget-toolkit: Aaron Lauterer (1):
  ui: network: add columns for vlan-id and vlan-raw-device

 src/node/NetworkView.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

pve-common:  src/PVE/INotify.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


-- 
2.20.1





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

* [pve-devel] [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device
  2021-04-12 13:14 [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer
@ 2021-04-12 13:14 ` Aaron Lauterer
  2021-06-15 15:01   ` [pve-devel] applied: " Thomas Lamprecht
  2021-04-12 13:14 ` [pve-devel] [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces Aaron Lauterer
  2021-06-09 13:38 ` [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer
  2 siblings, 1 reply; 6+ messages in thread
From: Aaron Lauterer @ 2021-04-12 13:14 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

There are probably a few opinions if these columns should be hidden by
default and where they should be placed.

 src/node/NetworkView.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/node/NetworkView.js b/src/node/NetworkView.js
index a1570ce..2e83130 100644
--- a/src/node/NetworkView.js
+++ b/src/node/NetworkView.js
@@ -16,6 +16,8 @@ Ext.define('proxmox-networks', {
 	'netmask6',
 	'slaves',
 	'type',
+	'vlan-id',
+	'vlan-raw-device',
     ],
     idProperty: 'iface',
 });
@@ -429,6 +431,18 @@ Ext.define('Proxmox.node.NetworkView', {
 			    dataIndex: 'gateway',
 			    renderer: renderer_generator('gateway'),
 			},
+			{
+			    header: gettext('VLAN ID'),
+			    hidden: true,
+			    sortable: true,
+			    dataIndex: 'vlan-id',
+			},
+			{
+			    header: gettext('VLAN raw device'),
+			    hidden: true,
+			    sortable: true,
+			    dataIndex: 'vlan-raw-device',
+			},
 			{
 			    header: gettext('Comment'),
 			    dataIndex: 'comments',
-- 
2.20.1





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

* [pve-devel] [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces
  2021-04-12 13:14 [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer
  2021-04-12 13:14 ` [pve-devel] [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device Aaron Lauterer
@ 2021-04-12 13:14 ` Aaron Lauterer
  2021-06-15 15:01   ` [pve-devel] applied: " Thomas Lamprecht
  2021-06-09 13:38 ` [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer
  2 siblings, 1 reply; 6+ messages in thread
From: Aaron Lauterer @ 2021-04-12 13:14 UTC (permalink / raw)
  To: pve-devel

Setting the vlan-id and vlan-raw-device value for vlan devices that
follow the dot notaton (interface.vlan) aligns how dot notation vlan
devices and vlan devices that use the explicit vlan-id and
vlan-raw-device options, available with ifupdown2, are represented in
API return values.

Previously the type for both was 'vlan' but only the latter showed more
details.

Setting these values here should not have any influence on how the
interfaces file is being written as these two values are already
filtered in __write_etc_network_interfaces for dot notation devices.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 src/PVE/INotify.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 2bb87bb..a0281e2 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -1077,10 +1077,14 @@ sub __read_etc_network_interfaces {
 		$ifaces->{$1}->{exists} = 0;
 		$d->{exists} = 0;
 	    }
-	} elsif ($iface =~ m/^(\S+)\.\d+$/ || $d->{'vlan-raw-device'}) {
+	} elsif ($iface =~ m/^(\S+)\.(\d+)$/ || $d->{'vlan-raw-device'}) {
 	    $d->{type} = 'vlan';
 
-	    my $raw_iface = $d->{'vlan-raw-device'} ? $d->{'vlan-raw-device'} : $1;
+	    $d->{'vlan-raw-device'} = $1 if $1 && !$d->{'vlan-raw-device'};
+	    $d->{'vlan-id'} = $2 if $2;
+
+	    my $raw_iface = $d->{'vlan-raw-device'};
+
 	    if (defined ($ifaces->{$raw_iface})) {
 		$d->{exists} = $ifaces->{$raw_iface}->{exists};
 	    } else {
-- 
2.20.1





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

* Re: [pve-devel] [RFC series 0/2] Show more vlan infos
  2021-04-12 13:14 [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer
  2021-04-12 13:14 ` [pve-devel] [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device Aaron Lauterer
  2021-04-12 13:14 ` [pve-devel] [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces Aaron Lauterer
@ 2021-06-09 13:38 ` Aaron Lauterer
  2 siblings, 0 replies; 6+ messages in thread
From: Aaron Lauterer @ 2021-06-09 13:38 UTC (permalink / raw)
  To: pve-devel

bump, just in case this has been overlooked :)

On 4/12/21 3:14 PM, Aaron Lauterer wrote:
> The main motivation here is to make the VLAN tags configured for an
> interface better visible. The approach taken in this RFC is to use the
> already existing vlan-id and vlan-raw-device values. These were only
> present if the vlan device was configured with those explicit options,
> available with ifupdown2.
> 
> For the other way, using the dot notation, the type was detected
> correctly, but no further information about the vlan id and the used
> device was present. Therefore the Inotify.pm has been changed to set the
> same values for the dot notation interfaces. This results in the API
> delivering the same information, not matter which type of vlan interface
> it is.
> 
> Since the vlan-id and vlan-raw-device values are filtered for dot
> notation interfaces when writing out the network config, I don't see
> much harm here.
> 
> But should this approach be problematic for some reason that I have not
> yet discovered, there is an alternative approach handling this in the
> GUI only. Then the GUI would show the same information for both type of
> vlan interfaces but the API would stay the same.
> 
> widget-toolkit: Aaron Lauterer (1):
>    ui: network: add columns for vlan-id and vlan-raw-device
> 
>   src/node/NetworkView.js | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> pve-common:  src/PVE/INotify.pm | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> 




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

* [pve-devel] applied: [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces
  2021-04-12 13:14 ` [pve-devel] [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces Aaron Lauterer
@ 2021-06-15 15:01   ` Thomas Lamprecht
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-06-15 15:01 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer

On 12.04.21 15:14, Aaron Lauterer wrote:
> Setting the vlan-id and vlan-raw-device value for vlan devices that
> follow the dot notaton (interface.vlan) aligns how dot notation vlan
> devices and vlan devices that use the explicit vlan-id and
> vlan-raw-device options, available with ifupdown2, are represented in
> API return values.
> 
> Previously the type for both was 'vlan' but only the latter showed more
> details.
> 
> Setting these values here should not have any influence on how the
> interfaces file is being written as these two values are already
> filtered in __write_etc_network_interfaces for dot notation devices.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>  src/PVE/INotify.pm | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
>

applied, thanks!

Added a small followup to also detect the ID for the "vlanX" variant we allow.




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

* [pve-devel] applied: [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device
  2021-04-12 13:14 ` [pve-devel] [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device Aaron Lauterer
@ 2021-06-15 15:01   ` Thomas Lamprecht
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-06-15 15:01 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer

On 12.04.21 15:14, Aaron Lauterer wrote:
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> 
> There are probably a few opinions if these columns should be hidden by
> default and where they should be placed.
> 
>  src/node/NetworkView.js | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
>

applied, thanks!




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

end of thread, other threads:[~2021-06-15 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 13:14 [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer
2021-04-12 13:14 ` [pve-devel] [PATCH widget-toolkit 1/2] ui: network: add columns for vlan-id and vlan-raw-device Aaron Lauterer
2021-06-15 15:01   ` [pve-devel] applied: " Thomas Lamprecht
2021-04-12 13:14 ` [pve-devel] [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces Aaron Lauterer
2021-06-15 15:01   ` [pve-devel] applied: " Thomas Lamprecht
2021-06-09 13:38 ` [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer

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