]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/INotify.pm
correctly copy bridge config
[pve-common.git] / data / PVE / INotify.pm
index 30290ca38b7b158c9e8d2fe234aa439ab2667381..360551268efe18aaa3a229ef3cdbc348832aea64 100644 (file)
@@ -821,6 +821,8 @@ sub read_etc_network_interfaces {
                        $d->{$id} = $value;
                    } elsif ($id eq 'bond_miimon') {
                        $d->{$id} = $value;
+                   } elsif ($id eq 'bond_xmit_hash_policy') {
+                       $d->{$id} = $value;
                    } elsif ($id eq 'bond_mode') {
                        # always use names
                        foreach my $bm (keys %$bond_modes) {
@@ -872,6 +874,8 @@ sub read_etc_network_interfaces {
                if ($d->{'bond_mode'} eq 'balance-tcp') {
                    $d->{'bond_mode'} = 'lacp-balance-tcp';
                }
+               my $tag = &$extract_ovs_option($d, 'tag');
+               $d->{ovs_tag} = $tag if defined($tag);
            } else {
                $d->{type} = 'unknown';
            }
@@ -903,6 +907,8 @@ sub read_etc_network_interfaces {
                $d->{type} = 'eth';
            } elsif ($d->{ovs_type} eq 'OVSPort') {
                $d->{type} = $d->{ovs_type};
+               my $tag = &$extract_ovs_option($d, 'tag');
+               $d->{ovs_tag} = $tag if defined($tag);
            } else {
                $d->{type} = 'unknown';
            }
@@ -913,6 +919,8 @@ sub read_etc_network_interfaces {
                $d->{type} = 'unknown';
            } elsif ($d->{ovs_type} eq 'OVSIntPort') {
                $d->{type} = $d->{ovs_type};
+               my $tag = &$extract_ovs_option($d, 'tag');
+               $d->{ovs_tag} = $tag if defined($tag);
            }
        }
 
@@ -976,6 +984,12 @@ sub __interface_to_string {
        $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";
+       }
+       $done->{'bond_xmit_hash_policy'} = 1;
+
     } elsif ($d->{type} eq 'OVSBridge') {
 
        $raw .= "\tovs_type $d->{type}\n";
@@ -989,6 +1003,11 @@ sub __interface_to_string {
 
        $d->{autostart} = 0; # started by the bridge
 
+       if (defined($d->{ovs_tag})) {
+           &$set_ovs_option($d, tag => $d->{ovs_tag});
+       }
+       $done->{ovs_tag} = 1;
+
        if ($d->{type} eq 'OVSBond') {
 
            $d->{bond_mode} = 'active-backup' if !$d->{bond_mode};