Modifications to nfv Devstack plugin

Separate nfv configurations from install function and put them into a
configure function to be consistent with Devstack pattern.

Story: 2003163
Task: 28350
Depends-On: https://review.openstack.org/#/c/623410

Change-Id: I1acd15d628a2636ac2897abcbe446368821973bc
Signed-off-by: Yi Wang <yi.c.wang@intel.com>
This commit is contained in:
Yi Wang 2018-12-11 12:06:56 +08:00
parent bd539f9e48
commit bb093ee6ed
2 changed files with 63 additions and 32 deletions

View File

@ -81,6 +81,66 @@ function cleanup_nova_api_proxy {
pip_uninstall api-proxy
}
function configure_nfv {
configure_nfv_common
if is_service_enabled nfv-vim; then
configure_nfv_vim
fi
if is_service_enabled nfv-vim-api; then
configure_nfv_vim_api
fi
if is_service_enabled nfv-vim-webserver; then
configure_nfv_vim_webserver
fi
}
function configure_nfv_common {
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "platform" "authorization_ip" "$HOST_IP"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "openstack" "authorization_ip" "$HOST_IP"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "host" "$RABBIT_HOST"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "user_id" "$RABBIT_USERID"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "password" "$RABBIT_PASSWORD"
if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "virt_host" "/"
else
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "virt_host" "nova_cell1"
fi
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "host-listener" "host" "$HOST_IP"
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_CONF_DIR/vim/config.ini
sudo sed -i -e "s|@PYTHONROOT@|${PYTHON_SITE_DIR}|g" $NFV_CONF_DIR/vim/config.ini
iniset -sudo $NFV_CONF_DIR/vim/config.ini "sw-mgmt-configuration" "single_controller" "True"
iniset -sudo $NFV_CONF_DIR/vim/config.ini "vim-webserver" "host" "$HOST_IP"
}
function configure_nfv_vim {
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service "Service" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service "Service" "PIDFile" "/var/run/nfv-vim.pid"
}
function configure_nfv_vim_api {
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim-api
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim-api
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim-api
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service "Service" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service "Service" "PIDFile" "/var/run/nfv-vim-api.pid"
}
function configure_nfv_vim_webserver {
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim-webserver
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim-webserver
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim-webserver
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service "Service" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service "Service" "PIDFile" "/var/run/nfv-vim-webserver.pid"
}
function configure_nova_api_proxy {
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "DEFAULT" "pool_size" "256"
iniset -sudo $NOVA_API_PROXY_CONF/nova-api-proxy.conf "DEFAULT" "nfvi_compute_listen_port" "30003"
@ -171,18 +231,6 @@ function install_nfv_plugins {
sudo install -d -m 755 $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/
sudo install -p -D -m 644 $NFV_PLUGINS_DIR/nfv_plugins/nfvi_plugins/config.ini $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini
sudo install -p -D -m 644 $NFV_PLUGINS_DIR/scripts/nfvi-plugins.logrotate $STXNFV_SYSCONFDIR/logrotate.d/nfvi-plugins.logrotate
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "platform" "authorization_ip" "$HOST_IP"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "openstack" "authorization_ip" "$HOST_IP"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "host" "$RABBIT_HOST"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "user_id" "$RABBIT_USERID"
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "password" "$RABBIT_PASSWORD"
if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "virt_host" "/"
else
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "amqp" "virt_host" "nova_cell1"
fi
iniset -sudo $NFV_CONF_DIR/nfv_plugins/nfvi_plugins/config.ini "host-listener" "host" "$HOST_IP"
}
function install_nfv_tools {
@ -203,24 +251,10 @@ function install_nfv_vim {
sudo install -p -D -m 755 $NFV_VIM_DIR/scripts/vim $NFV_OCF_DIR/vim
sudo install -p -D -m 755 $NFV_VIM_DIR/scripts/vim-api $NFV_OCF_DIR/vim-api
sudo install -p -D -m 755 $NFV_VIM_DIR/scripts/vim-webserver $NFV_OCF_DIR/vim-webserver
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim-api
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_OCF_DIR/vim-webserver
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim-api
sudo sed -i -e 's|${OCF_ROOT}|@OCF_ROOT@|g' $NFV_OCF_DIR/vim-webserver
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim-api
sudo sed -i -e "s|@OCF_ROOT@|${STXNFV_OCF_ROOT}|g" $NFV_OCF_DIR/vim-webserver
sudo install -d -m 755 $NFV_CONF_DIR/vim/
sudo install -p -D -m 644 $NFV_VIM_DIR/nfv_vim/config.ini $NFV_CONF_DIR/vim/config.ini
sudo install -p -D -m 644 $NFV_VIM_DIR/nfv_vim/debug.ini $NFV_CONF_DIR/vim/debug.ini
sudo sed -i -e "s|@SYSCONFDIR@|${STXNFV_SYSCONFDIR}|g" $NFV_CONF_DIR/vim/config.ini
sudo sed -i -e "s|@PYTHONROOT@|${PYTHON_SITE_DIR}|g" $NFV_CONF_DIR/vim/config.ini
iniset -sudo $NFV_CONF_DIR/vim/config.ini "vim-webserver" "host" "$HOST_IP"
iniset -sudo $NFV_CONF_DIR/vim/config.ini "sw-mgmt-configuration" "single_controller" "True"
}
function install_nova_api_proxy {
@ -247,20 +281,14 @@ function start_nfv {
}
function start_nfv_vim {
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service "Service" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim.service "Service" "PIDFile" "/var/run/nfv-vim.pid"
run_process nfv-vim "$NFV_OCF_DIR/vim start" root root
}
function start_nfv_vim_api {
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service "Service" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-api.service "Service" "PIDFile" "/var/run/nfv-vim-api.pid"
run_process nfv-vim-api "$NFV_OCF_DIR/vim-api start" root root
}
function start_nfv_vim_webserver {
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service "Service" "Type" "forking"
iniset -sudo $STXNFV_SYSCONFDIR/systemd/system/devstack@nfv-vim-webserver.service "Service" "PIDFile" "/var/run/nfv-vim-webserver.pid"
run_process nfv-vim-webserver "$NFV_OCF_DIR/vim-webserver start" root root
}

View File

@ -23,6 +23,9 @@ if is_service_enabled stx-nfv; then
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring stx-nfv"
if is_service_enabled nfv-vim || is_service_enabled nfv-vim-api || is_service_enabled nfv-vim-webserver; then
configure_nfv
fi
if is_service_enabled nova-api-proxy; then
configure_nova_api_proxy
fi