Skip to content

Commit

Permalink
squash! install 4/n: make sure host appears in PXE ARP tables
Browse files Browse the repository at this point in the history
We have to take into account xapi-project/xen-api#5799.
  • Loading branch information
ydirson committed Jul 10, 2024
1 parent a90340f commit cb1f531
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/install/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,35 @@ def iso_remaster(request, answerfile):
test ! -e "{answerfile_xml}" ||
cp "{answerfile_xml}" "$INSTALLIMG/root/answerfile.xml"
cat > "$INSTALLIMG/usr/local/sbin/test-pingpxe.sh" << 'EOF'
#! /bin/bash
set -eE
set -o pipefail
ether_of () {{
ifconfig "$1" | grep ether | sed 's/.*ether \\([^ ]*\\).*/\\1/'
}}
# on installed system, avoid xapi-project/xen-api#5799
if ! [ -e /opt/xensource/installer ]; then
eth_mac=$(ether_of eth0)
br_mac=$(ether_of xenbr0)
# wait for bridge MAC to be fixed
test "$eth_mac" = "$br_mac"
fi
ping -c1 "$1"
EOF
chmod +x "$INSTALLIMG/usr/local/sbin/test-pingpxe.sh"
cat > "$INSTALLIMG/etc/systemd/system/test-pingpxe.service" <<EOF
[Unit]
Description=Ping pxe server to populate its ARP table
After=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'while ! ( ifconfig -a && ping -c1 {PXE_CONFIG_SERVER} ); do sleep 1 ; done'
ExecStart=/bin/sh -c 'while ! /usr/local/sbin/test-pingpxe.sh "{PXE_CONFIG_SERVER}"; do sleep 1 ; done'
[Install]
WantedBy=default.target
EOF
Expand All @@ -123,6 +145,7 @@ def iso_remaster(request, answerfile):
ROOT="\\$1"
cp /etc/systemd/system/test-pingpxe.service "\\$ROOT/etc/systemd/system/test-pingpxe.service"
cp /usr/local/sbin/test-pingpxe.sh "\\$ROOT/usr/local/sbin/test-pingpxe.sh"
systemctl --root="\\$ROOT" enable test-pingpxe.service
if [ {gen_unique_uuid} = True ]; then
Expand Down

0 comments on commit cb1f531

Please sign in to comment.