From e5ea0ca80621ee0c05df7baf10b384e7f4cc8749 Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Mon, 22 Aug 2016 15:58:33 +0300 Subject: [PATCH] Add devstack plugin Add devstack plugin which enables MKS consoles in Nova and starts the mksproxy. Change-Id: Ia0daaaeeb45b19d6d9edc75f1885c683e4bdf251 --- devstack/plugin.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++ devstack/settings | 2 ++ 2 files changed, 64 insertions(+) create mode 100644 devstack/plugin.sh create mode 100644 devstack/settings diff --git a/devstack/plugin.sh b/devstack/plugin.sh new file mode 100644 index 0000000..320a1e2 --- /dev/null +++ b/devstack/plugin.sh @@ -0,0 +1,62 @@ +# Save trace setting +XTRACE=$(set +o | grep xtrace) +set -o xtrace + +# Nova virtual environment +if [[ ${USE_VENV} = True ]]; then + PROJECT_VENV["nova"]=${NOVA_DIR}.venv + NOVA_BIN_DIR=${PROJECT_VENV["nova"]}/bin +else + NOVA_BIN_DIR=$(get_python_exec_prefix) +fi + +NOVA_CONF=/etc/nova/nova.conf + +NOVNC_MKS_DIR=$DEST/noVNC-mks +NOVNC_MKS_REPO=${NOVNC_MKS_REPO:-https://github.com/rgerganov/noVNC.git} +NOVNC_MKS_BRANCH=${NOVNC_MKS_BRANCH:-master} + +function install_mksproxy { + echo_summary "Installing nova-mksproxy" + setup_develop $DEST/nova-mksproxy + echo_summary "Installing noVNC (patched for MKS)" + git_clone $NOVNC_MKS_REPO $NOVNC_MKS_DIR $NOVNC_MKS_BRANCH +} + +function configure_mksproxy { + echo_summary "Configuring MKS settings in nova.conf" + MKSPROXY_URL=${MKSPROXY_URL:-"http://$SERVICE_HOST:6090/vnc_auto.html"} + iniset $NOVA_CONF mks enabled "True" + iniset $NOVA_CONF mks mksproxy_base_url "$MKSPROXY_URL" +} + +function start_mksproxy { + echo_summary "Starting nova-mksproxy ..." + source $TOP_DIR/openrc + run_process nova-mksproxy "$NOVA_BIN_DIR/nova-mksproxy --username admin --password $OS_PASSWORD --project admin --auth-url $OS_AUTH_URL --web $NOVNC_MKS_DIR" +} + +# check for service enabled +if is_service_enabled nova-mksproxy; then + + if [[ "$1" == "stack" && "$2" == "install" ]]; then + # Perform installation of service source + install_mksproxy + + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + # Configure after the other layer 1 and 2 services have been configured + configure_mksproxy + + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + # Initialize and start nova-mksproxy + start_mksproxy + fi + + if [[ "$1" == "unstack" ]]; then + stop_process n-mksproxy + fi +fi + +# Restore xtrace +$XTRACE + diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 0000000..8e09c83 --- /dev/null +++ b/devstack/settings @@ -0,0 +1,2 @@ +enable_service nova-mksproxy +