mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
appending "statement" within makedhcp rather than from nodeset, this commit include grub2,petitboot and nimol netboot method
This commit is contained in:
parent
e20703010f
commit
a84a9e655b
@ -616,6 +616,14 @@ sub addnode
|
||||
$lstatements = 'if option vendor-class-identifier = \"ScaleMP\" { filename = \"vsmp/pxelinux.0\"; } else { filename = \"pxelinux.0\"; }'.$lstatements;
|
||||
}
|
||||
}
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'yaboot') {
|
||||
$lstatements = 'filename = \"/yb/node/yaboot-'.$node.'\";'.$lstatements;
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'grub2') {
|
||||
$lstatements = 'filename = \"/boot/grub2/grub2-'.$node.'\";'.$lstatements;
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') {
|
||||
$lstatements = 'option conf-file \"http://'.$nxtsrv.'/tftpboot/petitboot/'.$node.'\";'.$lstatements;
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') {
|
||||
$lstatements = 'supersede server.filename=\"/vios/nodes/'.$node.'\"'.$lstatements;
|
||||
}
|
||||
|
||||
|
||||
|
@ -580,27 +580,36 @@ sub process_request {
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
chdir("$tftpdir/boot/grub2/");
|
||||
foreach my $tmp_node (@{$osimagenodehash{$osimage}}) {
|
||||
unless (-e "grub2-$tmp_node") {
|
||||
symlink("grub2.".$validarch, "grub2-$tmp_node");
|
||||
}
|
||||
}
|
||||
if ($do_dhcpsetup) {
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=>\@{$osimagenodehash{$osimage}},
|
||||
arg=>['-l','-s','filename = \"'.$grub2.'\";']},$callback);
|
||||
node=>\@{$osimagenodehash{$osimage}}}, $callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=>\@{$osimagenodehash{$osimage}},
|
||||
arg=>['-s','filename = \"'.$grub2.'\";']},$callback);
|
||||
node=>\@{$osimagenodehash{$osimage}}},$callback);
|
||||
}
|
||||
}
|
||||
} #end of foreach osimagenodehash
|
||||
|
||||
foreach my $tmp_node (@breaknetboot) {
|
||||
if (-e "$tftpdir/boot/grub2/grub2-$tmp_node") {
|
||||
unlink("$tftpdir/boot/grub2/grub2-$tmp_node");
|
||||
}
|
||||
}
|
||||
if ($do_dhcpsetup) {
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=>\@breaknetboot,
|
||||
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
|
||||
arg=>['-l']},$callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=>\@breaknetboot,
|
||||
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
|
||||
node=>\@breaknetboot},$callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -409,8 +409,13 @@ sub create_imgconf_file {
|
||||
my $subreq = shift;
|
||||
my $nim_root = shift;
|
||||
my $bootimg_root = shift;
|
||||
my $relative_path = $bootimg_root;
|
||||
my $bootimg_link = "/tftpboot/vios/nodes";
|
||||
my $relative_path = $bootimg_link;
|
||||
$relative_path =~ s/^\/tftpboot//;
|
||||
# check the dir where the bootimage link file and bootimage configuration file stored
|
||||
unless (-e $bootimg_link) {
|
||||
mkpath($bootimg_link);
|
||||
}
|
||||
# Get nodes network information
|
||||
my %nethash = ();
|
||||
%nethash = xCAT::DBobjUtils->getNetwkInfo($nodes);
|
||||
@ -428,7 +433,7 @@ sub create_imgconf_file {
|
||||
unless (-e $bootimg_root."/viobootimg") {
|
||||
return "Unable to find VIOS bootimg file";
|
||||
}
|
||||
chdir($bootimg_root);
|
||||
chdir($bootimg_link);
|
||||
foreach my $node (@$nodes) {
|
||||
my $bootimg_conf_fd;
|
||||
my $gateway = $nethash{$node}{gateway};
|
||||
@ -438,18 +443,17 @@ sub create_imgconf_file {
|
||||
my $master = xCAT::NetworkUtils->gethostname($master_node);
|
||||
my $master_ip = xCAT::NetworkUtils->getipaddr($master);
|
||||
my $node_ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $relative_bootfile = $relative_path."/viobootimg-$node";
|
||||
unless (-e "viobootimg-$node") {
|
||||
symlink("viobootimg", "viobootimg-$node");
|
||||
unless (-e "$node") {
|
||||
symlink($bootimg_root."/viobootimg", "$node");
|
||||
}
|
||||
if (-e $bootimg_root."/viobootimg-$node.info") {
|
||||
unlink($bootimg_root."/viobootimg-$node.info");
|
||||
if (-e $bootimg_link."/$node.info") {
|
||||
unlink($bootimg_link."/$node.info");
|
||||
}
|
||||
open ($bootimg_conf_fd, ">", $bootimg_root."/viobootimg-$node.info");
|
||||
open ($bootimg_conf_fd, ">", $bootimg_link."/$node.info");
|
||||
print $bootimg_conf_fd "export NIM_SERVER_TYPE=linux\n";
|
||||
print $bootimg_conf_fd "export NIM_SYSLOG_PORT=514\n";
|
||||
print $bootimg_conf_fd "export NIM_SYSLOG_FACILITY=local2\n";
|
||||
print $bootimg_conf_fd "export NIM_NAME=viobootimg-$node\n";
|
||||
print $bootimg_conf_fd "export NIM_NAME=$node\n";
|
||||
print $bootimg_conf_fd "export NIM_HOSTNAME=$node\n";
|
||||
print $bootimg_conf_fd "export NIM_CONFIGURATION=standalone\n";
|
||||
print $bootimg_conf_fd "export NIM_MASTER_HOSTNAME=$master\n";
|
||||
@ -472,8 +476,7 @@ sub create_imgconf_file {
|
||||
close($bootimg_conf_fd);
|
||||
|
||||
$subreq->({command=>['makedhcp'],
|
||||
node=>[$node],
|
||||
arg=>['-s', 'supersede server.filename=\"'.$relative_bootfile.'\";']}, $global_callback);
|
||||
node=>[$node]}, $global_callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +509,7 @@ sub nodeset {
|
||||
if ($ref) {
|
||||
if ($ref->{provmethod} and $ref->{provmethod} eq 'nimol' and $ref->{osdistroname}) {
|
||||
$nim_root = $installroot."/nim/".$ref->{osdistroname};
|
||||
$bootimg_root = "/tftpboot/".$ref->{osdistroname}."/nodes";
|
||||
$bootimg_root = "/tftpboot/".$ref->{osdistroname};
|
||||
} else {
|
||||
$callback->({error=>["The 'provmethod' for OS image $osimage can only be 'nimol'."], errorcode=>[1]});
|
||||
return;
|
||||
|
@ -472,24 +472,19 @@ sub process_request {
|
||||
if (defined($t_entry) ) {
|
||||
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
|
||||
}
|
||||
|
||||
if ($do_dhcpsetup) {
|
||||
foreach my $node (@normalnodeset) {
|
||||
my $server = xCAT::TableUtils->GetMasterNodeName($node);
|
||||
my $ipfn = xCAT::NetworkUtils->my_ip_facing($server);
|
||||
if(($server != 1) and defined($ipfn)) {
|
||||
my $fpath = "http://$ipfn/tftpboot/petitboot/$node";
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback);
|
||||
}
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-l']},$callback);
|
||||
#arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node]}, $callback);
|
||||
#arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user