[pve-devel] [PATCH v2 pve-common 1/4] Inotify : read network config : allow alternative options names

Alexandre Derumier aderumier at odiso.com
Wed Jun 20 07:36:54 CEST 2018


---
 src/PVE/INotify.pm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 445c034..cac7bac 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -804,6 +804,18 @@ sub __read_etc_network_interfaces {
     my $ifaces = $config->{ifaces} = {};
     my $options = $config->{options} = [];
 
+    my $options_alternatives = { 
+	'bond-slaves' => 'slaves',
+	'bond_slaves' => 'slaves',
+	'bond-xmit-hash-policy' => 'bond_xmit_hash_policy',
+	'bond-mode' => 'bond_mode',
+	'bond-miimon' =>'bond_miimon',
+	'bridge-vlan-aware' => 'bridge_vlan_aware',
+	'bridge-fd' => 'bridge_fd',
+	'bridge-stp' => 'bridge_stp',
+	'bridge-ports' => 'bridge_ports'
+    };
+
     my $line;
 
     if ($proc_net_dev) {
@@ -857,6 +869,9 @@ sub __read_etc_network_interfaces {
 		} elsif ($line =~ m/^\s*((\S+)\s+(.+))$/) {
 		    my $option = $1;
 		    my ($id, $value) = ($2, $3);
+
+		    $id = $options_alternatives->{$id} if $options_alternatives->{$id};
+
 		    if (($id eq 'address') || ($id eq 'netmask') || ($id eq 'broadcast') || ($id eq 'gateway')) {
 			$f->{$id} = $value;
 		    } elsif ($id eq 'ovs_type' || $id eq 'ovs_options'|| $id eq 'ovs_bridge' ||
-- 
2.11.0




More information about the pve-devel mailing list