Unhardcode hardware nodes for BM-deployments
Move rebooting these nodes from pre-deploy stage to
salt-installing stage
Remove REBOOT_HW_NODES parameter from BM jenkins jobs
Related-Prod:#MOSSUST-110
Change-Id: Ie79d7e21967b90051b29201939ed0165a35d2f13
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index 1e35c9e..10536c7 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -32,18 +32,6 @@
shared.prepare_working_dir(env_manager)
}
- // Reboot Hardware before the BM deployments
- if ("$ENV_NAME".contains("bm-")){
- reboot_hw_nodes = env.REBOOT_HW_NODES ?: false
- stage("Reboot HW nodes") {
- if (reboot_hw_nodes) {
- shared.reboot_hardware_nodes()
- } else {
- common.printMsg("REBOOT_HW_NODES is disabled. Skipping this stage...", "blue")
- }
- }
- }
-
stage("Create environment, generate model, bootstrap the salt-cluster") {
// steps: "hardware,create_model,salt"
if (env_manager == 'devops') {
diff --git a/jobs/templates/bm-cicd-pike-ovs-maas.yml b/jobs/templates/bm-cicd-pike-ovs-maas.yml
index 6b30a2a..4f4311a 100644
--- a/jobs/templates/bm-cicd-pike-ovs-maas.yml
+++ b/jobs/templates/bm-cicd-pike-ovs-maas.yml
@@ -199,10 +199,6 @@
default: true
description: 'Works starting from MCP 2019.2.10 or master. Whether to apply saltstack updates on all nodes in cluster before deployment'
name: UPGRADE_SALTSTACK
- - bool:
- default: true
- description: Reboot hardware servers and set boot to PXE before the deployment
- name: REBOOT_HW_NODES
pipeline-scm:
lightweight-checkout: false
scm:
diff --git a/jobs/templates/bm-cicd-queens-ovs-maas.yml b/jobs/templates/bm-cicd-queens-ovs-maas.yml
index 95b0343..ad40bdf 100644
--- a/jobs/templates/bm-cicd-queens-ovs-maas.yml
+++ b/jobs/templates/bm-cicd-queens-ovs-maas.yml
@@ -212,10 +212,6 @@
default: false
description: 'Works starting from MCP 2019.2.10 or master. Whether to apply saltstack updates on all nodes in cluster before deployment'
name: UPGRADE_SALTSTACK
- - bool:
- default: true
- description: Reboot hardware servers and set boot to PXE before the deployment
- name: REBOOT_HW_NODES
pipeline-scm:
lightweight-checkout: false
scm:
diff --git a/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml b/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml
index 531b1e9..3d9c175 100644
--- a/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml
+++ b/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml
@@ -225,10 +225,6 @@
default: true
description: 'Works starting from MCP 2019.2.10 or master. Whether to apply saltstack updates on all nodes in cluster before deployment'
name: UPGRADE_SALTSTACK
- - bool:
- default: true
- description: Reboot hardware servers and set boot to PXE before the deployment
- name: REBOOT_HW_NODES
pipeline-scm:
lightweight-checkout: false
scm:
diff --git a/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml b/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml
index 09cd0fb..2c0de61 100644
--- a/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml
+++ b/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml
@@ -226,10 +226,6 @@
default: false
description: 'Works starting from MCP 2019.2.10 or master. Whether to apply saltstack updates on all nodes in cluster before deployment'
name: UPGRADE_SALTSTACK
- - bool:
- default: true
- description: Reboot hardware servers and set boot to PXE before the deployment
- name: REBOOT_HW_NODES
pipeline-scm:
lightweight-checkout: false
scm:
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index c42d43f..72ff052 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -780,33 +780,3 @@
return ret
}
}
-
-def reboot_hardware_nodes() {
- bm_ips = [
- "185.8.59.227",
- "185.8.59.229",
- "5.43.225.88",
- "5.43.225.112",
- "5.43.225.208",
- "5.43.227.118",
- "185.8.58.248",
- "185.8.59.222",
- "5.43.225.228",
- "5.43.229.28",
- "5.43.225.23",
- "185.8.58.9",
- "185.8.58.246",
- "185.8.58.243",
- "185.8.58.244"
- ]
-
- withCredentials([
- [$class : 'UsernamePasswordMultiBinding',
- credentialsId : 'lab_engineer',
- passwordVariable: 'lab_pass',
- usernameVariable: 'lab_user']
- ]) {
- for (ip in bm_ips) { sh ("ipmitool -H ${ip} -U ${lab_user} -P ${lab_pass} chassis power off")}
- for (ip in bm_ips) { sh ("ipmitool -H ${ip} -U ${lab_user} -P ${lab_pass} chassis bootdev pxe")}
- }
-}
\ No newline at end of file
diff --git a/tcp_tests/templates/bm-cicd-pike-ovs-maas/salt.yaml b/tcp_tests/templates/bm-cicd-pike-ovs-maas/salt.yaml
index a31051f..f0b727e 100644
--- a/tcp_tests/templates/bm-cicd-pike-ovs-maas/salt.yaml
+++ b/tcp_tests/templates/bm-cicd-pike-ovs-maas/salt.yaml
@@ -5,6 +5,7 @@
{% import 'shared-salt.yaml' as SHARED with context %}
{% import 'shared-test-tools.yaml' as SHARED_TEST_TOOLS with context %}
{% import 'shared-workarounds.yaml' as SHARED_WORKAROUNDS with context %}
+{% import 'shared-maas.yaml' as SHARED_MAAS with context %}
- description: Wait for salt-master is ready after configdrive user-data
cmd: |
@@ -14,6 +15,24 @@
skip_fail: false
{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
+{{ SHARED_MAAS.REBOOT_HW_NODES('engineer', 'KBwdcRqwed3w2',
+ [
+ "185.8.59.227",
+ "185.8.59.229",
+ "5.43.225.88",
+ "5.43.225.112",
+ "5.43.225.208",
+ "5.43.227.118",
+ "185.8.58.248",
+ "185.8.59.222",
+ "5.43.225.228",
+ "5.43.229.28",
+ "5.43.225.23",
+ "185.8.58.9",
+ "185.8.58.246",
+ "185.8.58.243",
+ "185.8.58.244"
+ ]) }}
{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
diff --git a/tcp_tests/templates/bm-cicd-queens-ovs-maas/salt.yaml b/tcp_tests/templates/bm-cicd-queens-ovs-maas/salt.yaml
index 9fc0dfe..f008071 100644
--- a/tcp_tests/templates/bm-cicd-queens-ovs-maas/salt.yaml
+++ b/tcp_tests/templates/bm-cicd-queens-ovs-maas/salt.yaml
@@ -5,6 +5,7 @@
{% import 'shared-salt.yaml' as SHARED with context %}
{% import 'shared-test-tools.yaml' as SHARED_TEST_TOOLS with context %}
{% import 'shared-workarounds.yaml' as SHARED_WORKAROUNDS with context %}
+{% import 'shared-maas.yaml' as SHARED_MAAS with context %}
- description: Wait for salt-master is ready after configdrive user-data
cmd: |
@@ -14,6 +15,24 @@
skip_fail: false
{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
+{{ SHARED_MAAS.REBOOT_HW_NODES('engineer', 'KBwdcRqwed3w2',
+ [
+ "185.8.59.227",
+ "185.8.59.229",
+ "5.43.225.88",
+ "5.43.225.112",
+ "5.43.225.208",
+ "5.43.227.118",
+ "185.8.58.248",
+ "185.8.59.222",
+ "5.43.225.228",
+ "5.43.229.28",
+ "5.43.225.23",
+ "185.8.58.9",
+ "185.8.58.246",
+ "185.8.58.243",
+ "185.8.58.244"
+ ]) }}
{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
diff --git a/tcp_tests/templates/heat-bm-cicd-pike-contrail-sl/salt.yaml b/tcp_tests/templates/heat-bm-cicd-pike-contrail-sl/salt.yaml
index 46393c3..d069df0 100644
--- a/tcp_tests/templates/heat-bm-cicd-pike-contrail-sl/salt.yaml
+++ b/tcp_tests/templates/heat-bm-cicd-pike-contrail-sl/salt.yaml
@@ -7,6 +7,7 @@
{% import 'shared-salt.yaml' as SHARED with context %}
{% import 'shared-test-tools.yaml' as SHARED_TEST_TOOLS with context %}
{% import 'shared-workarounds.yaml' as SHARED_WORKAROUNDS with context %}
+{% import 'shared-maas.yaml' as SHARED_MAAS with context %}
- description: Wait for salt-master is ready after configdrive user-data
cmd: |
@@ -16,6 +17,24 @@
skip_fail: false
{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
+{{ SHARED_MAAS.REBOOT_HW_NODES('engineer', 'KBwdcRqwed3w2',
+ [
+ "185.8.59.227",
+ "185.8.59.229",
+ "5.43.225.88",
+ "5.43.225.112",
+ "5.43.225.208",
+ "5.43.227.118",
+ "185.8.58.248",
+ "185.8.59.222",
+ "5.43.225.228",
+ "5.43.229.28",
+ "5.43.225.23",
+ "185.8.58.9",
+ "185.8.58.246",
+ "185.8.58.243",
+ "185.8.58.244"
+ ]) }}
{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
diff --git a/tcp_tests/templates/heat-bm-cicd-queens-contrail-sl/salt.yaml b/tcp_tests/templates/heat-bm-cicd-queens-contrail-sl/salt.yaml
index 8dbf61a..06b692c 100644
--- a/tcp_tests/templates/heat-bm-cicd-queens-contrail-sl/salt.yaml
+++ b/tcp_tests/templates/heat-bm-cicd-queens-contrail-sl/salt.yaml
@@ -7,6 +7,7 @@
{% import 'shared-salt.yaml' as SHARED with context %}
{% import 'shared-test-tools.yaml' as SHARED_TEST_TOOLS with context %}
{% import 'shared-workarounds.yaml' as SHARED_WORKAROUNDS with context %}
+{% import 'shared-maas.yaml' as SHARED_MAAS with context %}
- description: Wait for salt-master is ready after configdrive user-data
cmd: |
@@ -16,6 +17,24 @@
skip_fail: false
{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
+{{ SHARED_MAAS.REBOOT_HW_NODES('engineer', 'KBwdcRqwed3w2',
+ [
+ "185.8.59.227",
+ "185.8.59.229",
+ "5.43.225.88",
+ "5.43.225.112",
+ "5.43.225.208",
+ "5.43.227.118",
+ "185.8.58.248",
+ "185.8.59.222",
+ "5.43.225.228",
+ "5.43.229.28",
+ "5.43.225.23",
+ "185.8.58.9",
+ "185.8.58.246",
+ "185.8.58.243",
+ "185.8.58.244"
+ ]) }}
{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
diff --git a/tcp_tests/templates/shared-maas.yaml b/tcp_tests/templates/shared-maas.yaml
index 0becf80..2066f4f 100644
--- a/tcp_tests/templates/shared-maas.yaml
+++ b/tcp_tests/templates/shared-maas.yaml
@@ -1,5 +1,23 @@
{# Collection of common macroses shared across MaaS #}
+
+{%- macro REBOOT_HW_NODES(ipmi_user, ipmi_password, ipmi_devices=['']) %}
+
+- description: Reboot hardware computes and set to PXE boot. It needs for clean deployment
+ cmd: |
+ {%- for device in ipmi_devices %}
+ ipmitool -H {{ device }} -U {{ ipmi_user }} -P {{ ipmi_password }} chassis power off
+ {%- endfor %}
+ {%- for device in ipmi_devices %}
+ ipmitool -H {{ device }} -U {{ ipmi_user }} -P {{ ipmi_password }} chassis bootdev pxe
+ {%- endfor %}
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+
+{%- endmacro %}
+
+
{%- macro AUTH_IN_MAAS() %}
- description: MaaS auth