Revert "Fix race condition with nova privsep utime"
[fuel.git] / ci / deploy.sh
index af60ddf..629f66b 100755 (executable)
@@ -32,19 +32,19 @@ usage ()
 {
 cat << EOF
 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-$(notify "$(basename "$0"): Deploy the Fuel@OPNFV MCP stack" 3)
+$(notify "$(basename "$0"): Deploy the OPNFV Fuel MCP stack" 3)
 
 $(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)
@@ -59,9 +59,9 @@ $(notify "OPTIONS:" 2)
   -N  Experimental: Do not virtualize control plane (novcp)
 
 $(notify_i "Description:" 2)
-Deploys the Fuel@OPNFV stack on the indicated lab resource.
+Deploys the OPNFV Fuel stack on the indicated lab resource.
 
-This script provides the Fuel@OPNFV deployment abstraction.
+This script provides the OPNFV Fuel deployment abstraction.
 It depends on the OPNFV official configuration directory/file structure
 and provides a fairly simple mechanism to execute a deployment.
 
@@ -74,11 +74,11 @@ $(notify_i "Input parameters to the build script are:" 2)
    <base-uri>/labs/<lab-name>/idf-<pod-name>.yaml
    The default is using the git submodule tracking 'OPNFV Pharos' in
    <./mcp/scripts/pharos>.
-   An example config is provided inside current repo in
-   <./mcp/config>, automatically linked as <./mcp/scripts/pharos/labs/local>.
 -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.
@@ -92,10 +92,7 @@ $(notify_i "Input parameters to the build script are:" 2)
 -h Print this message and exit
 -L Deployment log path and name, eg. -L /home/jenkins/job.log.tar.gz
 -l Lab name as defined in the configuration directory, e.g. lf
-   For the sample configuration in <./mcp/config>, lab name is 'local'.
 -p POD name as defined in the configuration directory, e.g. pod2
-   For the sample configuration in <./mcp/config>, POD name is 'virtual1'
-   for virtual deployments or 'pod1' for baremetal (based on lf-pod2).
 -m Use single socket compute nodes. Instead of using default NUMA-enabled
    topology for virtual compute nodes created via libvirt, configure a
    single guest CPU socket.
@@ -136,15 +133,17 @@ DEPLOY_DIR=$(cd "${MCP_REPO_ROOT_PATH}/mcp/scripts"; pwd)
 MCP_STORAGE_DIR='/var/lib/opnfv/tmpdir'
 URI_REGEXP='(file|https?|ftp)://.*'
 BASE_CONFIG_URI="file://${MCP_REPO_ROOT_PATH}/mcp/scripts/pharos"
+OPNFV_BRANCH=$(sed -ne 's/defaultbranch=//p' "${MCP_REPO_ROOT_PATH}/.gitreview")
+DEF_DOCKER_TAG=$(basename "${OPNFV_BRANCH/master/latest}")
 
 # Customize deploy workflow
 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:-latest}
+MCP_DOCKER_TAG=${MCP_DOCKER_TAG:-${DEF_DOCKER_TAG}}
 MCP_CMP_SS=${MCP_CMP_SS:-0}
 
 source "${DEPLOY_DIR}/globals.sh"
@@ -182,7 +181,7 @@ do
             ((USE_EXISTING_INFRA+=1))
             ;;
         F|e)
-            NO_DEPLOY_ENVIRONMENT=1
+            ((MCP_NO_DEPLOY_ENVIRONMENT+=1))
             ;;
         E)
             ((ERASE_ENV+=1))
@@ -248,7 +247,7 @@ pushd "${DEPLOY_DIR}" > /dev/null
 
 # Install required packages on jump server
 sudo mkdir -p "${MCP_STORAGE_DIR}"
-sudo chown "${USER}:${USER}" "${MCP_STORAGE_DIR}"
+sudo chown -R "${USER}:${USER}" "${MCP_STORAGE_DIR}"
 if [ ${USE_EXISTING_PKGS} -eq 1 ]; then
     notify "[NOTE] Skipping distro pkg installation" 2
 else
@@ -282,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"
@@ -295,7 +295,8 @@ source "${DEPLOY_DIR}/xdf_data.sh"
 
 # Jumpserver prerequisites check
 notify "[NOTE] Using bridges: ${OPNFV_BRIDGES[*]}" 2
-jumpserver_check_requirements "${virtual_nodes[*]}" "${OPNFV_BRIDGES[@]}"
+jumpserver_check_requirements "${cluster_states[*]}" "${virtual_nodes[*]}" \
+                              "${OPNFV_BRIDGES[@]}"
 
 # Infra setup
 if [ ${DRY_RUN} -eq 1 ]; then
@@ -311,7 +312,6 @@ else
     do_sysctl_cfg
     do_udev_cfg
     create_vms "${MCP_STORAGE_DIR}" "${virtual_nodes_data}" "${OPNFV_BRIDGES[@]}"
-    update_mcpcontrol_network
     start_vms "${virtual_nodes[@]}"
 
     # https://github.com/docker/libnetwork/issues/1743
@@ -325,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