From 91fd0975a560a3c0a35c64398e6324b4f0bf841f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 16 May 2012 12:25:35 +0000 Subject: [PATCH] Add the lease time for dhcpd.conf which can be configured from site table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12732 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Schema.pm | 1 + xCAT-server/lib/xcat/plugins/dhcp.pm | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ee7956b53..5f008c085 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -792,6 +792,7 @@ site => { " specify different NICs for different nodes:\n". " mn|eth1,eth2;service|bond0.\n\n". " dhcpsetup: If set to 'n', it will skip the dhcp setup process in the nodeset cmd.\n\n". + " dhcplease: The lease time for the dhcp client. The default value is 43200.\n\n". " disjointdhcps: If set to '1', the .leases file on a service node only contains\n". " the nodes it manages. The default value is '0'.\n". " '0' value means include all the nodes in the subnet.\n\n". diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 9120a36be..1a17fdd69 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1594,11 +1594,17 @@ sub addnet6 } } + + my $dhcplease = 43200; + if (defined $::XCATSITEVALS{'dhcplease'} && $::XCATSITEVALS{'dhcplease'} ne "") { + $dhcplease = $::XCATSITEVALS{'dhcplease'}; + } + my @netent = ( " subnet6 $net {\n", - " max-lease-time 43200;\n", - " min-lease-time 43200;\n", - " default-lease-time 43200;\n", + " max-lease-time $dhcplease;\n", + " min-lease-time $dhcplease;\n", + " default-lease-time $dhcplease;\n", ); #for now, just do address allocatios (phase 1) #phase 2 (by 2.6 presumably) will include the various things like DNS server and other options allowed by dhcpv6 @@ -1821,11 +1827,15 @@ sub addnet my $maskn = unpack("N", inet_aton($mask)); my $netn = unpack("N", inet_aton($net)); + my $dhcplease = 43200; + if (defined $::XCATSITEVALS{'dhcplease'} && $::XCATSITEVALS{'dhcplease'} ne "") { + $dhcplease = $::XCATSITEVALS{'dhcplease'}; + } @netent = ( " subnet $net netmask $mask {\n", - " max-lease-time 43200;\n", - " min-lease-time 43200;\n", - " default-lease-time 43200;\n" + " max-lease-time $dhcplease;\n", + " min-lease-time $dhcplease;\n", + " default-lease-time $dhcplease;\n" ); if ($gateway) {