diff options
Diffstat (limited to 'mcp/config/states')
-rwxr-xr-x | mcp/config/states/baremetal_init | 7 | ||||
-rwxr-xr-x | mcp/config/states/dpdk | 3 | ||||
-rwxr-xr-x | mcp/config/states/maas | 43 | ||||
-rwxr-xr-x | mcp/config/states/networking_gw | 12 | ||||
-rwxr-xr-x | mcp/config/states/neutron_compute | 12 | ||||
-rwxr-xr-x | mcp/config/states/opendaylight | 16 | ||||
-rwxr-xr-x | mcp/config/states/openstack_ha | 54 | ||||
-rwxr-xr-x | mcp/config/states/openstack_noha | 1 | ||||
-rwxr-xr-x | mcp/config/states/ovn_ctl_opts | 15 | ||||
-rwxr-xr-x | mcp/config/states/virtual_control_plane | 17 |
10 files changed, 77 insertions, 103 deletions
diff --git a/mcp/config/states/baremetal_init b/mcp/config/states/baremetal_init index c14772837..891eae365 100755 --- a/mcp/config/states/baremetal_init +++ b/mcp/config/states/baremetal_init @@ -1,6 +1,6 @@ #!/bin/bash -e ############################################################################## -# Copyright (c) 2017 Mirantis Inc., Enea AB and others. +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at @@ -25,8 +25,11 @@ salt -C 'kvm* or cmp*' file.replace $debian_ip_source \ salt -C 'kvm*' pkg.install bridge-utils salt -C 'kvm*' state.apply linux.network,linux.system.kernel salt -C 'kvm* or cmp*' state.apply salt.minion -salt -C 'cmp*' state.apply linux.system +wait_for 5.0 "salt -C 'cmp*' state.apply linux.system" +# wrap distro `route` binary to silence errors when route already exists +wait_for 5.0 "salt -C 'kvm* or cmp*' state.apply opnfv.route_wrapper" salt -C 'cmp*' state.apply linux.network || true +wait_for 30.0 "salt -C 'kvm* or cmp*' test.ping" # disable dhcp offered routes on compute nodes salt -C 'cmp*' file.write /etc/dhcp/dhclient-enter-hooks.d/no-default-route \ diff --git a/mcp/config/states/dpdk b/mcp/config/states/dpdk index 5ae2aac48..281b78fed 100755 --- a/mcp/config/states/dpdk +++ b/mcp/config/states/dpdk @@ -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 diff --git a/mcp/config/states/maas b/mcp/config/states/maas index 8f7a86611..10cfd01bf 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -14,6 +14,9 @@ ERASE_ENV=${ERASE_ENV:-0} source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/globals.sh" source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" +bm_nodes=$(salt --out yaml 'mas01*' pillar.get maas:region:machines | \ + awk '/^\s+\w+[[:digit:]]+:$/ {gsub(/:$/, "*"); printf "%s ", $1}') + # Wait for MaaS commissioning/deploy to finish, retry on failure function maas_fixup() { local statuscmd="salt 'mas01*' --out yaml state.apply maas.machines.status" @@ -27,12 +30,19 @@ function maas_fixup() { local fcnodes=$(echo "${statusout}" | \ grep -Pzo 'status: Failed commissioning\n\s+system_id: \K.+\n') + local ftnodes=$(echo "${statusout}" | \ + grep -Pzo 'status: Failed testing\n\s+system_id: \K.+\n') for node_system_id in ${fcnodes}; do salt -C 'mas01*' state.apply maas.machines.delete \ pillar="{'system_id': '${node_system_id}'}" sleep 10 done - if [ -n "${fcnodes}" ]; then + for node_system_id in ${ftnodes}; do + salt -C 'mas01*' state.apply maas.machines.override_failed_testing \ + pillar="{'system_id': '${node_system_id}'}" + sleep 10 + done + if [ -n "${fcnodes}" ] || [ -n "${ftnodes}" ]; then salt -C 'mas01*' state.apply maas.machines return 1 fi @@ -47,6 +57,16 @@ function maas_fixup() { sleep 10 done if [ -n "${fdnodes}" ] || [ -n "${rnodes}" ]; then + for node_system_id in ${fdnodes} ${rnodes}; do + # For now, we allocate 30GB (fixed) for / on cmp nodes + local node_hostname=$(echo "${statusout}" | \ + grep -Pzo 'hostname: \K.+(?=\n.+\n\s+system_id: '"${node_system_id}"')') + if [[ "${node_hostname}" =~ ^cmp ]]; then + salt -C 'mas01*' state.apply maas.machines.set_storage_layout \ + pillar="{'system_id': '${node_system_id}', 'lv_size': '32212254720'}" + sleep 10 + fi + done salt -C 'mas01*' state.apply maas.machines.deploy return 1 fi @@ -68,16 +88,19 @@ fi # MaaS rack/region controller, node commissioning salt -C 'mas01*' state.apply linux,salt,openssh,ntp +salt -C 'mas01*' state.apply maas.pxe_nat salt -C 'mas01*' state.apply maas.cluster wait_for 10 "salt -C 'mas01*' state.apply maas.region" -salt -C 'mas01*' state.apply maas.machines +if [ -n "${bm_nodes}" ]; then + salt -C 'mas01*' state.apply maas.machines +fi # 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 @@ -87,18 +110,6 @@ salt -C 'mas01*' pillar.item\ maas:region:admin:password # Check all baremetal nodes are available -rc=1 -attempt=0 -total_attempts=10 -while [ $rc -ne 0 ] && [ ${attempt} -lt ${total_attempts} ]; do - bm_nodes=$(salt --out yaml 'mas01*' pillar.get maas:region:machines | \ - awk '/^\s+\w+[[:digit:]]+:$/ {gsub(/:$/, "*"); print $1}') - rc=0 - for node in $bm_nodes; do - salt "$node" test.ping 2>/dev/null || { rc=$?; break; }; - done - sleep 5 - ((attempt+=1)) -done +wait_for 5.0 "(for n in ${bm_nodes}; do salt \${n} test.ping 2>/dev/null || exit; done)" wait_for 10.0 "salt -C '* and not cfg01* and not mas01*' saltutil.sync_all" diff --git a/mcp/config/states/networking_gw b/mcp/config/states/networking_gw deleted file mode 100755 index ea7c87b01..000000000 --- a/mcp/config/states/networking_gw +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e -############################################################################## -# Copyright (c) 2018 Mirantis Inc., Enea AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x - -salt -I 'neutron:gateway' cmd.run 'ifup --force --ignore-errors br-ex' diff --git a/mcp/config/states/neutron_compute b/mcp/config/states/neutron_compute deleted file mode 100755 index c6b90e20d..000000000 --- a/mcp/config/states/neutron_compute +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e -############################################################################## -# Copyright (c) 2017 Mirantis Inc., Enea AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x - -salt -I 'neutron:compute' state.sls neutron diff --git a/mcp/config/states/opendaylight b/mcp/config/states/opendaylight index 34a2c3bd8..de15d0cef 100755 --- a/mcp/config/states/opendaylight +++ b/mcp/config/states/opendaylight @@ -1,6 +1,6 @@ #!/bin/bash -e ############################################################################## -# Copyright (c) 2017 Mirantis Inc., Enea AB and others. +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at @@ -9,7 +9,13 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x -salt -I 'opendaylight:server' state.sls opendaylight -salt -I 'opendaylight:client' state.sls opendaylight.client -salt -I 'opendaylight:client' cmd.run 'neutron-odl-ovs-hostconfig --noovs_dpdk' -salt -I 'neutron:server' state.sls opendaylight.client +# shellcheck disable=SC1090 +source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" + +# Get OpenDaylight server options with prefix odl_ +function odl() { + salt --out txt -I 'opendaylight:server' pillar.get "opendaylight:server:odl_$1" | cut -d ' ' -f2 +} + +wait_for 5.0 "salt -I 'opendaylight:server' state.sls opendaylight" +wait_for 20 "salt --out yaml -C 'I@neutron:server and *01*' network.connect $(odl bind_ip) $(odl rest_port) | fgrep -q 'result: true'" diff --git a/mcp/config/states/openstack_ha b/mcp/config/states/openstack_ha index 0bbf7cde5..77063d6c8 100755 --- a/mcp/config/states/openstack_ha +++ b/mcp/config/states/openstack_ha @@ -12,8 +12,8 @@ CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x # shellcheck disable=SC1090 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" -salt -I 'keepalived:cluster' state.sls keepalived -b 1 -salt -I 'keepalived:cluster' pillar.get keepalived:cluster:instance:VIP:address +wait_for 5.0 "salt -I 'keepalived:cluster' state.sls keepalived -b 1" +wait_for 5.0 "salt -I 'keepalived:cluster' pillar.get keepalived:cluster:instance:VIP:address" salt -C 'I@rabbitmq:server and *01*' state.sls rabbitmq salt -I 'rabbitmq:server' state.sls rabbitmq @@ -25,10 +25,10 @@ salt -I 'glusterfs:server' cmd.run "gluster peer status; gluster volume status" salt -I 'glusterfs:client' state.sls glusterfs.client salt -I 'galera:master' state.sls galera -salt -I 'galera:slave' state.sls galera +salt -I 'galera:slave' state.sls galera -b 1 salt -I 'galera:master' mysql.status | grep -A1 wsrep_cluster_size -salt -I 'memcached:server' state.sls memcached +wait_for 3.0 "salt -I 'memcached:server' state.sls memcached" salt -I 'haproxy:proxy' state.sls haproxy salt -I 'haproxy:proxy' service.status haproxy @@ -38,15 +38,15 @@ set +e; salt -I 'keystone:server' state.sls keystone.server -b 1; set -e salt -I 'keystone:server' service.restart apache2 salt -I 'keystone:server' state.sls keystone.server -b 1 -wait_for 30 "salt -I 'keystone:client' state.sls keystone.client" +wait_for 30.0 "salt -I 'keystone:client' state.sls keystone.client" salt -I 'keystone:server' cmd.run ". /root/keystonercv3; openstack service list" salt -I 'glance:server' state.sls glance -b 1 salt -I 'nova:controller' state.sls nova -b 1 salt -I 'heat:server' state.sls heat -b 1 -wait_for 5 "salt -I 'cinder:controller' state.sls cinder -b 1" -wait_for 3 "salt -I 'cinder:volume' state.sls cinder" +wait_for 5.0 "salt -I 'cinder:controller' state.sls cinder -b 1" +wait_for 3.0 "salt -I 'cinder:volume' state.sls cinder" salt -I 'neutron:server' state.sls neutron -b 1 salt -I 'neutron:gateway' state.sls neutron.gateway @@ -54,7 +54,7 @@ salt -I 'neutron:gateway' state.sls neutron.gateway salt -I 'nova:compute' state.sls nova salt -C 'I@mongodb:server and *01*' state.sls mongodb || true -wait_for 10 "salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin'" +wait_for 10.0 "salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin'" salt -C 'I@mongodb:server and *01*' cmd.run 'mongo localhost:27017/admin --eval "rs.initiate()"' salt -I 'mongodb:server' state.sls mongodb @@ -63,23 +63,27 @@ salt -I 'ceilometer:server' state.sls ceilometer salt -I 'ceilometer:agent' state.sls ceilometer salt -I 'horizon:server' state.sls horizon -salt -I 'nginx:server' state.sls nginx,sphinx - -# workaround for the pike horizon is missing css, FUEL-324 -salt -I 'horizon:server' file.symlink \ - /var/lib/openstack-dashboard/static \ - /usr/share/openstack-dashboard/static -salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py collectstatic --noinput" -salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py compress --force" -salt -I 'horizon:server' file.append /etc/openstack-dashboard/local_settings.py \ - "AVAILABLE_THEMES = [ ('default', 'Default', 'themes/default'),]" -salt -I 'horizon:server' service.reload apache2 - -clstr_vip_addr=$(salt -C 'I@nginx:server and *01*' --out=yaml \ - pillar.get _param:cluster_vip_address | awk '{print $2; exit}') -salt -C 'I@nginx:server and *01*' cp.push \ - "/etc/ssl/certs/${clstr_vip_addr}-with-chain.crt" upload_path='certs/os_cacert' -cd /etc/ssl/certs && ln -sf /var/cache/salt/master/minions/prx01.*/files/certs/os_cacert +salt -I 'nginx:server' state.sls nginx + +# workaround for Ubuntu Pike Horizon missing css, FUEL-324 +if ! salt -C 'I@horizon:server and *01*' --out=yaml pkg.version openstack-dashboard | grep -qE ':.*mcp'; then + salt -I 'horizon:server' file.symlink \ + /var/lib/openstack-dashboard/static \ + /usr/share/openstack-dashboard/static + salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py collectstatic --noinput" + salt -I 'horizon:server' cmd.run "/usr/share/openstack-dashboard/manage.py compress --force" + salt -I 'horizon:server' file.append /etc/openstack-dashboard/local_settings.py \ + "AVAILABLE_THEMES = [ ('default', 'Default', 'themes/default'),]" + salt -I 'horizon:server' service.reload apache2 +fi + +cluster_public_host=$(salt -C 'I@nginx:server and *01*' --out=yaml \ + pillar.get _param:cluster_public_host | awk '{print $2; exit}') +dashboard_host=$(salt -C 'I@nginx:server and *01*' --out=yaml cp.push \ + "/etc/ssl/certs/${cluster_public_host}-with-chain.crt" \ + upload_path='certs/os_cacert' | cut -d':' -f1) +cd /etc/ssl/certs && \ + ln -sf "/var/cache/salt/master/minions/${dashboard_host}/files/certs/os_cacert" # glance v1 api is required by orchestra tests salt -I 'glance:server' ini.set_option /etc/glance/glance-api.conf '{DEFAULT: {enable_v1_api: True}}' diff --git a/mcp/config/states/openstack_noha b/mcp/config/states/openstack_noha index 9fc30bbf1..4c8cbcf8a 100755 --- a/mcp/config/states/openstack_noha +++ b/mcp/config/states/openstack_noha @@ -42,6 +42,7 @@ salt -I 'cinder:controller' state.sls cinder wait_for 3 "salt -I 'cinder:volume' state.sls cinder" salt -I 'neutron:server' state.sls neutron +salt -I 'neutron:compute' state.sls neutron salt -I 'nova:compute' state.sls nova diff --git a/mcp/config/states/ovn_ctl_opts b/mcp/config/states/ovn_ctl_opts deleted file mode 100755 index eeb336b28..000000000 --- a/mcp/config/states/ovn_ctl_opts +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -e -############################################################################## -# Copyright (c) 2017 Mirantis Inc., Enea AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x - -salt -I 'neutron:server' file.append /etc/default/ovn-central \ - args="OVN_CTL_OPTS='--db-nb-create-insecure-remote=yes --db-sb-create-insecure-remote=yes'" -salt -I 'neutron:server' service.restart ovn-central -sleep 30 diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane index 338c4470f..c391cfe6f 100755 --- a/mcp/config/states/virtual_control_plane +++ b/mcp/config/states/virtual_control_plane @@ -33,20 +33,10 @@ salt -C 'kvm* or cmp*' state.apply salt wait_for 10.0 "salt -C 'kvm*' state.sls salt.control" vcp_nodes=$(salt --out yaml 'kvm01*' pillar.get salt:control:cluster:internal:node | \ - awk '/\s+\w+:$/ {gsub(/:$/, "*"); print $1}') + awk '/\s+\w+:$/ {gsub(/:$/, "*"); printf "%s ", $1}') # Check all vcp nodes are available -rc=1 -attempt=0 -total_attempts=50 -while [ $rc -ne 0 ] && [ ${attempt} -lt ${total_attempts} ]; do - rc=0 - for node in $vcp_nodes; do - salt "$node" test.ping 2>/dev/null || { rc=$?; break; }; - done - sleep 5 - ((attempt+=1)) -done +wait_for 25.0 "(for n in ${vcp_nodes}; do salt \${n} test.ping 2>/dev/null || exit; done)" wait_for 10.0 "salt -C '* and not cfg01* and not mas01*' saltutil.sync_all" @@ -58,7 +48,7 @@ cd /srv/salt/env/prd/maas/files && ln -sf \ salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' cp.get_file \ "salt://maas/files/$(basename "${APT_CONF_D_CURTIN}")" "${APT_CONF_D_CURTIN}" -wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply salt" +wait_for 10.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply salt" wait_for 10.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply linux,ntp" wait_for 10.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_USER} \ @@ -67,6 +57,7 @@ wait_for 10.0 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_ # Disable proxy dhcp routes after installation salt -C 'prx*' file.write /etc/dhcp/dhclient-enter-hooks.d/no-default-route \ args='unset new_routers' +salt -C 'prx*' state.apply opnfv.route_wrapper salt -C 'prx*' system.reboot wait_for 30.0 "salt -C 'prx*' test.ping" |