Inotify : write network config : use modern syntax for options
authorAlexandre Derumier <aderumier@odiso.com>
Wed, 20 Jun 2018 05:36:55 +0000 (07:36 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 20 Jun 2018 08:11:48 +0000 (10:11 +0200)
-replace options with '_'  with '-'
-use 'bond-slaves' instead 'slaves'

src/PVE/INotify.pm
test/etc_network_interfaces/t.bridge-v4-v6.pl
test/etc_network_interfaces/t.create_network.pl
test/etc_network_interfaces/t.unknown_order.pl
test/etc_network_interfaces/t.update_network.pl

index b2ba33f..a902b73 100644 (file)
@@ -1078,19 +1078,19 @@ sub __interface_to_string {
 
        $d->{bridge_ports} =~ s/[;,\s]+/ /g;
        my $ports = $d->{bridge_ports} || 'none';
-       $raw .= "\tbridge_ports $ports\n";
+       $raw .= "\tbridge-ports $ports\n";
        $done->{bridge_ports} = 1;
 
        my $v = defined($d->{bridge_stp}) ? $d->{bridge_stp} : 'off';
-       $raw .= "\tbridge_stp $v\n";
+       $raw .= "\tbridge-stp $v\n";
        $done->{bridge_stp} = 1;
 
        $v = defined($d->{bridge_fd}) ? $d->{bridge_fd} : 0;
-       $raw .= "\tbridge_fd $v\n";
+       $raw .= "\tbridge-fd $v\n";
        $done->{bridge_fd} = 1;
 
        if( defined($d->{bridge_vlan_aware})) {
-           $raw .= "\tbridge_vlan_aware yes\n";
+           $raw .= "\tbridge-vlan-aware yes\n";
        }
        $done->{bridge_vlan_aware} = 1;
     
@@ -1098,20 +1098,20 @@ sub __interface_to_string {
 
        $d->{slaves} =~ s/[;,\s]+/ /g;
        my $slaves = $d->{slaves} || 'none';
-       $raw .= "\tslaves $slaves\n";
+       $raw .= "\tbond-slaves $slaves\n";
        $done->{slaves} = 1;
 
        my $v = defined ($d->{'bond_miimon'}) ? $d->{'bond_miimon'} : 100;
-       $raw .= "\tbond_miimon $v\n";
+       $raw .= "\tbond-miimon $v\n";
        $done->{'bond_miimon'} = 1;
 
        $v = defined ($d->{'bond_mode'}) ? $d->{'bond_mode'} : 'balance-rr';
-       $raw .= "\tbond_mode $v\n";
+       $raw .= "\tbond-mode $v\n";
        $done->{'bond_mode'} = 1;
 
        if ($d->{'bond_mode'} && $d->{'bond_xmit_hash_policy'} &&
            ($d->{'bond_mode'} eq 'balance-xor' || $d->{'bond_mode'} eq '802.3ad')) {
-           $raw .= "\tbond_xmit_hash_policy $d->{'bond_xmit_hash_policy'}\n";
+           $raw .= "\tbond-xmit-hash-policy $d->{'bond_xmit_hash_policy'}\n";
        }
        $done->{'bond_xmit_hash_policy'} = 1;
 
index 93e5bb5..7818126 100644 (file)
@@ -12,9 +12,9 @@ new_iface('vmbr0', 'bridge', [{ family => 'inet' }], autostart => 1, bridge_port
 expect load('base') . <<"EOF";
 auto vmbr0
 iface vmbr0 inet manual
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 EOF
 
@@ -31,9 +31,9 @@ iface vmbr0 inet static
        address  $ip
        netmask  $nm
        gateway  $gw
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 EOF
 save('with-ipv4', w());
@@ -66,9 +66,9 @@ iface vmbr0 inet6 static
        address  $ip6
        netmask  $nm6
        gateway  $gw6
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 EOF
 
index 22d6c85..e4f15ac 100644 (file)
@@ -35,9 +35,9 @@ iface vmbr0 inet static
        address  10.0.0.2
        netmask  255.255.255.0
        gateway  10.0.0.1
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 CHECK
 
@@ -78,9 +78,9 @@ iface vmbr0 inet static
        address  10.0.0.2
        netmask  255.255.255.0
        gateway  10.0.0.1
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 CHECK
 
index 5ed958f..a4346ca 100644 (file)
@@ -19,49 +19,49 @@ iface eth6 inet manual
 iface eth7 inet manual
 
 iface bond0 inet manual
-       slaves eth0 eth1
-       bond_miimon 100
-       bond_mode balance-alb
+       bond-slaves eth0 eth1
+       bond-miimon 100
+       bond-mode balance-alb
 
 auto bond1
 iface bond1 inet static
        address  10.10.10.$ip
        netmask  255.255.255.0
-       slaves eth2 eth3
-       bond_miimon 100
-       bond_mode balance-alb
+       bond-slaves eth2 eth3
+       bond-miimon 100
+       bond-mode balance-alb
 #       pre-up ifconfig bond1 mtu 9000
 
 auto bond2
 iface bond2 inet manual
-       slaves eth4 eth5
-       bond_miimon 100
-       bond_mode balance-alb
+       bond-slaves eth4 eth5
+       bond-miimon 100
+       bond-mode balance-alb
 # Private networking
 
 iface vlan3 inet static
        address  0.0.0.0
        netmask  0.0.0.0
-       vlan_raw_device bond2
+       vlan-raw-device bond2
 
 iface vlan4 inet static
        address  0.0.0.0
        netmask  0.0.0.0
-       vlan_raw_device bond2
+       vlan-raw-device bond2
 
 iface vlan5 inet static
        address  0.0.0.0
        netmask  0.0.0.0
-       vlan_raw_device bond2
+       vlan-raw-device bond2
 
 auto vmbr0
 iface vmbr0 inet static
        address  192.168.100.13
        netmask  255.255.255.0
        gateway  192.168.100.1
-       bridge_ports bond0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports bond0
+       bridge-stp off
+       bridge-fd 0
 
 auto vlan6
 iface vlan6 inet static
@@ -73,23 +73,23 @@ iface vlan6 inet static
 
 auto vmbr3
 iface vmbr3 inet manual
-       bridge_ports vlan3
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports vlan3
+       bridge-stp off
+       bridge-fd 0
        pre-up ifup vlan3
 
 auto vmbr4
 iface vmbr4 inet manual
-       bridge_ports vlan4
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports vlan4
+       bridge-stp off
+       bridge-fd 0
        pre-up ifup vlan4
 
 auto vmbr5
 iface vmbr5 inet manual
-       bridge_ports vlan5
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports vlan5
+       bridge-stp off
+       bridge-fd 0
        pre-up ifup vlan5
 
 IFACES
index 40fc12a..4bf70cf 100644 (file)
@@ -41,9 +41,9 @@ iface vmbr0 inet static
        address  10.0.0.2
        netmask  255.255.255.0
        gateway  10.0.0.1
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 CHECK
 
@@ -82,9 +82,9 @@ iface vmbr0 inet static
        address  10.0.0.2
        netmask  255.255.255.0
        gateway  10.0.0.1
-       bridge_ports eth0
-       bridge_stp off
-       bridge_fd 0
+       bridge-ports eth0
+       bridge-stp off
+       bridge-fd 0
 
 CHECK
 expect $final;