以下操作在裸金属服务管理baremetal节点操作。
DHCP服务器设置
应结合实际网络情况,确保裸金属管理节点应与裸金属物理服务器节点存在网络链路,且已开启DHCP服务。
TFTP服务器设置
- 创建tftp根目录。
- 安装tftp服务。
| sudo yum -y install tftp-server xinetd
|
- 修改tftp配置文件“/etc/xinetd.d/tftp”。
- 打开文件。
vi /etc/xinetd.d/tftp
- 按“i”进入编辑模式,将文件中service tftp字段下的内容修改为如下配置。
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -v -v -v -v -v --blocksize 1350 --map-file /tftpboot/map-file /tftpboot
disable = no
# This is a workaround for Fedora, where TFTP will listen only on
# IPv6 endpoint, if IPv4 flag is not used.
flags = IPv4
}
|
blocksize最大可设置为网卡MTU最大值减32。
- 按“Esc”键,输入:wq!,按“Enter”保存并退出编辑。
- 在tftp根目录创建映射文件。
| echo 're ^(/tftpboot/) /tftpboot/\2' > /tftpboot/map-file
echo 're ^/tftpboot/ /tftpboot/' >> /tftpboot/map-file
echo 're ^(^/) /tftpboot/\1' >> /tftpboot/map-file
echo 're ^([^/]) /tftpboot/\1' >> /tftpboot/map-file
|
- 重新启动xinetd服务。
| sudo systemctl restart xinetd
|
UEFI引导支持
- 在x86服务器上安装Grub2和shim软件包。
| sudo yum install grub2-efi shim
|
- 复制x86引导文件至tftp根目录。
sudo cp /boot/efi/EFI/centos/shim.efi /tftpboot/bootx64.efi
sudo cp /boot/efi/EFI/centos/grubx64.efi /tftpboot/grubx64.efi
- 复制aarch64引导文件至tftp根目录。
在arm服务器上执行sudo yum install grub2-efi shim安装Grub2和shim软件包,将“/boot/efi/EFI/centos/”目录下的shim.efi与grubaa64.efi传输至裸金属管理节点上的tftp根目录,并命名为bootaa64.efi与grubaa64.efi。
例如,可在ARM服务器上执行如下命令:
| sudo yum install grub2-efi shim
scp /boot/efi/EFI/centos/shim.efi ${user}@${ip}:/tftpboot/bootaa64.efi
scp /boot/efi/EFI/centos/grubaa64.efi ${user}@${ip}:/tftpboot/grubaa64.efi
|
应正确配置user、ip以及tftpboot路径。
- 创建grub.cfg文件。
- 创建grub.cfg存放目录。
| GRUB_DIR=/tftpboot/EFI/centos
sudo mkdir -p $GRUB_DIR
|
- 在“/tftpboot/EFI/centos”目录下创建grub.cfg文件。
vi /tftpboot/EFI/centos/grub.cfg
- 按“i”进入编辑模式,在文件中添加如下内容:
| set default=master
set timeout=5
set hidden_timeout_quiet=false
menuentry "master" {
configfile /tftpboot/$net_default_mac.conf
}
|
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存并退出文件。
- 更改grub.cfg的权限:
| sudo chmod 644 $GRUB_DIR/grub.cfg
|
- 创建aarch64平台的grub配置模板文件。
由于grub在不同体系平台下所支持的命令不同,因此需为aarch64平台创建特定的PXE配置模板。
- 在“/tftpboot”路径下创建pxe_grubaa64_config.template文件。
vi /tftpboot/pxe_grubaa64_config.template
- 按“i”进入编辑模式,在文件中添加如下内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | set default=deploy
set timeout=5
set hidden_timeout_quiet=false
menuentry "deploy" {
linux {{ pxe_options.deployment_aki_path }} selinux=0 troubleshoot=0 text {{ pxe_options.pxe_append_params|default("", true) }} BOOTIF=${mac} boot_server={{pxe_options.tftp_server}} ipa-api-url={{ pxe_options['ipa-api-url'] }} coreos.configdrive=0
initrd {{ pxe_options.deployment_ari_path }}
}
menuentry "boot_partition" {
linux {{ pxe_options.aki_path }} root={{ ROOT }} ro text {{ pxe_options.pxe_append_params|default("", true) }} boot_server={{pxe_options.tftp_server}}
initrd {{ pxe_options.ari_path }}
}
menuentry "boot_ramdisk" {
linux {{ pxe_options.aki_path }} root=/dev/ram0 text {{ pxe_options.pxe_append_params|default("", true) }} {{ pxe_options.ramdisk_opts|default('', true) }}
initrd {{ pxe_options.ari_path }}
}
menuentry "boot_whole_disk" {
linux chain.c32 mbr:{{ DISK_IDENTIFIER }}
}
|
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存并退出文件。
- 更改pxe_grubaa64_config.template文件的权限:
| sudo chmod 644 /tftpboot/pxe_grubaa64_config.template
|
Legacy BIOS引导支持
鲲鹏服务器只支持UEFI启动,以下操作实现x86服务器的Legacy BIOS引导支持。
- 在x86服务器上安装syslinux软件包。
| sudo yum install syslinux-tftpboot
|
- 复制PXE镜像及相关文件至tftp根目录。
| sudo cp /usr/share/syslinux/pxelinux.0 /tftpboot
|
若以pxe网络引导方式启动完整磁盘镜像,则需要chain.c32文件:
| sudo cp /boot/extlinux/chain.c32 /tftpboot
|
修改目录文件的权限
| sudo chown -R ironic /tftpboot
sudo chmod -R 755 /tftpboot
|
修改ironic配置文件
- 打开“/etc/ironic/ironic.conf”文件。
vi /etc/ironic/ironic.conf
- 按“i”进入编辑模式,在文件中新增如下内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | [pxe]
tftp_root=/tftpboot
tftp_server=${my_ip}
tftp_master_path = /tftpboot/master_images
pxe_bootfile_name=pxelinux.0
pxe_config_template = $pybasedir/drivers/modules/pxe_config.template
uefi_pxe_bootfile_name=bootx64.efi
uefi_pxe_config_template=$pybasedir/drivers/modules/pxe_grub_config.template
pxe_bootfile_name_by_arch=aarch64:grubaa64.efi
pxe_config_template_by_arch=aarch64:/tftpboot/pxe_grubaa64_config.template
pxe_append_params = nofb nomodeset vga=normal systemd.journald.forward_to_console=yes ipa-debug=1 console=tty0 console=ttyS0,115200n8
|
裸金属服务会通过裸金属服务管理节点的cpu_arch属性,结合pxe_bootfile_name_by_arch与pxe_config_template_by_arch实现多架构部署支持,启动方式则由boot_mode指定。
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存并退出文件。
- 重启ironic-conductor服务。
| sudo systemctl restart openstack-ironic-conductor
|