public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces
Date: Mon, 12 Apr 2021 15:14:38 +0200	[thread overview]
Message-ID: <20210412131438.15859-3-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20210412131438.15859-1-a.lauterer@proxmox.com>

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





  parent reply	other threads:[~2021-04-12 13:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Aaron Lauterer [this message]
2021-06-15 15:01   ` [pve-devel] applied: [PATCH common 2/2] inotify: read_interfaces: add vlan-id and vlan-raw-device on dot notation vlan interfaces Thomas Lamprecht
2021-06-09 13:38 ` [pve-devel] [RFC series 0/2] Show more vlan infos Aaron Lauterer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210412131438.15859-3-a.lauterer@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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