2013-08-09 10:40:45 +03:00
# lib/ironic
# Functions to control the configuration and operation of the **Ironic** service
# Dependencies:
2013-10-24 11:27:02 +01:00
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
# - ``SERVICE_HOST``
# - ``KEYSTONE_TOKEN_FORMAT`` must be defined
2013-08-09 10:40:45 +03:00
# ``stack.sh`` calls the entry points in this order:
#
2013-10-24 11:27:02 +01:00
# - install_ironic
# - install_ironicclient
# - init_ironic
# - start_ironic
# - stop_ironic
# - cleanup_ironic
2013-08-09 10:40:45 +03:00
2014-01-31 18:02:07 +04:00
# Save trace and pipefail settings
2013-08-09 10:40:45 +03:00
XTRACE=$(set +o | grep xtrace)
2014-01-31 18:02:07 +04:00
PIPEFAIL=$(set +o | grep pipefail)
2013-08-09 10:40:45 +03:00
set +o xtrace
2014-01-31 18:02:07 +04:00
set +o pipefail
2013-08-09 10:40:45 +03:00
# Defaults
# --------
# Set up default directories
2014-11-13 17:09:28 -05:00
GITDIR["python-ironicclient"]=$DEST/python-ironicclient
2014-11-01 01:37:45 +01:00
2013-08-09 10:40:45 +03:00
IRONIC_DIR=$DEST/ironic
2014-08-15 01:08:11 +00:00
IRONIC_PYTHON_AGENT_DIR=$DEST/ironic-python-agent
2014-01-31 18:02:07 +04:00
IRONIC_DATA_DIR=$DATA_DIR/ironic
IRONIC_STATE_PATH=/var/lib/ironic
2013-08-09 10:40:45 +03:00
IRONIC_AUTH_CACHE_DIR=${IRONIC_AUTH_CACHE_DIR:-/var/cache/ironic}
IRONIC_CONF_DIR=${IRONIC_CONF_DIR:-/etc/ironic}
IRONIC_CONF_FILE=$IRONIC_CONF_DIR/ironic.conf
IRONIC_ROOTWRAP_CONF=$IRONIC_CONF_DIR/rootwrap.conf
IRONIC_POLICY_JSON=$IRONIC_CONF_DIR/policy.json
2014-10-08 07:01:02 -07:00
# Deploy to hardware platform
IRONIC_HW_NODE_CPU=${IRONIC_HW_NODE_CPU:-1}
IRONIC_HW_NODE_RAM=${IRONIC_HW_NODE_RAM:-512}
IRONIC_HW_NODE_DISK=${IRONIC_HW_NODE_DISK:-10}
IRONIC_HW_EPHEMERAL_DISK=${IRONIC_HW_EPHEMERAL_DISK:-0}
# The file is composed of multiple lines, each line includes four field
# separated by white space: IPMI address, MAC address, IPMI username
# and IPMI password.
# An example:
# 192.168.110.107 00:1e:67:57:50:4c root otc123
IRONIC_IPMIINFO_FILE=${IRONIC_IPMIINFO_FILE:-$IRONIC_DATA_DIR/hardware_info}
2014-01-31 18:02:07 +04:00
# Set up defaults for functional / integration testing
IRONIC_SCRIPTS_DIR=${IRONIC_SCRIPTS_DIR:-$TOP_DIR/tools/ironic/scripts}
IRONIC_TEMPLATES_DIR=${IRONIC_TEMPLATES_DIR:-$TOP_DIR/tools/ironic/templates}
IRONIC_BAREMETAL_BASIC_OPS=$(trueorfalse False $IRONIC_BAREMETAL_BASIC_OPS)
2014-04-11 10:08:41 -07:00
IRONIC_ENABLED_DRIVERS=${IRONIC_ENABLED_DRIVERS:-fake,pxe_ssh,pxe_ipmitool}
2014-01-31 18:02:07 +04:00
IRONIC_SSH_USERNAME=${IRONIC_SSH_USERNAME:-`whoami`}
IRONIC_SSH_KEY_DIR=${IRONIC_SSH_KEY_DIR:-$IRONIC_DATA_DIR/ssh_keys}
IRONIC_SSH_KEY_FILENAME=${IRONIC_SSH_KEY_FILENAME:-ironic_key}
IRONIC_KEY_FILE=$IRONIC_SSH_KEY_DIR/$IRONIC_SSH_KEY_FILENAME
IRONIC_SSH_VIRT_TYPE=${IRONIC_SSH_VIRT_TYPE:-virsh}
IRONIC_TFTPBOOT_DIR=${IRONIC_TFTPBOOT_DIR:-$IRONIC_DATA_DIR/tftpboot}
2014-10-08 07:01:02 -07:00
IRONIC_TFTPSERVER_IP=${IRONIC_TFTPSERVER_IP:-$HOST_IP}
2014-04-14 11:57:13 -07:00
IRONIC_VM_SSH_PORT=${IRONIC_VM_SSH_PORT:-22}
2014-01-31 18:02:07 +04:00
IRONIC_VM_SSH_ADDRESS=${IRONIC_VM_SSH_ADDRESS:-$HOST_IP}
IRONIC_VM_COUNT=${IRONIC_VM_COUNT:-1}
IRONIC_VM_SPECS_CPU=${IRONIC_VM_SPECS_CPU:-1}
2014-07-03 17:57:49 -07:00
IRONIC_VM_SPECS_RAM=${IRONIC_VM_SPECS_RAM:-512}
2014-01-31 18:02:07 +04:00
IRONIC_VM_SPECS_DISK=${IRONIC_VM_SPECS_DISK:-10}
2014-05-01 11:38:21 -04:00
IRONIC_VM_EPHEMERAL_DISK=${IRONIC_VM_EPHEMERAL_DISK:-0}
2014-01-31 18:02:07 +04:00
IRONIC_VM_EMULATOR=${IRONIC_VM_EMULATOR:-/usr/bin/qemu-system-x86_64}
IRONIC_VM_NETWORK_BRIDGE=${IRONIC_VM_NETWORK_BRIDGE:-brbm}
IRONIC_VM_NETWORK_RANGE=${IRONIC_VM_NETWORK_RANGE:-192.0.2.0/24}
IRONIC_VM_MACS_CSV_FILE=${IRONIC_VM_MACS_CSV_FILE:-$IRONIC_DATA_DIR/ironic_macs.csv}
IRONIC_AUTHORIZED_KEYS_FILE=${IRONIC_AUTHORIZED_KEYS_FILE:-$HOME/.ssh/authorized_keys}
2014-04-11 17:06:14 -07:00
# By default, baremetal VMs will console output to file.
IRONIC_VM_LOG_CONSOLE=${IRONIC_VM_LOG_CONSOLE:-True}
IRONIC_VM_LOG_DIR=${IRONIC_VM_LOG_DIR:-$IRONIC_DATA_DIR/logs/}
2014-03-14 18:44:48 +04:00
# Use DIB to create deploy ramdisk and kernel.
IRONIC_BUILD_DEPLOY_RAMDISK=`trueorfalse True $IRONIC_BUILD_DEPLOY_RAMDISK`
# If not use DIB, these files are used as deploy ramdisk/kernel.
# (The value must be a absolute path)
IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-}
IRONIC_DEPLOY_KERNEL=${IRONIC_DEPLOY_KERNEL:-}
IRONIC_DEPLOY_ELEMENT=${IRONIC_DEPLOY_ELEMENT:-deploy-ironic}
2014-08-27 17:03:00 -07:00
IRONIC_AGENT_KERNEL_URL=${IRONIC_AGENT_KERNEL_URL:-http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe.vmlinuz}
2014-09-11 16:45:58 -07:00
IRONIC_AGENT_RAMDISK_URL=${IRONIC_AGENT_RAMDISK_URL:-http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz}
2014-08-05 18:08:29 +00:00
# Which deploy driver to use - valid choices right now
2014-11-05 03:30:25 -07:00
# are 'pxe_ssh', 'pxe_ipmitool', 'agent_ssh' and 'agent_ipmitool'.
2014-08-05 18:08:29 +00:00
IRONIC_DEPLOY_DRIVER=${IRONIC_DEPLOY_DRIVER:-pxe_ssh}
2014-03-14 18:44:48 +04:00
#TODO(agordeev): replace 'ubuntu' with host distro name getting
IRONIC_DEPLOY_FLAVOR=${IRONIC_DEPLOY_FLAVOR:-ubuntu $IRONIC_DEPLOY_ELEMENT}
2013-08-09 10:40:45 +03:00
# Support entry points installation of console scripts
IRONIC_BIN_DIR=$(get_python_exec_prefix)
# Ironic connection info. Note the port must be specified.
IRONIC_SERVICE_PROTOCOL=http
2014-11-17 09:59:23 -08:00
IRONIC_SERVICE_PORT=${IRONIC_SERVICE_PORT:-6385}
IRONIC_HOSTPORT=${IRONIC_HOSTPORT:-$SERVICE_HOST:$IRONIC_SERVICE_PORT}
2013-08-09 10:40:45 +03:00
2014-01-29 16:22:11 -06:00
# Tell Tempest this project is present
TEMPEST_SERVICES+=,ironic
2014-08-19 10:01:45 +01:00
# Enable iPXE
IRONIC_IPXE_ENABLED=$(trueorfalse False $IRONIC_IPXE_ENABLED)
IRONIC_HTTP_DIR=${IRONIC_HTTP_DIR:-$IRONIC_DATA_DIR/httpboot}
IRONIC_HTTP_SERVER=${IRONIC_HTTP_SERVER:-$HOST_IP}
IRONIC_HTTP_PORT=${IRONIC_HTTP_PORT:-8088}
# get_pxe_boot_file() - Get the PXE/iPXE boot file path
function get_pxe_boot_file {
local relpath=syslinux/pxelinux.0
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
relpath=ipxe/undionly.kpxe
fi
local pxe_boot_file
if is_ubuntu; then
pxe_boot_file=/usr/lib/$relpath
elif is_fedora || is_suse; then
pxe_boot_file=/usr/share/$relpath
fi
echo $pxe_boot_file
}
# PXE boot image
IRONIC_PXE_BOOT_IMAGE=${IRONIC_PXE_BOOT_IMAGE:-$(get_pxe_boot_file)}
2013-08-09 10:40:45 +03:00
# Functions
# ---------
2014-01-27 14:56:44 -06:00
# Test if any Ironic services are enabled
# is_ironic_enabled
function is_ironic_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"ir-" ]] && return 0
return 1
}
2014-10-08 07:01:02 -07:00
function is_ironic_hardware {
is_ironic_enabled && [[ -n "${IRONIC_DEPLOY_DRIVER##*_ssh}" ]] && return 0
return 1
}
2014-11-05 03:30:25 -07:00
function is_deployed_by_agent {
[[ -z "${IRONIC_DEPLOY_DRIVER%%agent*}" ]] && return 0
return 1
}
2013-10-15 17:03:15 +03:00
# install_ironic() - Collect source and prepare
2014-02-21 15:35:08 +11:00
function install_ironic {
2014-08-05 18:12:29 -07:00
# make sure all needed service were enabled
for srv in nova glance key; do
if ! is_service_enabled "$srv"; then
die $LINENO "$srv should be enabled for Ironic."
fi
done
2013-10-15 17:03:15 +03:00
git_clone $IRONIC_REPO $IRONIC_DIR $IRONIC_BRANCH
setup_develop $IRONIC_DIR
2014-08-19 10:01:45 +01:00
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
install_apache_wsgi
fi
2014-11-17 12:26:08 -08:00
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] && is_ubuntu; then
# Ubuntu packaging+apparmor issue prevents libvirt from loading
# the ROM from /usr/share/misc. Workaround by installing it directly
# to a directory that it can read from. (LP: #1393548)
sudo rm -rf /usr/share/qemu/sgabios.bin
sudo cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
fi
2013-10-15 17:03:15 +03:00
}
# install_ironicclient() - Collect sources and prepare
2014-02-21 15:35:08 +11:00
function install_ironicclient {
2014-11-13 17:09:28 -05:00
if use_library_from_git "python-ironicclient"; then
git_clone_by_name "python-ironicclient"
setup_dev_lib "python-ironicclient"
sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-ironicclient"]}/tools/,/etc/bash_completion.d/}ironic.bash_completion
2014-11-01 01:37:45 +01:00
else
# nothing actually "requires" ironicclient, so force instally from pypi
pip_install python-ironicclient
fi
2013-10-15 17:03:15 +03:00
}
2014-08-19 10:01:45 +01:00
# _cleanup_ironic_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
function _cleanup_ironic_apache_wsgi {
sudo rm -rf $IRONIC_HTTP_DIR
disable_apache_site ironic
sudo rm -f $(apache_site_config_for ironic)
restart_apache_server
}
# _config_ironic_apache_wsgi() - Set WSGI config files of Ironic
function _config_ironic_apache_wsgi {
local ironic_apache_conf=$(apache_site_config_for ironic)
sudo cp $FILES/apache-ironic.template $ironic_apache_conf
sudo sed -e "
s|%PUBLICPORT%|$IRONIC_HTTP_PORT|g;
s|%HTTPROOT%|$IRONIC_HTTP_DIR|g;
" -i $ironic_apache_conf
enable_apache_site ironic
}
2013-08-09 10:40:45 +03:00
# cleanup_ironic() - Remove residual data files, anything left over from previous
# runs that would need to clean up.
2014-02-21 15:35:08 +11:00
function cleanup_ironic {
2014-11-10 15:07:59 +05:30
sudo rm -rf $IRONIC_AUTH_CACHE_DIR $IRONIC_CONF_DIR
2013-08-09 10:40:45 +03:00
}
2014-08-05 18:12:29 -07:00
# configure_ironic_dirs() - Create all directories required by Ironic and
# associated services.
function configure_ironic_dirs {
2013-08-09 10:40:45 +03:00
if [[ ! -d $IRONIC_CONF_DIR ]]; then
sudo mkdir -p $IRONIC_CONF_DIR
fi
2014-08-19 10:01:45 +01:00
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
sudo mkdir -p $IRONIC_HTTP_DIR
sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_HTTP_DIR
fi
2014-08-05 18:12:29 -07:00
sudo mkdir -p $IRONIC_DATA_DIR
sudo mkdir -p $IRONIC_STATE_PATH
sudo mkdir -p $IRONIC_TFTPBOOT_DIR
sudo chown -R $STACK_USER $IRONIC_DATA_DIR $IRONIC_STATE_PATH
sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_TFTPBOOT_DIR
2014-08-19 10:01:45 +01:00
mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg
if [ ! -f $IRONIC_PXE_BOOT_IMAGE ]; then
die $LINENO "PXE boot file $IRONIC_PXE_BOOT_IMAGE not found."
2014-08-05 18:12:29 -07:00
fi
2014-08-19 10:01:45 +01:00
cp $IRONIC_PXE_BOOT_IMAGE $IRONIC_TFTPBOOT_DIR
2014-08-05 18:12:29 -07:00
}
# configure_ironic() - Set config files, create data dirs, etc
function configure_ironic {
configure_ironic_dirs
2013-08-09 10:40:45 +03:00
sudo chown $STACK_USER $IRONIC_CONF_DIR
# Copy over ironic configuration file and configure common parameters.
cp $IRONIC_DIR/etc/ironic/ironic.conf.sample $IRONIC_CONF_FILE
iniset $IRONIC_CONF_FILE DEFAULT debug True
inicomment $IRONIC_CONF_FILE DEFAULT log_file
iniset $IRONIC_CONF_FILE DEFAULT sql_connection `database_connection_url ironic`
2014-01-31 18:02:07 +04:00
iniset $IRONIC_CONF_FILE DEFAULT state_path $IRONIC_STATE_PATH
2013-08-09 10:40:45 +03:00
iniset $IRONIC_CONF_FILE DEFAULT use_syslog $SYSLOG
# Configure Ironic conductor, if it was enabled.
if is_service_enabled ir-cond; then
configure_ironic_conductor
fi
# Configure Ironic API, if it was enabled.
if is_service_enabled ir-api; then
configure_ironic_api
fi
2014-01-31 18:02:07 +04:00
2014-06-06 15:12:32 -07:00
# Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
setup_colorized_logging $IRONIC_CONF_FILE DEFAULT
fi
2014-08-19 10:01:45 +01:00
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]]; then
_config_ironic_apache_wsgi
fi
2013-08-09 10:40:45 +03:00
}
# configure_ironic_api() - Is used by configure_ironic(). Performs
# API specific configuration.
2014-02-21 15:35:08 +11:00
function configure_ironic_api {
2013-10-01 17:19:05 +03:00
iniset $IRONIC_CONF_FILE DEFAULT auth_strategy keystone
iniset $IRONIC_CONF_FILE DEFAULT policy_file $IRONIC_POLICY_JSON
2014-09-19 17:22:22 -05:00
configure_auth_token_middleware $IRONIC_CONF_FILE ironic $IRONIC_AUTH_CACHE_DIR/api
2013-08-09 10:40:45 +03:00
iniset_rpc_backend ironic $IRONIC_CONF_FILE DEFAULT
2014-11-17 09:59:23 -08:00
iniset $IRONIC_CONF_FILE api port $IRONIC_SERVICE_PORT
2013-08-09 10:40:45 +03:00
cp -p $IRONIC_DIR/etc/ironic/policy.json $IRONIC_POLICY_JSON
}
# configure_ironic_conductor() - Is used by configure_ironic().
# Sets conductor specific settings.
2014-02-21 15:35:08 +11:00
function configure_ironic_conductor {
2013-08-09 10:40:45 +03:00
cp $IRONIC_DIR/etc/ironic/rootwrap.conf $IRONIC_ROOTWRAP_CONF
2014-01-14 11:37:51 +00:00
cp -r $IRONIC_DIR/etc/ironic/rootwrap.d $IRONIC_CONF_DIR
2014-07-25 13:04:13 -05:00
local ironic_rootwrap=$(get_rootwrap_location ironic)
local rootwrap_isudoer_cmd="$ironic_rootwrap $IRONIC_CONF_DIR/rootwrap.conf *"
2014-04-14 16:14:33 -07:00
# Set up the rootwrap sudoers for ironic
2014-07-25 13:04:13 -05:00
local tempfile=`mktemp`
echo "$STACK_USER ALL=(root) NOPASSWD: $rootwrap_isudoer_cmd" >$tempfile
chmod 0440 $tempfile
sudo chown root:root $tempfile
sudo mv $tempfile /etc/sudoers.d/ironic-rootwrap
2013-08-09 10:40:45 +03:00
2014-03-04 18:38:33 +04:00
iniset $IRONIC_CONF_FILE DEFAULT rootwrap_config $IRONIC_ROOTWRAP_CONF
2014-04-11 10:08:41 -07:00
iniset $IRONIC_CONF_FILE DEFAULT enabled_drivers $IRONIC_ENABLED_DRIVERS
2014-11-17 09:59:23 -08:00
iniset $IRONIC_CONF_FILE conductor api_url $IRONIC_SERVICE_PROTOCOL://$HOST_IP:$IRONIC_SERVICE_PORT
2014-10-08 07:01:02 -07:00
iniset $IRONIC_CONF_FILE pxe tftp_server $IRONIC_TFTPSERVER_IP
2014-01-31 18:02:07 +04:00
iniset $IRONIC_CONF_FILE pxe tftp_root $IRONIC_TFTPBOOT_DIR
iniset $IRONIC_CONF_FILE pxe tftp_master_path $IRONIC_TFTPBOOT_DIR/master_images
2014-04-11 17:06:14 -07:00
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
iniset $IRONIC_CONF_FILE pxe pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
fi
2014-11-05 03:30:25 -07:00
if is_deployed_by_agent; then
2014-08-05 18:08:29 +00:00
if [[ "$SWIFT_ENABLE_TEMPURLS" == "True" ]] ; then
iniset $IRONIC_CONF_FILE glance swift_temp_url_key $SWIFT_TEMPURL_KEY
else
die $LINENO "SWIFT_ENABLE_TEMPURLS must be True to use agent_ssh driver in Ironic."
fi
2014-10-29 14:15:22 -07:00
iniset $IRONIC_CONF_FILE glance swift_endpoint_url http://${HOST_IP}:${SWIFT_DEFAULT_BIND_PORT:-8080}
2014-08-05 18:08:29 +00:00
iniset $IRONIC_CONF_FILE glance swift_api_version v1
2014-10-22 13:21:22 -07:00
local tenant_id=$(get_or_create_project $SERVICE_TENANT_NAME)
iniset $IRONIC_CONF_FILE glance swift_account AUTH_${tenant_id}
2014-08-05 18:08:29 +00:00
iniset $IRONIC_CONF_FILE glance swift_container glance
iniset $IRONIC_CONF_FILE glance swift_temp_url_duration 3600
iniset $IRONIC_CONF_FILE agent heartbeat_timeout 30
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
iniset $IRONIC_CONF_FILE agent agent_pxe_append_params "nofb nomodeset vga=normal console=ttyS0"
fi
fi
2014-08-19 10:01:45 +01:00
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
local pxebin=`basename $IRONIC_PXE_BOOT_IMAGE`
iniset $IRONIC_CONF_FILE pxe ipxe_enabled True
iniset $IRONIC_CONF_FILE pxe pxe_config_template '\$pybasedir/drivers/modules/ipxe_config.template'
iniset $IRONIC_CONF_FILE pxe pxe_bootfile_name $pxebin
iniset $IRONIC_CONF_FILE pxe http_root $IRONIC_HTTP_DIR
iniset $IRONIC_CONF_FILE pxe http_url "http://$IRONIC_HTTP_SERVER:$IRONIC_HTTP_PORT"
fi
2013-08-09 10:40:45 +03:00
}
# create_ironic_cache_dir() - Part of the init_ironic() process
2014-02-21 15:35:08 +11:00
function create_ironic_cache_dir {
2013-08-09 10:40:45 +03:00
# Create cache dir
sudo mkdir -p $IRONIC_AUTH_CACHE_DIR/api
sudo chown $STACK_USER $IRONIC_AUTH_CACHE_DIR/api
rm -f $IRONIC_AUTH_CACHE_DIR/api/*
sudo mkdir -p $IRONIC_AUTH_CACHE_DIR/registry
sudo chown $STACK_USER $IRONIC_AUTH_CACHE_DIR/registry
rm -f $IRONIC_AUTH_CACHE_DIR/registry/*
}
# create_ironic_accounts() - Set up common required ironic accounts
# Tenant User Roles
# ------------------------------------------------------------------
# service ironic admin # if enabled
2014-02-21 15:35:08 +11:00
function create_ironic_accounts {
2013-08-09 10:40:45 +03:00
2014-07-25 13:04:13 -05:00
local service_tenant=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
local admin_role=$(openstack role list | awk "/ admin / { print \$2 }")
2013-08-09 10:40:45 +03:00
# Ironic
if [[ "$ENABLED_SERVICES" =~ "ir-api" ]]; then
2014-02-28 14:15:19 +01:00
# Get ironic user if exists
2014-07-25 13:04:13 -05:00
local ironic_user=$(get_or_create_user "ironic" \
"$SERVICE_PASSWORD" $service_tenant)
get_or_add_user_role $admin_role $ironic_user $service_tenant
2014-02-28 14:15:19 +01:00
2013-08-09 10:40:45 +03:00
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
2014-02-28 14:15:19 +01:00
2014-07-25 13:04:13 -05:00
local ironic_service=$(get_or_create_service "ironic" \
2014-02-28 14:15:19 +01:00
"baremetal" "Ironic baremetal provisioning service")
2014-07-25 13:04:13 -05:00
get_or_create_endpoint $ironic_service \
2014-02-28 14:15:19 +01:00
"$REGION_NAME" \
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT" \
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT" \
"$IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT"
2013-08-09 10:40:45 +03:00
fi
fi
}
# init_ironic() - Initialize databases, etc.
2014-02-21 15:35:08 +11:00
function init_ironic {
2013-08-09 10:40:45 +03:00
# (Re)create ironic database
recreate_database ironic utf8
# Migrate ironic database
2014-06-02 20:19:33 +02:00
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
2013-08-09 10:40:45 +03:00
create_ironic_cache_dir
}
2014-10-16 17:41:22 -07:00
# _ironic_bm_vm_names() - Generates list of names for baremetal VMs.
function _ironic_bm_vm_names {
local idx
local num_vms=$(($IRONIC_VM_COUNT - 1))
for idx in $(seq 0 $num_vms); do
echo "baremetal${IRONIC_VM_NETWORK_BRIDGE}_${idx}"
done
}
2013-08-09 10:40:45 +03:00
# start_ironic() - Start running processes, including screen
2014-02-21 15:35:08 +11:00
function start_ironic {
2013-08-09 10:40:45 +03:00
# Start Ironic API server, if enabled.
if is_service_enabled ir-api; then
start_ironic_api
fi
# Start Ironic conductor, if enabled.
if is_service_enabled ir-cond; then
start_ironic_conductor
fi
2014-08-19 10:01:45 +01:00
# Start Apache if iPXE is enabled
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
restart_apache_server
fi
2013-08-09 10:40:45 +03:00
}
# start_ironic_api() - Used by start_ironic().
# Starts Ironic API server.
2014-02-21 15:35:08 +11:00
function start_ironic_api {
2014-09-09 13:46:02 +01:00
run_process ir-api "$IRONIC_BIN_DIR/ironic-api --config-file=$IRONIC_CONF_FILE"
2013-08-09 10:40:45 +03:00
echo "Waiting for ir-api ($IRONIC_HOSTPORT) to start..."
2014-11-17 09:59:23 -08:00
if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT; do sleep 1; done"; then
2013-10-22 08:47:11 -04:00
die $LINENO "ir-api did not start"
2013-08-09 10:40:45 +03:00
fi
}
# start_ironic_conductor() - Used by start_ironic().
# Starts Ironic conductor.
2014-02-21 15:35:08 +11:00
function start_ironic_conductor {
2014-09-09 13:46:02 +01:00
run_process ir-cond "$IRONIC_BIN_DIR/ironic-conductor --config-file=$IRONIC_CONF_FILE"
2013-08-09 10:40:45 +03:00
# TODO(romcheg): Find a way to check whether the conductor has started.
}
# stop_ironic() - Stop running processes
2014-02-21 15:35:08 +11:00
function stop_ironic {
2013-08-09 10:40:45 +03:00
# Kill the Ironic screen windows
screen -S $SCREEN_NAME -p ir-api -X kill
screen -S $SCREEN_NAME -p ir-cond -X kill
2014-08-19 10:01:45 +01:00
# Cleanup the WSGI files
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
_cleanup_ironic_apache_wsgi
fi
2013-08-09 10:40:45 +03:00
}
2014-01-31 18:02:07 +04:00
function is_ironic {
if ( is_service_enabled ir-cond && is_service_enabled ir-api ); then
return 0
fi
return 1
}
2014-08-05 18:12:29 -07:00
function create_ovs_taps {
local ironic_net_id=$(neutron net-list | grep private | get_field 1)
2014-01-31 18:02:07 +04:00
2014-08-05 18:12:29 -07:00
# Work around: No netns exists on host until a Neutron port is created. We
# need to create one in Neutron to know what netns to tap into prior to the
# first node booting.
local port_id=$(neutron port-create private | grep " id " | get_field 2)
# intentional sleep to make sure the tag has been set to port
sleep 10
local tapdev=$(sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep tap | cut -d':' -f2 | cut -b2-)
local tag_id=$(sudo ovs-vsctl show |grep ${tapdev} -A1 -m1 | grep tag | cut -d':' -f2 | cut -b2-)
# make sure veth pair is not existing, otherwise delete its links
sudo ip link show ovs-tap1 && sudo ip link delete ovs-tap1
sudo ip link show brbm-tap1 && sudo ip link delete brbm-tap1
# create veth pair for future interconnection between br-int and brbm
sudo ip link add brbm-tap1 type veth peer name ovs-tap1
sudo ip link set dev brbm-tap1 up
sudo ip link set dev ovs-tap1 up
sudo ovs-vsctl -- --if-exists del-port ovs-tap1 -- add-port br-int ovs-tap1 tag=$tag_id
sudo ovs-vsctl -- --if-exists del-port brbm-tap1 -- add-port $IRONIC_VM_NETWORK_BRIDGE brbm-tap1
# Remove the port needed only for workaround.
neutron port-delete $port_id
2014-07-29 18:43:18 -07:00
# Finally, share the fixed tenant network across all tenants. This allows the host
# to serve TFTP to a single network namespace via the tap device created above.
neutron net-update $ironic_net_id --shared true
2014-01-31 18:02:07 +04:00
}
function create_bridge_and_vms {
# Call libvirt setup scripts in a new shell to ensure any new group membership
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/setup-network"
2014-04-11 17:06:14 -07:00
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then
2014-07-25 13:04:13 -05:00
local log_arg="$IRONIC_VM_LOG_DIR"
2014-04-11 17:06:14 -07:00
else
2014-07-25 13:04:13 -05:00
local log_arg=""
2014-04-11 17:06:14 -07:00
fi
2014-10-16 17:41:22 -07:00
local vm_name
for vm_name in $(_ironic_bm_vm_names); do
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/create-node $vm_name \
$IRONIC_VM_SPECS_CPU $IRONIC_VM_SPECS_RAM $IRONIC_VM_SPECS_DISK \
amd64 $IRONIC_VM_NETWORK_BRIDGE $IRONIC_VM_EMULATOR \
$log_arg" >> $IRONIC_VM_MACS_CSV_FILE
done
2014-08-05 18:12:29 -07:00
create_ovs_taps
2014-01-31 18:02:07 +04:00
}
2014-10-08 07:01:02 -07:00
function enroll_nodes {
2014-07-25 13:04:13 -05:00
local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
2014-01-31 18:02:07 +04:00
local idx=0
2014-08-05 18:08:29 +00:00
if [[ "$IRONIC_DEPLOY_DRIVER" == "pxe_ssh" ]] ; then
local _IRONIC_DEPLOY_KERNEL_KEY=pxe_deploy_kernel
local _IRONIC_DEPLOY_RAMDISK_KEY=pxe_deploy_ramdisk
2014-11-05 03:30:25 -07:00
elif is_deployed_by_agent; then
2014-08-05 18:08:29 +00:00
local _IRONIC_DEPLOY_KERNEL_KEY=deploy_kernel
local _IRONIC_DEPLOY_RAMDISK_KEY=deploy_ramdisk
fi
2014-10-08 07:01:02 -07:00
if ! is_ironic_hardware; then
local ironic_node_cpu=$IRONIC_VM_SPECS_CPU
local ironic_node_ram=$IRONIC_VM_SPECS_RAM
local ironic_node_disk=$IRONIC_VM_SPECS_DISK
local ironic_ephemeral_disk=$IRONIC_VM_EPHEMERAL_DISK
local ironic_hwinfo_file=$IRONIC_VM_MACS_CSV_FILE
local node_options="\
2014-08-05 18:08:29 +00:00
-i $_IRONIC_DEPLOY_KERNEL_KEY=$IRONIC_DEPLOY_KERNEL_ID \
-i $_IRONIC_DEPLOY_RAMDISK_KEY=$IRONIC_DEPLOY_RAMDISK_ID \
2014-01-31 18:02:07 +04:00
-i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \
-i ssh_address=$IRONIC_VM_SSH_ADDRESS \
-i ssh_port=$IRONIC_VM_SSH_PORT \
-i ssh_username=$IRONIC_SSH_USERNAME \
2014-10-08 07:01:02 -07:00
-i ssh_key_filename=$IRONIC_SSH_KEY_DIR/$IRONIC_SSH_KEY_FILENAME"
else
local ironic_node_cpu=$IRONIC_HW_NODE_CPU
local ironic_node_ram=$IRONIC_HW_NODE_RAM
local ironic_node_disk=$IRONIC_HW_NODE_DISK
local ironic_ephemeral_disk=$IRONIC_HW_EPHEMERAL_DISK
if [[ -z "${IRONIC_DEPLOY_DRIVER##*_ipmitool}" ]]; then
local ironic_hwinfo_file=$IRONIC_IPMIINFO_FILE
fi
fi
while read hardware_info; do
if ! is_ironic_hardware; then
local mac_address=$hardware_info
elif [[ -z "${IRONIC_DEPLOY_DRIVER##*_ipmitool}" ]]; then
local ipmi_address=$(echo $hardware_info |awk '{print $1}')
local mac_address=$(echo $hardware_info |awk '{print $2}')
local ironic_ipmi_username=$(echo $hardware_info |awk '{print $3}')
local ironic_ipmi_passwd=$(echo $hardware_info |awk '{print $4}')
# Currently we require all hardware platform have same CPU/RAM/DISK info
# in future, this can be enhanced to support different type, and then
# we create the bare metal flavor with minimum value
local node_options="-i ipmi_address=$ipmi_address -i ipmi_password=$ironic_ipmi_passwd\
-i ipmi_username=$ironic_ipmi_username"
2014-11-05 03:30:25 -07:00
if is_deployed_by_agent; then
node_options+=" -i $_IRONIC_DEPLOY_KERNEL_KEY=$IRONIC_DEPLOY_KERNEL_ID"
node_options+=" -i $_IRONIC_DEPLOY_RAMDISK_KEY=$IRONIC_DEPLOY_RAMDISK_ID"
fi
2014-10-08 07:01:02 -07:00
fi
local node_id=$(ironic node-create --chassis_uuid $chassis_id \
--driver $IRONIC_DEPLOY_DRIVER \
-p cpus=$ironic_node_cpu\
-p memory_mb=$ironic_node_ram\
-p local_gb=$ironic_node_disk\
2014-01-31 18:02:07 +04:00
-p cpu_arch=x86_64 \
2014-10-08 07:01:02 -07:00
$node_options \
2014-01-31 18:02:07 +04:00
| grep " uuid " | get_field 2)
2014-10-08 07:01:02 -07:00
ironic port-create --address $mac_address --node_uuid $node_id
2014-01-31 18:02:07 +04:00
idx=$((idx+1))
2014-10-08 07:01:02 -07:00
done < $ironic_hwinfo_file
2014-01-31 18:02:07 +04:00
# create the nova flavor
2014-07-17 12:53:21 -07:00
# NOTE(adam_g): Attempting to use an autogenerated UUID for flavor id here uncovered
# bug (LP: #1333852) in Trove. This can be changed to use an auto flavor id when the
# bug is fixed in Juno.
2014-10-08 07:01:02 -07:00
local adjusted_disk=$(($ironic_node_disk - $ironic_ephemeral_disk))
nova flavor-create --ephemeral $ironic_ephemeral_disk baremetal 551 $ironic_node_ram $adjusted_disk $ironic_node_cpu
2014-07-17 12:53:21 -07:00
2014-05-26 14:58:37 +01:00
# TODO(lucasagomes): Remove the 'baremetal:deploy_kernel_id'
# and 'baremetal:deploy_ramdisk_id' parameters
# from the flavor after the completion of
# https://blueprints.launchpad.net/ironic/+spec/add-node-instance-info
2014-03-14 18:44:48 +04:00
nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$IRONIC_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$IRONIC_DEPLOY_RAMDISK_ID"
2014-01-31 18:02:07 +04:00
}
2014-04-14 13:21:22 -07:00
function configure_iptables {
# enable tftp natting for allowing connections to HOST_IP's tftp server
2014-01-31 18:02:07 +04:00
sudo modprobe nf_conntrack_tftp
sudo modprobe nf_nat_tftp
2014-04-14 13:21:22 -07:00
# nodes boot from TFTP and callback to the API server listening on $HOST_IP
sudo iptables -I INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
2014-11-17 09:59:23 -08:00
sudo iptables -I INPUT -d $HOST_IP -p tcp --dport $IRONIC_SERVICE_PORT -j ACCEPT || true
2014-11-05 03:30:25 -07:00
if is_deployed_by_agent; then
2014-10-29 14:15:22 -07:00
# agent ramdisk gets instance image from swift
sudo iptables -I INPUT -d $HOST_IP -p tcp --dport ${SWIFT_DEFAULT_BIND_PORT:-8080} -j ACCEPT || true
fi
2014-04-14 13:21:22 -07:00
}
2014-01-31 18:02:07 +04:00
2014-04-14 13:21:22 -07:00
function configure_tftpd {
2014-01-31 18:02:07 +04:00
# stop tftpd and setup serving via xinetd
stop_service tftpd-hpa || true
[ -f /etc/init/tftpd-hpa.conf ] && echo "manual" | sudo tee /etc/init/tftpd-hpa.override
sudo cp $IRONIC_TEMPLATES_DIR/tftpd-xinetd.template /etc/xinetd.d/tftp
sudo sed -e "s|%TFTPBOOT_DIR%|$IRONIC_TFTPBOOT_DIR|g" -i /etc/xinetd.d/tftp
# setup tftp file mapping to satisfy requests at the root (booting) and
# /tftpboot/ sub-dir (as per deploy-ironic elements)
echo "r ^([^/]) $IRONIC_TFTPBOOT_DIR/\1" >$IRONIC_TFTPBOOT_DIR/map-file
echo "r ^(/tftpboot/) $IRONIC_TFTPBOOT_DIR/\2" >>$IRONIC_TFTPBOOT_DIR/map-file
chmod -R 0755 $IRONIC_TFTPBOOT_DIR
restart_service xinetd
}
function configure_ironic_ssh_keypair {
# Generating ssh key pair for stack user
if [[ ! -d $IRONIC_SSH_KEY_DIR ]]; then
mkdir -p $IRONIC_SSH_KEY_DIR
fi
if [[ ! -d $HOME/.ssh ]]; then
mkdir -p $HOME/.ssh
chmod 700 $HOME/.ssh
fi
echo -e 'n\n' | ssh-keygen -q -t rsa -P '' -f $IRONIC_KEY_FILE
cat $IRONIC_KEY_FILE.pub | tee -a $IRONIC_AUTHORIZED_KEYS_FILE
}
function ironic_ssh_check {
2014-07-25 13:04:13 -05:00
local key_file=$1
local floating_ip=$2
local port=$3
local default_instance_user=$4
local active_timeout=$5
if ! timeout $active_timeout sh -c "while ! ssh -p $port -o StrictHostKeyChecking=no -i $key_file ${default_instance_user}@$floating_ip echo success; do sleep 1; done"; then
2014-01-31 18:02:07 +04:00
die $LINENO "server didn't become ssh-able!"
fi
}
function configure_ironic_auxiliary {
configure_ironic_ssh_keypair
2014-04-14 11:57:13 -07:00
ironic_ssh_check $IRONIC_SSH_KEY_DIR/$IRONIC_SSH_KEY_FILENAME $IRONIC_VM_SSH_ADDRESS $IRONIC_VM_SSH_PORT $IRONIC_SSH_USERNAME 10
2014-01-31 18:02:07 +04:00
}
2014-08-15 01:08:11 +00:00
function build_ipa_coreos_ramdisk {
echo "Building ironic-python-agent deploy ramdisk"
local kernel_path=$1
local ramdisk_path=$2
git_clone $IRONIC_PYTHON_AGENT_REPO $IRONIC_PYTHON_AGENT_DIR $IRONIC_PYTHON_AGENT_BRANCH
cd $IRONIC_PYTHON_AGENT_DIR
imagebuild/coreos/build_coreos_image.sh
cp imagebuild/coreos/UPLOAD/coreos_production_pxe_image-oem.cpio.gz $ramdisk_path
cp imagebuild/coreos/UPLOAD/coreos_production_pxe.vmlinuz $kernel_path
sudo rm -rf UPLOAD
cd -
}
2014-03-14 18:44:48 +04:00
# build deploy kernel+ramdisk, then upload them to glance
2014-07-25 13:04:13 -05:00
# this function sets ``IRONIC_DEPLOY_KERNEL_ID``, ``IRONIC_DEPLOY_RAMDISK_ID``
2014-03-14 18:44:48 +04:00
function upload_baremetal_ironic_deploy {
2014-07-25 13:04:13 -05:00
declare -g IRONIC_DEPLOY_KERNEL_ID IRONIC_DEPLOY_RAMDISK_ID
2014-08-05 18:12:29 -07:00
echo_summary "Creating and uploading baremetal images for ironic"
# install diskimage-builder
2014-05-05 16:06:47 +12:00
if [[ $(type -P ramdisk-image-create) == "" ]]; then
pip_install diskimage_builder
fi
2014-03-14 18:44:48 +04:00
if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
2014-11-05 03:30:25 -07:00
local IRONIC_DEPLOY_KERNEL_PATH=$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER.kernel
local IRONIC_DEPLOY_RAMDISK_PATH=$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER.initramfs
2014-03-14 18:44:48 +04:00
else
2014-07-25 13:04:13 -05:00
local IRONIC_DEPLOY_KERNEL_PATH=$IRONIC_DEPLOY_KERNEL
local IRONIC_DEPLOY_RAMDISK_PATH=$IRONIC_DEPLOY_RAMDISK
2014-03-14 18:44:48 +04:00
fi
if [ ! -e "$IRONIC_DEPLOY_RAMDISK_PATH" -o ! -e "$IRONIC_DEPLOY_KERNEL_PATH" ]; then
# files don't exist, need to build them
if [ "$IRONIC_BUILD_DEPLOY_RAMDISK" = "True" ]; then
# we can build them only if we're not offline
if [ "$OFFLINE" != "True" ]; then
2014-11-05 03:30:25 -07:00
if is_deployed_by_agent; then
2014-08-15 01:08:11 +00:00
build_ipa_coreos_ramdisk $IRONIC_DEPLOY_KERNEL_PATH $IRONIC_DEPLOY_RAMDISK_PATH
2014-08-05 18:08:29 +00:00
else
2014-05-05 16:06:47 +12:00
ramdisk-image-create $IRONIC_DEPLOY_FLAVOR \
2014-11-05 03:30:25 -07:00
-o $TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER
2014-08-05 18:08:29 +00:00
fi
2014-03-14 18:44:48 +04:00
else
die $LINENO "Deploy kernel+ramdisk files don't exist and cannot be build in OFFLINE mode"
fi
else
2014-11-05 03:30:25 -07:00
if is_deployed_by_agent; then
2014-08-05 18:08:29 +00:00
# download the agent image tarball
2014-08-27 17:03:00 -07:00
wget "$IRONIC_AGENT_KERNEL_URL" -O $IRONIC_DEPLOY_KERNEL_PATH
wget "$IRONIC_AGENT_RAMDISK_URL" -O $IRONIC_DEPLOY_RAMDISK_PATH
2014-08-05 18:08:29 +00:00
else
die $LINENO "Deploy kernel+ramdisk files don't exist and their building was disabled explicitly by IRONIC_BUILD_DEPLOY_RAMDISK"
fi
2014-03-14 18:44:48 +04:00
fi
fi
2014-08-05 18:12:29 -07:00
local token=$(keystone token-get | grep ' id ' | get_field 2)
die_if_not_set $LINENO token "Keystone fail to get token"
2014-03-14 18:44:48 +04:00
# load them into glance
2014-08-02 23:47:15 -04:00
IRONIC_DEPLOY_KERNEL_ID=$(openstack \
--os-token $token \
--os-url http://$GLANCE_HOSTPORT \
image create \
$(basename $IRONIC_DEPLOY_KERNEL_PATH) \
--public --disk-format=aki \
2014-08-15 18:04:02 +00:00
--container-format=aki \
2014-03-14 18:44:48 +04:00
< $IRONIC_DEPLOY_KERNEL_PATH | grep ' id ' | get_field 2)
2014-08-02 23:47:15 -04:00
IRONIC_DEPLOY_RAMDISK_ID=$(openstack \
--os-token $token \
--os-url http://$GLANCE_HOSTPORT \
image create \
$(basename $IRONIC_DEPLOY_RAMDISK_PATH) \
--public --disk-format=ari \
2014-08-15 18:04:02 +00:00
--container-format=ari \
2014-03-14 18:44:48 +04:00
< $IRONIC_DEPLOY_RAMDISK_PATH | grep ' id ' | get_field 2)
}
2014-01-31 18:02:07 +04:00
function prepare_baremetal_basic_ops {
2014-08-05 18:12:29 -07:00
upload_baremetal_ironic_deploy
2014-10-08 07:01:02 -07:00
if ! is_ironic_hardware; then
create_bridge_and_vms
fi
enroll_nodes
2014-01-31 18:02:07 +04:00
configure_tftpd
2014-04-14 13:21:22 -07:00
configure_iptables
2014-10-08 07:01:02 -07:00
if ! is_ironic_hardware; then
configure_ironic_auxiliary
fi
2014-01-31 18:02:07 +04:00
}
function cleanup_baremetal_basic_ops {
rm -f $IRONIC_VM_MACS_CSV_FILE
if [ -f $IRONIC_KEY_FILE ]; then
2014-07-25 13:04:13 -05:00
local key=$(cat $IRONIC_KEY_FILE.pub)
2014-01-31 18:02:07 +04:00
# remove public key from authorized_keys
2014-07-25 13:04:13 -05:00
grep -v "$key" $IRONIC_AUTHORIZED_KEYS_FILE > temp && mv temp $IRONIC_AUTHORIZED_KEYS_FILE
2014-01-31 18:02:07 +04:00
chmod 0600 $IRONIC_AUTHORIZED_KEYS_FILE
fi
sudo rm -rf $IRONIC_DATA_DIR $IRONIC_STATE_PATH
2014-10-16 17:41:22 -07:00
local vm_name
for vm_name in $(_ironic_bm_vm_names); do
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/cleanup-node $vm_name $IRONIC_VM_NETWORK_BRIDGE"
done
2014-01-31 18:02:07 +04:00
sudo rm -rf /etc/xinetd.d/tftp /etc/init/tftpd-hpa.override
restart_service xinetd
2014-04-14 13:21:22 -07:00
sudo iptables -D INPUT -d $HOST_IP -p udp --dport 69 -j ACCEPT || true
2014-11-17 09:59:23 -08:00
sudo iptables -D INPUT -d $HOST_IP -p tcp --dport $IRONIC_SERVICE_PORT -j ACCEPT || true
2014-11-05 03:30:25 -07:00
if is_deployed_by_agent; then
2014-10-29 14:15:22 -07:00
# agent ramdisk gets instance image from swift
sudo iptables -D INPUT -d $HOST_IP -p tcp --dport ${SWIFT_DEFAULT_BIND_PORT:-8080} -j ACCEPT || true
fi
2014-04-14 13:21:22 -07:00
sudo rmmod nf_conntrack_tftp || true
sudo rmmod nf_nat_tftp || true
2014-01-31 18:02:07 +04:00
}
2013-08-09 10:40:45 +03:00
2014-01-31 18:02:07 +04:00
# Restore xtrace + pipefail
2013-08-09 10:40:45 +03:00
$XTRACE
2014-01-31 18:02:07 +04:00
$PIPEFAIL
2013-08-09 10:40:45 +03:00
2013-10-24 11:27:02 +01:00
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End: