2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 19:22:05 +00:00

Merge pull request #1930 from zet809/fix_issue_1881

Provide a 'noboot' option to disable genesis kernel on specific dhcp interfaces
This commit is contained in:
Victor Hu 2016-10-14 09:45:11 -04:00 committed by GitHub
commit c7e9625d3f
2 changed files with 48 additions and 0 deletions

View File

@ -1383,6 +1383,8 @@ sub process_request
my $querynics = 1;
if (xCAT::Utils->isServiceNode() and $dhcpinterfaces and $dhcpinterfaces->{dhcpinterfaces}) {
# The keyword 'noboot' was appended to the NICs that doesn't need to reply DHCP configuration file, only used for mknb at present.
$dhcpinterfaces->{dhcpinterfaces} =~ s/:noboot//g;
my @dhcpifs = split ',', $dhcpinterfaces->{dhcpinterfaces};
foreach my $nic (@dhcpifs) {
$activenics{$nic} = 1;
@ -1404,6 +1406,9 @@ sub process_request
#depending on complexity of network wished to be described
{
my $dhcpinterfaces = $t_entry;
# The keyword 'noboot' was appended to the NICs that doesn't need to reply DHCP configuration file, only used for mknb at present.
$dhcpinterfaces =~ s/:noboot//g;
my $dhcpif;
INTF: foreach $dhcpif (split /;/, $dhcpinterfaces) {
my $host;

View File

@ -18,6 +18,7 @@ sub process_request {
my $serialport;
my $serialspeed;
my $serialflow;
my %nobootnicips = ();
my $initrd_file = undef;
my $xcatdport = 3001;
my @entries = xCAT::TableUtils->get_site_attribute("defserialport");
@ -43,6 +44,41 @@ sub process_request {
if (defined($t_entry)) {
$xcatdport = $t_entry;
}
@entries = xCAT::TableUtils->get_site_attribute("dhcpinterfaces");
$t_entry = $entries[0];
if (defined($t_entry)) {
my %nobootnics = ();
foreach my $dhcpif (split /;/, $t_entry) {
if ($dhcpif =~ /\|/) {
my $isself = 0;
(my $ngroup, $dhcpif) = split /\|/, $dhcpif;
foreach my $host (noderange($ngroup)) {
unless(xCAT::NetworkUtils->thishostisnot($host)) {
$isself = 1;
}
}
unless(xCAT::NetworkUtils->thishostisnot($ngroup)) {
$isself = 1;
}
unless ($isself) {
next;
}
}
foreach (split /[,\s]+/, $dhcpif) {
my ($nicname, $flag) = split /:/;
if ($flag and $flag =~ /noboot/i) {
$nobootnics{$nicname} = 1;
}
}
}
my $nicips = xCAT::NetworkUtils->get_nic_ip();
foreach (keys %nobootnics) {
if (defined($nicips->{$_})) {
$nobootnicips{$nicips->{$_}} = 1;
}
}
}
my $tftpdir = xCAT::TableUtils->getTftpDir();
my $arch = $request->{arg}->[0];
@ -207,7 +243,14 @@ sub process_request {
my $dopxe = 0;
foreach (keys %{$normnets}) {
my $net = $_;
my $nicip = $normnets->{$net};
$net =~ s/\//_/;
if (defined($nobootnicips{$nicip})) {
if ($arch =~ /ppc/ and -r "$tftpdir/pxelinux.cfg/p/$net") {
unlink("$tftpdir/pxelinux.cfg/p/$net");
}
next;
}
$dopxe = 0;
if ($arch =~ /x86/) { #only do pxe if just x86 or x86_64 and no x86
if ($arch =~ /x86_64/ and not $invisibletouch) {