From 9aab7f2859e336594fe299c397660b5b38204e02 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 29 Jan 2019 18:05:44 +0100 Subject: [PATCH] [deploy] Allow only operating system install Extend one of the existing deployment arguments to allow the installation of only the operating system and infrastructure networks, skipping cloud setup. Change-Id: Ibc5d0f324ed15b66f809839cfce49a0324b6fe4d Signed-off-by: Alexandru Avadanii --- ci/deploy.sh | 15 +++++++++------ mcp/scripts/xdf_data.sh.j2 | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ci/deploy.sh b/ci/deploy.sh index 0e789e8c1..789721f81 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -38,13 +38,13 @@ $(notify "USAGE:" 2) $(basename "$0") -l lab-name -p pod-name -s deploy-scenario \\ [-b Lab Config Base URI] \\ [-S storage-dir] [-L /path/to/log/file.tar.gz] \\ - [-f] [-F] [-e | -E[E]] [-d] [-D] [-N] [-m] + [-f] [-F[F]] [-e[e] | -E[E]] [-d] [-D] [-N] [-m] $(notify "OPTIONS:" 2) -b Base-uri for the stack-configuration structure -d Dry-run -D Debug logging - -e Do not launch environment deployment + -e Do not launch environment deployment (use twice to skip cloud setup) -E Remove existing VCP VMs (use twice to redeploy baremetal nodes) -f Deploy on existing Salt master (use twice or more to skip states) -F Same as -e, do not launch environment deployment (legacy option) @@ -77,6 +77,8 @@ $(notify_i "Input parameters to the build script are:" 2) -d Dry-run - Produce deploy config files, but do not execute deploy -D Debug logging - Enable extra logging in sh deploy scripts (set -x) -e Do not launch environment deployment + If specified twice (e.g. -e -e), only the operating system and networks + will be provisioned, skipping cloud installation. -E Remove existing VCP VMs. It will destroy and undefine all VCP VMs currently defined on cluster KVM nodes. If specified twice (e.g. -E -E), baremetal nodes (VCP too, implicitly) will be removed, then reprovisioned. @@ -138,7 +140,7 @@ DEF_DOCKER_TAG=$(basename "${OPNFV_BRANCH/master/latest}") DRY_RUN=${DRY_RUN:-0} USE_EXISTING_PKGS=${USE_EXISTING_PKGS:-0} USE_EXISTING_INFRA=${USE_EXISTING_INFRA:-0} -NO_DEPLOY_ENVIRONMENT=${NO_DEPLOY_ENVIRONMENT:-0} +MCP_NO_DEPLOY_ENVIRONMENT=${MCP_NO_DEPLOY_ENVIRONMENT:-0} ERASE_ENV=${ERASE_ENV:-0} MCP_VCP=${MCP_VCP:-1} MCP_DOCKER_TAG=${MCP_DOCKER_TAG:-${DEF_DOCKER_TAG}} @@ -179,7 +181,7 @@ do ((USE_EXISTING_INFRA+=1)) ;; F|e) - NO_DEPLOY_ENVIRONMENT=1 + ((MCP_NO_DEPLOY_ENVIRONMENT+=1)) ;; E) ((ERASE_ENV+=1)) @@ -279,7 +281,8 @@ export MAAS_SSH_KEY="$(cat "$(basename "${SSH_KEY}").pub")" # Expand jinja2 templates based on PDF data and env vars [[ "${DEPLOY_SCENARIO}" =~ -ha$ ]] || MCP_VCP=0 export MCP_REPO_ROOT_PATH MCP_VCP MCP_STORAGE_DIR MCP_DOCKER_TAG MCP_CMP_SS \ - MCP_JUMP_ARCH=$(uname -i) MCP_DEPLOY_SCENARIO="${DEPLOY_SCENARIO}" + MCP_JUMP_ARCH=$(uname -i) MCP_DEPLOY_SCENARIO="${DEPLOY_SCENARIO}" \ + MCP_NO_DEPLOY_ENVIRONMENT do_templates_scenario "${MCP_STORAGE_DIR}" "${TARGET_LAB}" "${TARGET_POD}" \ "${BASE_CONFIG_URI}" "${SCENARIO_DIR}" \ "${SCENARIO_DIR}/${DEPLOY_SCENARIO}.yaml" @@ -322,7 +325,7 @@ check_connection # Openstack cluster setup set +x -if [ ${NO_DEPLOY_ENVIRONMENT} -eq 1 ]; then +if [ ${MCP_NO_DEPLOY_ENVIRONMENT} -eq 1 ]; then notify "[NOTE] Skip openstack cluster setup" 2 else for state in "${cluster_states[@]:${USE_EXISTING_INFRA}}"; do diff --git a/mcp/scripts/xdf_data.sh.j2 b/mcp/scripts/xdf_data.sh.j2 index e762fe957..4db5593e3 100644 --- a/mcp/scripts/xdf_data.sh.j2 +++ b/mcp/scripts/xdf_data.sh.j2 @@ -12,6 +12,7 @@ # {%- import 'net_map.j2' as nm with context -%} +{%- set cluster_states = conf.cluster.states if conf.MCP_NO_DEPLOY_ENVIRONMENT < 2 else [] -%} {%- set arch = conf[conf.MCP_JUMP_ARCH] -%} {%- set V = conf.virtual -%} {%- do V.nodes.update(arch.default.virtual.nodes) -%} @@ -100,7 +101,7 @@ OPNFV_BRIDGES=( ) export CLUSTER_DOMAIN={{ conf.cluster.domain }} -cluster_states={{ bash_arr(arch.default.cluster.states + conf.cluster.states) }} +cluster_states={{ bash_arr(arch.default.cluster.states + cluster_states) }} virtual_nodes={{ filter_nodes('virtual') }} control_nodes_query={{ filter_nodes(['baremetal', 'virtual'], True, ['control']) }} base_image={{ arch.base_image }} -- 2.16.6