Add an element to configure iBFT network interfaces

This allows nodes with remote devices configured via iBFT to be
correctly used during Ironic introspection and deployment,
at least for non-multipath configurations.

The new element is added as a dependency for ironic-agent.

Change-Id: If3dac6504d26535593f12e851092065b688ef696
This commit is contained in:
Dmitry Tantsur 2016-10-31 12:03:56 +01:00
parent b86af3dc6a
commit f0f3e3bac4
12 changed files with 138 additions and 0 deletions

View File

@ -0,0 +1,5 @@
===============
ibft-interfaces
===============
Initialize network interfaces with information provided through iBFT.

View File

@ -0,0 +1,4 @@
dib-init-system
install-static
package-installs
pkg-map

View File

@ -0,0 +1,14 @@
[Unit]
Description=Initialize iBFT network interfaces
After=network.target
Before=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
User=root
ExecStart=/usr/local/sbin/init-ibft-interfaces.sh
RemainAfterExit=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,31 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: init-ibft-interfaces
# Required-Start: $local_fs networking
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# X-Start-Before:
# Short-Description: Initialize iBFT interfaces
# Description: Initialize iBFT network interfaces
### END INIT INFO
NAME=init-ibft-interfaces
INIT_NAME=/etc/init.d/${NAME}
SCRIPT_NAME=/usr/local/sbin/${NAME}.sh
[ -x $SCRIPT_NAME ] || exit 0
case "$1" in
start)
$SCRIPT_NAME
;;
stop)
;;
*)
echo "Usage: $INIT_NAME {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,16 @@
# init-ibft-interfaces - Initialize iBFT network interfaces
description "Initialize iBFT network interfaces"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 022
expect stop
console output
exec /usr/local/sbin/init-ibft-interfaces.sh

View File

@ -0,0 +1 @@
iscsi_package:

View File

@ -0,0 +1,13 @@
{
"family": {
"redhat": {
"iscsi_package": "iscsi-initiator-utils"
},
"gentoo": {
"iscsi_package": "sys-block/open-iscsi"
}
},
"default": {
"iscsi_package": "open-iscsi"
}
}

View File

@ -0,0 +1,22 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
case "$DIB_INIT_SYSTEM" in
upstart)
;;
systemd)
systemctl enable init-ibft-interfaces.service
;;
sysv)
update-rc.d init-ibft-interfaces.init defaults
;;
*)
echo "Unsupported init system $DIB_INIT_SYSTEM"
exit 1
;;
esac

View File

@ -0,0 +1,3 @@
iscsi_boot_sysfs
iscsi_ibft
iscsi_tcp

View File

@ -0,0 +1,22 @@
#!/bin/bash
# dib-lint: disable=dibdebugtrace
set -eux
set -o pipefail
# iscsistart is a part of the dependencies, but check just in case.
if ! iscsistart -v; then
echo "iscsistart not found, iBFT devices won't be connected"
exit 1
fi
if iscsistart -f; then
if ! iscsistart -N; then
echo "Could not configure iBFT devices"
exit 1
fi
# Make sure the events for new devices are processed
udevadm settle
else
echo "No iBFT devices to configure, exiting"
fi

View File

@ -1,4 +1,5 @@
dhcp-all-interfaces
ibft-interfaces
install-static
no-final-image
package-installs

View File

@ -0,0 +1,6 @@
---
features:
- |
Adds a new element ``init-ibft-interfaces`` to initialize network
interfaces with configuration provided via iBFT. The new element is now
a dependency of the ``ironic-agent`` element.