all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] Fix #2711: inotify: Allow 'v' as VLAN separator
Date: Wed, 14 Apr 2021 11:53:12 +0200	[thread overview]
Message-ID: <20210414095313.96550-1-d.jaeger@proxmox.com> (raw)

VLANs with a name like vmbr0v5 had type UNKNOWN unless vlan-raw-device was set.
This way we return type VLAN for them as we do for vmbr0.5

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 src/PVE/INotify.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 2bb87bb..adcc91a 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -27,6 +27,8 @@ use base 'Exporter';
 
 our @EXPORT_OK = qw(read_file write_file register_file);
 
+my $VLAN_RE = qr!^(\S+)[v\.](\d+)$!;
+
 my $ccache;
 my $ccachemap;
 my $ccacheregex;
@@ -1077,7 +1079,7 @@ sub __read_etc_network_interfaces {
 		$ifaces->{$1}->{exists} = 0;
 		$d->{exists} = 0;
 	    }
-	} elsif ($iface =~ m/^(\S+)\.\d+$/ || $d->{'vlan-raw-device'}) {
+	} elsif ($iface =~ $VLAN_RE || $d->{'vlan-raw-device'}) {
 	    $d->{type} = 'vlan';
 
 	    my $raw_iface = $d->{'vlan-raw-device'} ? $d->{'vlan-raw-device'} : $1;
@@ -1550,7 +1552,7 @@ sub __write_etc_network_interfaces {
 	    my $p = undef;
 	    my $vlanid = undef;
 
-	    if ($iface =~ m/^(\S+)\.(\d+)$/) {
+	    if ($iface =~ $VLAN_RE) {
 		$p = $1;
 		$vlanid = $2;
 		delete $d->{'vlan-raw-device'} if $d->{'vlan-raw-device'};
-- 
2.20.1




             reply	other threads:[~2021-04-14  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  9:53 Dominic Jäger [this message]
2021-04-14  9:53 ` [pve-devel] [PATCH widget-toolkit] Fix #2711: vlan edit: " Dominic Jäger
2021-04-14 11:26 ` [pve-devel] [PATCH common] Fix #2711: inotify: " Fabian Grünbichler

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=20210414095313.96550-1-d.jaeger@proxmox.com \
    --to=d.jaeger@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal