From ab5349cf290a2ba616b598dd21fea4a7332e67a1 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 4 Nov 2015 15:39:16 -0500 Subject: [PATCH 1/2] rhels7 also stores the dhcpd/dhcpd6 config in the same /etc/sysconfig/dhcpd file. Add test for rhels7 --- xCAT-server/lib/xcat/plugins/dhcp.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 0fb5d45e2..08447e4c8 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1601,10 +1601,10 @@ sub process_request my $generatedpath = "$syspath/$dhcpver"; my $dhcpd_key = "DHCPDARGS"; - if ($os =~ /sles/i) { + if ($os =~ /sles/i || $os =~ /rhels7/i) { $dhcpd_key = "DHCPD_INTERFACE"; if ($usingipv6 and $dhcpver eq "dhcpd6") { - # For SLES, the dhcpd6 "dhcpver" is going to modify the dhcpd conf file with key=DHCPD6_INTERFACE + # For SLES 11 and RHEL7, the dhcpd6/dhcpd config are stored in the same file $dhcpd_key = "DHCPD6_INTERFACE"; $generatedpath = "$syspath/dhcpd"; } @@ -1664,8 +1664,8 @@ sub process_request } if ($usingipv6) { - # sles had dhcpd and dhcpd6 config in the dhcp file - if ($os =~ /sles/i) { + # sles11.3 and rhels7 has dhcpd and dhcpd6 config in the dhcp file + if ($os =~ /sles/i || $os =~ /rhels7/i) { if ($missingfiles{dhcpd}) { $callback->({error=>["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"]}); } From da9d6a23ef2486d44e2ef2e9204d89f8c1d70534 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 18 Nov 2015 13:13:06 -0500 Subject: [PATCH 2/2] Add code to check the os version by looking for the digit values in the $os string. If >= SLES 11 or >= RHEL 7, dhcpd and dhcpd6 share the same configuration file --- xCAT-server/lib/xcat/plugins/dhcp.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 08447e4c8..da337392d 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1601,10 +1601,15 @@ sub process_request my $generatedpath = "$syspath/$dhcpver"; my $dhcpd_key = "DHCPDARGS"; - if ($os =~ /sles/i || $os =~ /rhels7/i) { + # For SLES11+ and RHEL7+ Operating system releases, the + # dhcpd/dhcpd6 configuration is stored in the same file + my $os_ver = $os; + $os_ver =~ s/[^0-9.^0-9]//g; + if (($os =~ /sles/i && $os_ver >= 11) || + ($os =~ /rhels/i && $os_ver >= 7)) { + $dhcpd_key = "DHCPD_INTERFACE"; if ($usingipv6 and $dhcpver eq "dhcpd6") { - # For SLES 11 and RHEL7, the dhcpd6/dhcpd config are stored in the same file $dhcpd_key = "DHCPD6_INTERFACE"; $generatedpath = "$syspath/dhcpd"; }