mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-05 04:27:55 +00:00
fix(xcat-server): fix Ubuntu autoinstall netplan for match-by-MAC nodes
When a node's install NIC is selected by MAC (installnic=mac), the generated netplan was invalid: it named the ethernet device the literal string 'mac' and set its MAC match to the full pipe-delimited list of all node MACs. The result had no valid interface, so neither the installer environment nor the installed system came up on the network. Match the install NIC by interface-name glob in the installer, and in the target use only the primary MAC and omit set-name when the install NIC is selected by MAC. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,9 @@ autoinstall:
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
'#TABLE:noderes:$NODE:installnic#':
|
||||
xcat-install:
|
||||
match:
|
||||
name: "e*"
|
||||
dhcp4: true
|
||||
ssh:
|
||||
allow-pw: true
|
||||
@@ -74,9 +76,13 @@ autoinstall:
|
||||
cat /tmp/pre-install.log >> /target/var/log/xcat/xcat.log;
|
||||
installnic="#TABLE:noderes:$NODE:installnic#";
|
||||
installmac="#TABLE:mac:$NODE:mac#";
|
||||
installmac="$(printf ''%s'' "${installmac}" | tr ''A-F'' ''a-f'')";
|
||||
installmac="$(printf ''%s'' "${installmac}" | cut -d''|'' -f1 | cut -d''!'' -f1 | tr ''A-F'' ''a-f'')";
|
||||
mkdir -p /target/etc/netplan;
|
||||
printf ''%s\n'' "network:" " version: 2" " ethernets:" " xcat-install:" " match:" " macaddress: \"${installmac}\"" " set-name: ${installnic}" " dhcp4: true" >/target/etc/netplan/00-xcat-install.yaml;
|
||||
if [ "${installnic}" = "mac" ]; then
|
||||
printf ''%s\n'' "network:" " version: 2" " ethernets:" " xcat-install:" " match:" " macaddress: \"${installmac}\"" " dhcp4: true" >/target/etc/netplan/00-xcat-install.yaml;
|
||||
else
|
||||
printf ''%s\n'' "network:" " version: 2" " ethernets:" " xcat-install:" " match:" " macaddress: \"${installmac}\"" " set-name: ${installnic}" " dhcp4: true" >/target/etc/netplan/00-xcat-install.yaml;
|
||||
fi;
|
||||
chmod 600 /target/etc/netplan/00-xcat-install.yaml;
|
||||
printf ''%s\n'' ''#HOSTNAME#'' >/target/etc/hostname;
|
||||
if grep -q ''^127\.0\.1\.1'' /target/etc/hosts; then
|
||||
|
||||
Reference in New Issue
Block a user