mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-04 20:17:55 +00:00
refactor(dhcp): expose ISC client boot policy
This commit is contained in:
@@ -102,6 +102,50 @@ sub kea_httpboot_network_classes {
|
||||
return \@classes;
|
||||
}
|
||||
|
||||
sub isc_client_architecture_lines {
|
||||
my ( $class, %opts ) = @_;
|
||||
|
||||
my $tftp = $opts{next_server} // '';
|
||||
my $portsuffix = $opts{portsuffix} // '';
|
||||
my $tftpdir = $opts{tftpdir} // '/tftpboot';
|
||||
my $net = $opts{net} // '';
|
||||
my $maskbits = $opts{prefix} // '';
|
||||
|
||||
return [
|
||||
" if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { #x86, xCAT Network Boot Agent\n",
|
||||
" always-broadcast on;\n",
|
||||
" filename = \"http://$tftp$portsuffix/tftpboot/xcat/xnba/nets/${net}_${maskbits}\";\n",
|
||||
" } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:09 { #x86, xCAT Network Boot Agent\n",
|
||||
" filename = \"http://$tftp$portsuffix/tftpboot/xcat/xnba/nets/${net}_${maskbits}.uefi\";\n",
|
||||
" } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:07 { #x86-64 UEFI, xCAT Network Boot Agent\n",
|
||||
" filename = \"http://$tftp$portsuffix/tftpboot/xcat/xnba/nets/${net}_${maskbits}.uefi\";\n",
|
||||
" } else if option client-architecture = 00:00 { #x86\n",
|
||||
" filename \"xcat/xnba.kpxe\";\n",
|
||||
" } else if option vendor-class-identifier = \"Etherboot-5.4\" { #x86\n",
|
||||
" filename \"xcat/xnba.kpxe\";\n",
|
||||
" } else if option client-architecture = 00:07 { #x86_64 uefi\n ",
|
||||
" filename \"xcat/xnba.efi\";\n",
|
||||
" } else if option client-architecture = 00:09 { #x86_64 uefi alternative id\n ",
|
||||
" filename \"xcat/xnba.efi\";\n",
|
||||
" } else if option client-architecture = 00:02 { #ia64\n ",
|
||||
" filename \"elilo.efi\";\n",
|
||||
" } else if option client-architecture = 00:0b { #aaarch64\n ",
|
||||
" filename \"boot/grub2/grub2.aarch64\";\n",
|
||||
" } else if option client-architecture = 00:1b { #riscv64 uefi\n ",
|
||||
" filename \"boot/grub2/grub2.riscv64\";\n",
|
||||
" } else if option client-architecture = 00:1c { #riscv64 uefi http boot\n ",
|
||||
" option vendor-class-identifier \"HTTPClient\";\n",
|
||||
" filename \"http://$tftp$portsuffix$tftpdir/boot/grub2/grub2.riscv64\";\n",
|
||||
" } else if option client-architecture = 00:0e { #OPAL-v3\n ",
|
||||
" option conf-file = \"http://$tftp$portsuffix/tftpboot/pxelinux.cfg/p/${net}_${maskbits}\";\n",
|
||||
" } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n",
|
||||
" option www-server = \"http://$tftp$portsuffix/install/onie/onie-installer\";\n",
|
||||
" } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ",
|
||||
" filename \"/yaboot\";\n",
|
||||
" }\n",
|
||||
];
|
||||
}
|
||||
|
||||
sub kea_xnba_node_classes {
|
||||
my ( $class, %opts ) = @_;
|
||||
|
||||
|
||||
@@ -4454,46 +4454,13 @@ sub addnet
|
||||
}
|
||||
|
||||
# $lstatements = 'if exists gpxe.bus-id { filename = \"\"; } else if exists client-architecture { filename = \"xcat/xnba.kpxe\"; } '.$lstatements;
|
||||
push @netent, " if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { #x86, xCAT Network Boot Agent\n";
|
||||
push @netent, " always-broadcast on;\n";
|
||||
push @netent, " filename = \"http://$tftp$portsuffix/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . "\";\n";
|
||||
push @netent, " } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:09 { #x86, xCAT Network Boot Agent\n";
|
||||
push @netent, " filename = \"http://$tftp$portsuffix/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . ".uefi\";\n";
|
||||
push @netent, " } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:07 { #x86-64 UEFI, xCAT Network Boot Agent\n";
|
||||
push @netent, " filename = \"http://$tftp$portsuffix/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . ".uefi\";\n";
|
||||
push @netent, " } else if option client-architecture = 00:00 { #x86\n";
|
||||
push @netent, " filename \"xcat/xnba.kpxe\";\n";
|
||||
push @netent, " } else if option vendor-class-identifier = \"Etherboot-5.4\" { #x86\n";
|
||||
push @netent, " filename \"xcat/xnba.kpxe\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:07 { #x86_64 uefi\n ";
|
||||
push @netent, " filename \"xcat/xnba.efi\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:09 { #x86_64 uefi alternative id\n ";
|
||||
push @netent, " filename \"xcat/xnba.efi\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:02 { #ia64\n ";
|
||||
push @netent, " filename \"elilo.efi\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:0b { #aaarch64\n ";
|
||||
push @netent, " filename \"boot/grub2/grub2.aarch64\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:1b { #riscv64 uefi\n ";
|
||||
push @netent, " filename \"boot/grub2/grub2.riscv64\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:1c { #riscv64 uefi http boot\n ";
|
||||
push @netent, " option vendor-class-identifier \"HTTPClient\";\n";
|
||||
push @netent, " filename \"http://$tftp$portsuffix$tftpdir/boot/grub2/grub2.riscv64\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:0e { #OPAL-v3\n ";
|
||||
push @netent, " option conf-file = \"http://$tftp$portsuffix/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n";
|
||||
push @netent,
|
||||
" } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n";
|
||||
push @netent, " option www-server = \"http://$tftp$portsuffix/install/onie/onie-installer\";\n";
|
||||
push @netent,
|
||||
" } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ";
|
||||
push @netent, " filename \"/yaboot\";\n";
|
||||
push @netent, " }\n";
|
||||
push @netent, @{ xCAT::DHCP::BootPolicy->isc_client_architecture_lines(
|
||||
next_server => $tftp,
|
||||
portsuffix => $portsuffix,
|
||||
tftpdir => $tftpdir,
|
||||
net => $net,
|
||||
prefix => $maskbits,
|
||||
) };
|
||||
|
||||
if ($range) {
|
||||
foreach my $singlerange (split /;/, $range) {
|
||||
|
||||
Reference in New Issue
Block a user