Skip to content

Commit

Permalink
Merge pull request #173 from dtantsur/inspector-power-off
Browse files Browse the repository at this point in the history
Set power_off = !fast_track in [inspector]
  • Loading branch information
metal3-io-bot committed Jul 8, 2020
2 parents f1966de + 09c7984 commit 108ad31
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
15 changes: 12 additions & 3 deletions configure-ironic.sh
Expand Up @@ -15,6 +15,16 @@ IRONIC_AUTOMATED_CLEAN=${IRONIC_AUTOMATED_CLEAN:-true}

wait_for_interface_or_ip

if [[ $IRONIC_FAST_TRACK == true ]]; then
INSPECTOR_POWER_OFF=false
# TODO(dtantsur): ipa-api-url should be populated by ironic itself, but
# it's not yet, so working around here.
INSPECTOR_EXTRA_ARGS=" ipa-api-url=http://${IRONIC_URL_HOST}:6385"
else
INSPECTOR_POWER_OFF=true
INSPECTOR_EXTRA_ARGS=""
fi

cp /etc/ironic/ironic.conf /etc/ironic/ironic.conf_orig

crudini --merge /etc/ironic/ironic.conf <<EOF
Expand All @@ -38,10 +48,9 @@ fast_track = ${IRONIC_FAST_TRACK}
[inspector]
endpoint_override = http://${IRONIC_URL_HOST}:5050
# TODO(dtantsur): ipa-api-url should be populated by ironic itself, but it's
# not, so working around here.
power_off = ${INSPECTOR_POWER_OFF}
# NOTE(dtantsur): keep inspection arguments synchronized with inspector.ipxe
extra_kernel_params = ipa-inspector-collectors=default,extra-hardware,logs ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 ipa-api-url=http://${IRONIC_URL_HOST}:6385
extra_kernel_params = ipa-inspector-collectors=default,extra-hardware,logs ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 ${INSPECTOR_EXTRA_ARGS}
[service_catalog]
endpoint_override = http://${IRONIC_URL_HOST}:6385
Expand Down
2 changes: 1 addition & 1 deletion inspector.ipxe
Expand Up @@ -5,6 +5,6 @@ echo In inspector.ipxe
imgfree
# NOTE(dtantsur): keep inspection kernel params in [mdns]params in
# ironic-inspector-image and configuration in configure-ironic.sh
kernel --timeout 60000 http://IRONIC_IP:HTTP_PORT/images/ironic-python-agent.kernel ipa-inspection-callback-url=http://IRONIC_IP:5050/v1/continue ipa-api-url=http://IRONIC_IP:6385 ipa-inspection-collectors=default,extra-hardware,logs systemd.journald.forward_to_console=yes BOOTIF=${mac} ipa-debug=1 ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 initrd=ironic-python-agent.initramfs || goto retry_boot
kernel --timeout 60000 http://IRONIC_IP:HTTP_PORT/images/ironic-python-agent.kernel ipa-inspection-callback-url=http://IRONIC_IP:5050/v1/continue ipa-inspection-collectors=default,extra-hardware,logs systemd.journald.forward_to_console=yes BOOTIF=${mac} ipa-debug=1 ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 EXTRA_ARGS initrd=ironic-python-agent.initramfs || goto retry_boot
initrd --timeout 60000 http://IRONIC_IP:HTTP_PORT/images/ironic-python-agent.initramfs || goto retry_boot
boot
3 changes: 0 additions & 3 deletions ironic.conf
Expand Up @@ -44,9 +44,6 @@ http_root = /shared/html/
[dhcp]
dhcp_provider = none

[inspector]
power_off = false

[oslo_messaging_notifications]
driver = prometheus_exporter
location = /shared/ironic_prometheus_exporter
Expand Down
14 changes: 13 additions & 1 deletion runhttpd.sh
Expand Up @@ -4,18 +4,30 @@

HTTP_PORT=${HTTP_PORT:-"80"}

# Whether to enable fast_track provisioning or not
IRONIC_FAST_TRACK=${IRONIC_FAST_TRACK:-true}

wait_for_interface_or_ip

mkdir -p /shared/html
chmod 0777 /shared/html

if [[ $IRONIC_FAST_TRACK == true ]]; then
INSPECTOR_EXTRA_ARGS="ipa-api-url=http://${IRONIC_URL_HOST}:6385"
else
INSPECTOR_EXTRA_ARGS=""
fi

# Copy files to shared mount
cp /tmp/inspector.ipxe /shared/html/inspector.ipxe
cp /tmp/dualboot.ipxe /shared/html/dualboot.ipxe
cp /tmp/uefi_esp.img /shared/html/uefi_esp.img

# Use configured values
sed -i -e s/IRONIC_IP/${IRONIC_URL_HOST}/g -e s/HTTP_PORT/${HTTP_PORT}/g /shared/html/inspector.ipxe
sed -i -e s/IRONIC_IP/${IRONIC_URL_HOST}/g \
-e s/HTTP_PORT/${HTTP_PORT}/g \
-e "s|EXTRA_ARGS|${INSPECTOR_EXTRA_ARGS}|g" \
/shared/html/inspector.ipxe

sed -i 's/^Listen .*$/Listen [::]:'"$HTTP_PORT"'/' /etc/httpd/conf/httpd.conf
sed -i -e 's|\(^[[:space:]]*\)\(DocumentRoot\)\(.*\)|\1\2 "/shared/html"|' \
Expand Down

0 comments on commit 108ad31

Please sign in to comment.