pf-tools/pf-tools: * removing $Id$ line which can introduce conf...

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Fri Aug 17 12:07:12 UTC 2012


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/2e861f56e912
changeset: 1182:2e861f56e912
user:      "Christophe Caillet <quadchris at free.fr>"
date:      Fri Aug 17 13:41:30 2012 +0200
description:
* removing $Id$ line which can introduce conflicts with mercurial' push
* adding link description in docs and handling interfaces as link
  and not as physical devices (WIP)
* placing __get_host_interfaces out useless in the loop

diffstat:

 debian/changelog           |   7 +++++--
 doc/hostfile-links-sample  |  41 +++++++++++++++++++++++++++++++++++++++++
 doc/hostfile-syntax        |  15 +++++++++++++++
 lib/PFTools/Conf/Host.pm   |  35 +++++++++++++++++++++++++++++++++--
 lib/PFTools/Conf/Syntax.pm |  13 +++++++++++++
 5 files changed, 107 insertions(+), 4 deletions(-)

diffs (181 lines):

diff -r eeaa592fd056 -r 2e861f56e912 debian/changelog
--- a/debian/changelog	Mon Jan 02 11:35:45 2012 +0100
+++ b/debian/changelog	Fri Aug 17 13:41:30 2012 +0200
@@ -21,7 +21,7 @@
   * use remove_tree only if $co_dir exists
   * fix Get_source: hostname IS NOT mandatory
   * use IO::File in sbin/*
-  * removing $Id$ line wich can introduce conflicts wiuth mercurial' push
+  * removing $Id$ line which can introduce conflicts with mercurial' push
   * using Module::Runtime in PFTools::VCS with same function name on both
     module PFTools::VCS::CVS and PFTools::VCS::SVN
   * adding PFTools::VCS::CVS and PFTools::VCS::SVN
@@ -37,8 +37,11 @@
     which overrides the preseed key in pf-tools.conf file
   * adding pxetemplate as in pf-tools 0.X in section boot on hostfile
   * adding the specified template in parameter for make_pxe_boot_preseed_files 
+  * adding link description in docs and handling interfaces as link
+    and not as physical devices (WIP)
+  * placing __get_host_interfaces out useless in the loop
 
- -- Christophe Caillet <quadchris at free.fr>  Thu, 03 Mar 2011 14:57:31 +0100
+ -- Christophe Caillet <tof at sitadelle.com>  Fri, 17 Aug 2012 13:35:48 +0200
 
 pf-tools (1.0-1) unstable; urgency=low
 
diff -r eeaa592fd056 -r 2e861f56e912 doc/hostfile-links-sample
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/hostfile-links-sample	Fri Aug 17 13:41:30 2012 +0200
@@ -0,0 +1,41 @@
+[link::vlan-systeme]
+	type.default	= ether
+	dev.default	= eth0
+	mac.0		= 00:00:00:00:00:00
+	vlan.default	= vlan-systeme
+	ipv4.default	= 3.0
+	ipv4.1		= 3.12
+
+[link::vlan-admindsi]
+	type.default	= ether
+	dev.default	= eth0.TAG1
+	ipv4.default	= 12
+
+[link::vlan-pfds-ext]
+[interface::bond0]
+	type.default	= bond
+	dev.default	= bond0
+	slaves.default	= eth2,eth3
+	options.default	= mode=active-backup,miimon=100
+	options.1	= mode=802.3ad,xmit_hash_policy=layer3+4,miimon=100
+	ipv4.default	= 92
+	@route		= 224.0.0.0/4
+	@route		= default via GATEWAY
+	
+[deployment]
+	mode.default	= debian
+	arch.default	= amd64
+	distrib.default	= lenny
+
+[hostgroup]
+	number		= 2
+	order		= 1
+
+[boot]
+	pxefilename.default	= pxelinux.0
+	kernel.default		= vmlinuz-2.6.26.5-universal-grm2.1.12
+	console.default		= default
+
+[dns]
+	resolver.default	= vip-spawn.private,nscache.private
+	shortname.default	= vlan-systeme
diff -r eeaa592fd056 -r 2e861f56e912 doc/hostfile-syntax
--- a/doc/hostfile-syntax	Mon Jan 02 11:35:45 2012 +0100
+++ b/doc/hostfile-syntax	Fri Aug 17 13:41:30 2012 +0200
@@ -1,3 +1,17 @@
+[link::<NETWORK_NAME>]
+	! type[.%HOSTNUM%]		::= ether|bond|bridge
+	! dev[.%HOSTNUM%]		::= <IFACE_NAME> || NONE if link doesn't exist for the specified %HOSTNUM%
+	! mac.%HOSTNUM%			::= <MAC_ADDR> WARNING this directive MUST BE defined for interface which is used for deployment
+	? slaves[.%HOSTNUM%]		::= comma separated list of <IFACE>, WARNING this directive is mandatory if type[.%HOSTNUM%] is defined
+					    as a bonding interface will be ignored if type[.%HOSTNUM%] is not
+	? options[.%HOSTNUM%]		::= see interfaces docs for misc options
+	! ipv4[.%HOSTNUM%]		::= <IPV4_ADDR> if default is used then act as old ipstart directive
+	? ipv6[.%HOSTNUM%]		::= <IPV6_ADDR> if default is used then act as old ipstart directive
+	? iface_opt[%HOSTNUM%]		::= <IFACE_OPT> define here iface options (ip link syntax)
+	? @route[.default|%HOSTNUM%]	::= <SUBNET>/<NETMASK> [via <GATEWAY>] (ip route syntax)
+	? @route6[.default|%HOSTNUM%]	::= <SUBNET>/<NETMASK> [via <GATEWAY>] (ip route syntax)
+	
+
 [interface::ethX]
 	? mac[.%HOSTNUM%]				::= <MAC_ADDR> WARNING this directive MUST BE defined for interface which is used for deployment
 	! vlan[.%HOSTNUM%]				::= <NETWORK_NAME> as defined in network configurations part in PF-TOOLS
@@ -62,6 +76,7 @@
 	? initrduml[.%HOSTNUM%]		::= <INITRD_FILENAME> this filename is searched into the kernel tftp directory define in pf-tools.conf
 	? cmdline[.%HOSTNUM%]		::= misc options on cmdline see kernel docs
 	? console[.%HOSTNUM%]		::= [default|ttyS0,115200n8]
+	? eth_order			::= comma separated list of links as defined in section name link::<NETWORK_NAME>
 
 [dns]
 	! resolver[.%HOSTNUM%]		::= <IPV4_ADDR|IPV6_ADDR|HOSTNAME>[,<IPV4_ADDR|IPV6_ADDR|HOSTNAME>] : HOSTNAME as defined in PF-TOOLS configurations
diff -r eeaa592fd056 -r 2e861f56e912 lib/PFTools/Conf/Host.pm
--- a/lib/PFTools/Conf/Host.pm	Mon Jan 02 11:35:45 2012 +0100
+++ b/lib/PFTools/Conf/Host.pm	Fri Aug 17 13:41:30 2012 +0200
@@ -126,7 +126,8 @@
                 'prefix'         => $prefix,
             }
         );
-
+	my @if_list = __get_host_interfaces($host_ref);
+        
         foreach my $hostname ( sort keys %{$host_list} ) {
             my $host_number = $host_list->{$hostname}->{'host_number'};
             my $index       = $host_list->{$hostname}->{'index'};
@@ -159,7 +160,7 @@
             }
 
             # Check interfaces
-            my @if_list = __get_host_interfaces($host_ref);
+            
             foreach my $iface (@if_list) {
                 my $new_iface_ref = __build_iface_entry(
                     {   iface_name     => $iface,
@@ -486,6 +487,36 @@
     return $hostname;
 }
 
+=head2 __get_host_links($host_ref)
+
+This function returns the list of links for a given host.  I<$host_ref>
+is a reference to the host configuration hash (parsed hostfile).
+
+=cut
+
+sub __get_host_links {
+    my ($host_ref) = @_;
+
+    my @link_list = ();
+    foreach my $section ( keys %{$host_ref} ) {
+        my ($link) = $section =~ m{
+            \A
+            link::
+            (
+                (?:		# name
+		    [^\s:]+
+		)
+            )
+            \z
+        }xms;
+        next if not $link;
+
+        push @link_list, $link;
+    }
+
+    return @link_list;
+}
+
 =head2 __get_host_interfaces($host_ref)
 
 This function returns the list of interfaces for a given host.  I<$host_ref>
diff -r eeaa592fd056 -r 2e861f56e912 lib/PFTools/Conf/Syntax.pm
--- a/lib/PFTools/Conf/Syntax.pm	Mon Jan 02 11:35:45 2012 +0100
+++ b/lib/PFTools/Conf/Syntax.pm	Fri Aug 17 13:41:30 2012 +0200
@@ -132,6 +132,19 @@
 # }
 our $DEF_SECTIONS = {
     'host' => {
+        'link' => {
+            'MANDATORY_KEYS' => [ 'type', 'dev' ],
+            'type'	=> 'ether|bond|bridge|tun|tap',
+            'dev'	=> '((eth|bond|br|tun|tap)[\d]+|NONE)',
+            'mac'       => '([0-9a-f]{2}:){5}[0-9a-f]{2}',
+            'options'   => 'undefined',
+            'ipv4'      => '(\d{1,3})((\.\d{1,3}){1,3})?',
+            'slaves'    => 'e(th)?\d+(\s*,\s*e(th)?\d+)+',
+            'ipv6'      => 'undefined',
+            'iface_opt' => 'undefined',
+            '@route'    => 'undefined',
+            '@route6'   => 'undefined',
+        },
         'interface' => {
             'MANDATORY_KEYS' => [ 'vlan', 'ipv4', 'slaves' ],
             'mac'       => '([0-9a-f]{2}:){5}[0-9a-f]{2}',



More information about the pf-tools-commits mailing list