summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmcp/config/states/maas14
-rw-r--r--mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/maas.yml13
-rw-r--r--mcp/scripts/lib.sh5
-rwxr-xr-xmcp/scripts/salt.sh2
4 files changed, 17 insertions, 17 deletions
diff --git a/mcp/config/states/maas b/mcp/config/states/maas
index a76453033..5e33f3a08 100755
--- a/mcp/config/states/maas
+++ b/mcp/config/states/maas
@@ -1,4 +1,5 @@
#!/bin/bash -e
+# shellcheck disable=SC1090,SC2155
##############################################################################
# Copyright (c) 2017 Mirantis Inc., Enea AB and others.
# All rights reserved. This program and the accompanying materials
@@ -10,21 +11,18 @@
CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
ERASE_ENV=${ERASE_ENV:-0}
-# shellcheck disable=SC1090
+source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/globals.sh"
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
# Wait for MaaS commissioning/deploy to finish, retry on failure
function maas_fixup() {
local statuscmd="salt 'mas01*' --out yaml state.apply maas.machines.status"
- # shellcheck disable=SC2155
local ncount=$(salt --out yaml 'mas01*' pillar.get maas:region:machines | \
grep -cE '^\s{2}\w+:$')
wait_for 180 "${statuscmd} | tee /dev/stderr | " \
"grep -Eq '((Deployed|Ready): ${ncount}|status: (Failed|Allocated))'"
- # shellcheck disable=SC2155
local statusout=$(eval "${statuscmd}")
- # shellcheck disable=SC2155
local fcnodes=$(echo "${statusout}" | \
grep -Pzo 'status: Failed commissioning\n\s+system_id: \K.+\n')
for node_system_id in ${fcnodes}; do
@@ -37,7 +35,6 @@ function maas_fixup() {
return 1
fi
- # shellcheck disable=SC2155
local fdnodes=$(echo "${statusout}" | \
grep -Pzo 'status: (Failed deployment|Allocated)\n\s+system_id: \K.+\n')
for node_system_id in ${fdnodes}; do
@@ -55,12 +52,13 @@ function maas_fixup() {
# Optionally destroy MaaS machines from a previous run
if [ "${ERASE_ENV}" -gt 1 ]; then
- dnodes=$(salt 'mas01*' --out yaml state.apply maas.machines.status | \
- grep -Pzo '\s+system_id: \K.+\n')
+ set +e; dnodes=$(salt 'mas01*' --out yaml state.apply maas.machines.status | \
+ grep -Pzo '\s+system_id: \K.+\n'); set -e
+ cleanup_uefi
for node_system_id in ${dnodes}; do
salt -C 'mas01*' state.apply maas.machines.delete \
pillar="{'system_id': '${node_system_id}'}"
- sleep 30
+ sleep 10
done
fi
diff --git a/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/maas.yml b/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/maas.yml
index b2e22b3cb..6332776d8 100644
--- a/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/maas.yml
+++ b/mcp/reclass/classes/cluster/baremetal-mcp-pike-common-ha/infra/maas.yml
@@ -23,6 +23,7 @@ parameters:
maas_db_password: opnfv_secret
dns_server01: ${_param:opnfv_dns_server01}
single_address: ${_param:infra_maas_node01_deploy_address}
+ hwe_kernel: 'hwe-16.04-edge'
maas:
region:
salt_master_ip: ${_param:reclass_config_master}
@@ -36,7 +37,7 @@ parameters:
dnssec_validation: 'no'
enable_third_party_drivers: true
network_discovery: 'enabled'
- default_min_hwe_kernel: 'hwe-16.04'
+ default_min_hwe_kernel: ${_param:hwe_kernel}
subnets:
opnfv_maas_pxe:
name: ${_param:opnfv_infra_maas_pxe_network_address}/24
@@ -62,7 +63,7 @@ parameters:
power_user: ${_param:opnfv_maas_node01_power_user}
architecture: ${_param:opnfv_maas_node01_architecture}
distro_series: xenial
- hwe_kernel: hwe-16.04
+ hwe_kernel: ${_param:hwe_kernel}
kvm02:
interface:
mac: ${_param:opnfv_maas_node02_interface_mac}
@@ -73,7 +74,7 @@ parameters:
power_user: ${_param:opnfv_maas_node02_power_user}
architecture: ${_param:opnfv_maas_node02_architecture}
distro_series: xenial
- hwe_kernel: hwe-16.04
+ hwe_kernel: ${_param:hwe_kernel}
kvm03:
interface:
mac: ${_param:opnfv_maas_node03_interface_mac}
@@ -84,7 +85,7 @@ parameters:
power_user: ${_param:opnfv_maas_node03_power_user}
architecture: ${_param:opnfv_maas_node03_architecture}
distro_series: xenial
- hwe_kernel: hwe-16.04
+ hwe_kernel: ${_param:hwe_kernel}
cmp001:
interface:
mac: ${_param:opnfv_maas_node04_interface_mac}
@@ -95,7 +96,7 @@ parameters:
power_user: ${_param:opnfv_maas_node04_power_user}
architecture: ${_param:opnfv_maas_node04_architecture}
distro_series: xenial
- hwe_kernel: hwe-16.04
+ hwe_kernel: ${_param:hwe_kernel}
cmp002:
interface:
mac: ${_param:opnfv_maas_node05_interface_mac}
@@ -106,7 +107,7 @@ parameters:
power_user: ${_param:opnfv_maas_node05_power_user}
architecture: ${_param:opnfv_maas_node05_architecture}
distro_series: xenial
- hwe_kernel: hwe-16.04
+ hwe_kernel: ${_param:hwe_kernel}
linux:
network:
interface:
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 6baed8c81..982cc37fd 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -151,8 +151,9 @@ function cleanup_mounts {
function cleanup_uefi {
# Clean up Ubuntu boot entry if cfg01, kvm nodes online from previous deploy
- # shellcheck disable=SC2086
- ssh ${SSH_OPTS} "${SSH_SALT}" "sudo salt -C 'kvm* or cmp*' cmd.run \
+ local cmd_str="ssh ${SSH_OPTS} ${SSH_SALT}"
+ [ ! "$(hostname)" = 'cfg01' ] || cmd_str='eval'
+ ${cmd_str} "sudo salt -C 'kvm* or cmp*' cmd.run \
\"which efibootmgr > /dev/null 2>&1 && \
efibootmgr | grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | \
xargs -I{} efibootmgr --delete-bootnum --bootnum {}; \
diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh
index 25eb0ede8..d687e3efa 100755
--- a/mcp/scripts/salt.sh
+++ b/mcp/scripts/salt.sh
@@ -97,7 +97,7 @@ ssh ${SSH_OPTS} "${SSH_SALT}" bash -s -e << SALT_INSTALL_END
salt -C "${NODE_MASK} or cfg01*" state.apply salt | \
grep -Fq 'No response' && salt -C "${NODE_MASK} or cfg01*" state.apply salt
- salt -C 'I@salt:master' state.sls linux
+ salt-call state.sls linux || salt-call state.sls linux
salt -C "${NODE_MASK} and not cfg01*" state.sls linux || true
salt -C "${NODE_MASK} and not cfg01*" pkg.upgrade refresh=False