[FN VM] Reboot VMs on jump, wait for all online 39/51639/3
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 5 Feb 2018 02:28:45 +0000 (03:28 +0100)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 5 Feb 2018 05:03:27 +0000 (06:03 +0100)
- apply `linux` state on cfg01 first, so PXE/admin IP is added and
  FN VM minions are available;
- add barrier and wait for all FN VMs to register with cfg01;
- use batch-mode execution while applying `linux.network` on FN VMs;
- retry all states executed via <salt.sh> on FN VMs;

JIRA: FUEL-310

Change-Id: I72e1c565370072500df1d486fe76e6315f583c75
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
ci/deploy.sh
mcp/config/states/dpdk
mcp/config/states/maas
mcp/reclass/classes/cluster/virtual-mcp-pike-common-noha/infra/config.yml
mcp/reclass/classes/cluster/virtual-mcp-pike-common-noha/openstack_control.yml
mcp/scripts/salt.sh

index 20c0026..ef941b0 100755 (executable)
@@ -345,7 +345,7 @@ else
     check_connection
 fi
 if [ ${USE_EXISTING_INFRA} -lt 2 ]; then
-    wait_for 5 "./salt.sh ${LOCAL_PDF_RECLASS}"
+    wait_for 5 "./salt.sh ${LOCAL_PDF_RECLASS} ${virtual_nodes[*]}"
 fi
 
 # Openstack cluster setup
index 5ae2aac..281b78f 100755 (executable)
@@ -12,8 +12,5 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
 # shellcheck disable=SC1090
 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
 
-salt -I 'nova:compute' system.reboot
-wait_for 90.0 "salt -I 'nova:compute' test.ping"
-
 salt -I 'nova:compute' alternatives.set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
 salt -I 'nova:compute' service.restart openvswitch-switch
index 8f7a866..dcbdf98 100755 (executable)
@@ -77,7 +77,7 @@ salt -C 'mas01*' state.apply maas.machines
 # cleanup outdated salt keys
 sleep 30
 salt-key --out yaml | awk '!/^(minions|- cfg01|- mas01)/ {print $2}' | \
-  xargs -I{} salt-key -yd {}
+  xargs --no-run-if-empty -I{} salt-key -yd {}
 
 # MaaS node deployment
 wait_for 10 maas_fixup
index 7e3a494..908ba77 100644 (file)
@@ -33,6 +33,11 @@ parameters:
   linux:
     network:
       interface:
+        dhcp:
+          enabled: true
+          type: eth
+          proto: dhcp
+          name: ${_param:opnfv_fn_vm_primary_interface}
         single_int:
           enabled: true
           name: ${_param:opnfv_fn_vm_secondary_interface}
@@ -40,6 +45,13 @@ parameters:
           proto: static
           address: ${_param:single_address}
           netmask: 255.255.255.0
+        pxe:
+          enabled: true
+          type: eth
+          proto: static
+          name: ${_param:opnfv_fn_vm_tertiary_interface}
+          address: ${_param:opnfv_infra_config_pxe_address}
+          netmask: 255.255.255.0
   salt:
     master:
       file_recv: true
index 9825674..9defb00 100644 (file)
@@ -54,6 +54,11 @@ parameters:
           version: latest
     network:
       interface:
+        dhcp_int:
+          enabled: true
+          name: ${_param:opnfv_fn_vm_primary_interface}
+          proto: dhcp
+          type: eth
         single_int:
           enabled: true
           name: ${_param:opnfv_fn_vm_secondary_interface}
index 03218e2..87f7a16 100755 (executable)
@@ -16,15 +16,14 @@ F_GIT_DIR=$(cd "${F_GIT_ROOT}/mcp" && git rev-parse --git-dir)
 F_GIT_SUBD=${F_GIT_ROOT#${F_GIT_DIR%%/.git*}}
 OPNFV_TMP_DIR="/home/${SALT_MASTER_USER}/opnfv"
 OPNFV_GIT_DIR="/root/opnfv"
-OPNFV_FUEL_DIR="/root/fuel"
+OPNFV_FUEL_DIR="/root/fuel" # Should be in sync with patch.sh, scripts patches
 OPNFV_RDIR="reclass/classes/cluster/all-mcp-arch-common"
 OPNFV_VCP_IMG="mcp/scripts/base_image_opnfv_fuel_vcp.img"
 OPNFV_VCP_DIR="/srv/salt/env/prd/salt/files/control/images"
 LOCAL_GIT_DIR="${F_GIT_ROOT%${F_GIT_SUBD}}"
-LOCAL_PDF_RECLASS=$1
-NODE_MASK='*'
-
-[[ "${CLUSTER_DOMAIN}" =~ virtual ]] || NODE_MASK='mas01*'
+LOCAL_PDF_RECLASS=$1; shift
+LOCAL_VIRT_NODES=$(echo ${*//cfg01/}) # unquoted to filter space
+NODE_MASK="${LOCAL_VIRT_NODES// /|}"
 
 # push to cfg01 current git repo first (including submodules), at ~ubuntu/opnfv
 # later we move it to ~root/opnfv (and ln as ~root/fuel); delete the temp clone
@@ -96,14 +95,22 @@ ssh ${SSH_OPTS} "${SSH_SALT}" bash -s -e << SALT_INSTALL_END
   fi
 
   # Init specific to VMs on FN (all for virtual, cfg|mas for baremetal)
-  salt -C "${NODE_MASK} or cfg01*" saltutil.sync_all
-  wait_for 3.0 'salt -C "${NODE_MASK} or cfg01*" state.apply salt'
   wait_for 3.0 'salt -C "cfg01*" state.apply linux'
+  if [[ "${LOCAL_VIRT_NODES}" =~ mas ]]; then
+    wait_for 3.0 'salt -C "mas*" test.ping'
+  else
+    wait_for 3.0 'for n in ${LOCAL_VIRT_NODES}; do salt -C \${n}.* test.ping; done'
+  fi
+  wait_for 3.0 'salt -C "E@^(${NODE_MASK}|cfg01).*" saltutil.sync_all'
+  wait_for 3.0 'salt -C "E@^(${NODE_MASK}|cfg01).*" state.apply salt'
 
-  salt -C "${NODE_MASK} and not cfg01*" state.sls linux || true
-  salt -C "${NODE_MASK} and not cfg01*" pkg.upgrade refresh=False
+  wait_for 3.0 'salt -C "E@^(${NODE_MASK}).*" state.sls linux.system,linux.storage'
+  salt -C "E@^(${NODE_MASK}).*" state.sls linux.network -b 1 || true
+  salt -C "E@^(${NODE_MASK}).*" system.reboot
+  wait_for 90.0 'salt -C "E@^(${NODE_MASK}).*" test.ping'
+  wait_for 3.0 'salt -C "E@^(${NODE_MASK}).*" pkg.upgrade refresh=False'
 
-  salt -C "${NODE_MASK} or cfg01*" state.sls ntp
+  wait_for 3.0 'salt -C "E@^(${NODE_MASK}|cfg01).*" state.sls ntp'
 
   if [ -f "${OPNFV_FUEL_DIR}/${OPNFV_VCP_IMG}" ]; then
     mkdir -p "${OPNFV_VCP_DIR}"