1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#!/bin/bash -x
#
# lib/eswitchd
# Functions to control the configuration and operation of the eswitchd service
# <do not include this template file in ``stack.sh``!>
# Dependencies:
#
# - ``functions`` file
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
# - <list other global vars that are assumed to be defined>
# ``stack.sh`` calls the entry points in this order:
#
# - is_eswitchd_enabled
# - install_eswitchd_mlnx
# - configure_eswitchd_mlnx
# - init_eswitchd_mlnx
# - start_eswitchd_mlnx
# - stop_eswitchd_mlnx
# - cleanup_eswitchd_mlnx
# Save trace setting
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
ESWITCHD_DIR=$DEST/neutron_ml2_mlnx
ESWITCHD_BIN_DIR=$(get_python_exec_prefix)
ESWITCHD_CONF_DIR=/etc/neutron/plugins/ml2
ESWITCHD_CONF_FILE=$ESWITCHD_CONF_DIR/eswitchd.conf
function install_eswitchd {
install_package python-ethtool
}
function configure_eswitchd {
# setting up configuration
sudo install -d -o $STACK_USER -m 755 $ESWITCHD_CONF_DIR
sudo cp -r $ESWITCHD_DIR/$ESWITCHD_CONF_FILE $ESWITCHD_CONF_DIR
sudo cp -r $ESWITCHD_DIR/etc/neutron/rootwrap.d/eswitchd.filters /etc/neutron/rootwrap.d/
# configure nova rootwarp
Q_NOVA_RR_CONF_FILE=$NOVA_CONF_DIR/rootwrap.conf
sudo sed -e 's:^exec_dirs=\(.*\)$:exec_dirs=\1,/usr/local/bin:' -i $Q_NOVA_RR_CONF_FILE
if [[ -n "$PHYSICAL_INTERFACE_MAPPINGS" ]]; then
iniset /$ESWITCHD_CONF_FILE DAEMON fabrics "$PHYSICAL_INTERFACE_MAPPINGS"
else
iniset /$ESWITCHD_CONF_FILE DAEMON fabrics "${PHYSICAL_NETWORK}:${PHYSICAL_INTERFACE}"
fi
}
function init_eswitchd {
:
}
function start_eswitchd {
run_process eswitchd "${ESWITCHD_BIN_DIR}/eswitchd --config-file $ESWITCHD_CONF_FILE"
}
function stop_eswitchd {
stop_process eswitchd
}
function check_eswitchd {
:
}
function cleanup_eswitch {
sudo rm -rf ${ESWITCHD_CONF_FILE}
}
# Restore trace
$MY_XTRACE
|