pf-tools commit: r580 [ccaillet-guest] - in /trunk: README.doc debian/changelog lib/PFTools/Net.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Mar 4 10:19:43 UTC 2008


Author: ccaillet-guest
Date: Tue Mar  4 10:19:43 2008
New Revision: 580

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=580
Log:
* adding bonding settings for hosts
* adding ERR: message when an interface ethX is defined in bonding and in an
  interface defintion

Modified:
    trunk/README.doc
    trunk/debian/changelog
    trunk/lib/PFTools/Net.pm

Modified: trunk/README.doc
URL: http://svn.debian.org/wsvn/pf-tools/trunk/README.doc?rev=580&op=diff
==============================================================================
--- trunk/README.doc (original)
+++ trunk/README.doc Tue Mar  4 10:19:43 2008
@@ -6,6 +6,24 @@
 
 ========================================================================
 private-network :
+
+* bonding.<bond_iface>.HOSTNUM or bonding.<bond_iface>.default
+
+  [optional]
+
+  If defined, it creates a bond interface on hosts with the slaves defined as
+  values. The value is a comma-separated list of physical interface. After this
+  definition we can use interface <bond_iface> like other interfaces
+
+  Sample use :
+    To define a bond interface bond0 with eth2 and eth3 as slaves and affecting
+    bond0 on vlan-filer
+
+    [host%%]
+        ...
+        bonding.bond0.default	= eth2,eth3
+	...
+	interface.bond0		= vlan-filer
 
 * cmdline
 

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=580&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Tue Mar  4 10:19:43 2008
@@ -32,6 +32,9 @@
   * adding ERR: message and aborting when two interfaces are on the same vlan
     for a same host
   * factorizing code in Add_server from Net.pm
+  * adding bonding settings for hosts
+  * adding ERR: message when an interface ethX is defined in bonding and in an
+    interface defintion
 
   [ Thomas Parmelan ]
   * lib-net: if no comment is specified in a zone, network or server
@@ -43,7 +46,7 @@
   * Update my email address.
   * Merge the remaining changes from 0.32.47-1 and 0.32.48-1.
 
- -- Christophe Caillet <quadchris at free.fr>  Tue, 05 Feb 2008 15:01:59 +0100
+ -- Christophe Caillet <quadchris at free.fr>  Tue, 04 Mar 2008 10:41:17 +0100
 
 pf-tools (0.32.48-1) unstable; urgency=low
 

Modified: trunk/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Net.pm?rev=580&op=diff
==============================================================================
--- trunk/lib/PFTools/Net.pm (original)
+++ trunk/lib/PFTools/Net.pm Tue Mar  4 10:19:43 2008
@@ -962,6 +962,25 @@
 
 	    delete $M->{'console'} if $M->{'console'} and $M->{'console'} eq 'default';
 
+	    if ( defined $S->{'bonding'} ) {
+		foreach my $bond ( keys %{$S->{'bonding'}} ) {
+		    if ( defined $S->{'bonding'}->{$bond}->{$mnamindexnum} ) {
+		    	@{$M->{'bonding'}->{$bond}} = split ( /,/, $S->{'bonding'}->{$bond}->{$mnamindexnum} ) ;
+		    }
+		    elsif ( defined $S->{'bonding'}->{$bond}->{'default'} ) {
+		    	@{$M->{'bonding'}->{$bond}} = split ( /,/, $S->{'bonding'}->{$bond}->{'default'} ) ;
+		    }
+		    else {
+			Abort( $ERR_SYNTAX, "No default bonding config defined for interface ".$bond ) ;
+		    }
+		    foreach my $iface ( @{$M->{'bonding'}->{$bond}} ) {
+			if ( defined $S->{'interface'}->{$iface} ) {
+			    Abort ( $ERR_SYNTAX, "Cannot defined interface ".$iface." which is already on bonding definition ".$bond ) ;
+			}
+		    }
+		}
+	    }
+
 	    # vrrp?
 	    my $vrrp;
 	    foreach $j ( keys %{ $S->{'vrrp'} } ) {
@@ -1012,7 +1031,7 @@
 		    $lan = $S->{'interface'}->{$i} ;
 		}
 		
-		if ( $i =~ /^eth[\d]+\.([\d]+)$/ && $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} ) {
+		if ( $i =~ /^(?:eth|bond)[\d]+\.([\d]+)$/ && $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} ) {
 		    Warn ( $ERR_SYNTAX, "Tag ".$1." differs from defined tag for vlan ".$lan." on ".$i." for host ".$mnam ) if ( $1 != $Z->{'NETWORK'}->{'BY_NAME'}->{$lan}->{'tag'} );
 		}
 		
@@ -1686,6 +1705,10 @@
 	$net =~ s/^[^\.]+\.//;
 	my $NET = $Z->{'NETWORK'}->{'BY_NAME'}->{$net};
 
+	if ( $M->{'ifup'}->{$nam} =~ /^bond/ ) {
+		print "\tslaves          ".join ( " ", @{$M->{'bonding'}->{$M->{'ifup'}->{$nam}}} )."\n" ;
+	}
+
 	if ($resolve) {
 	    print "\taddress         ", $M->{'zone'}->{$nam}->{'FIELD'}, "\n";
 	    print "\tnetmask         ", $NET->{'netmask'},   "\n";




More information about the pf-tools-commits mailing list