Reduce libvirt node names lenght for cookiecutter-context-k8s-sl
Don't add domain name to the libvirt node names, to fit into
path lenght for the qemu monitor socket (108 chars including zero)
Change-Id: I13ab5f7398debbb5984c3eb8f42df28049a60944
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
index 024bd83..135f9d5 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
@@ -71,8 +71,10 @@
stage("Upload generated config drive ISO into volume on cfg01 node") {
shared.run_cmd("""\
- virsh vol-upload ${ENV_NAME}_cfg01.${LAB_CONFIG_NAME}.local_config /home/jenkins/images/${CFG01_CONFIG_IMAGE_NAME} --pool default
- virsh pool-refresh --pool default
+ # Get SALT_MASTER_HOSTNAME to determine the volume name
+ . ./tcp_tests/utils/env_salt
+ virsh vol-upload ${ENV_NAME}_\${SALT_MASTER_HOSTNAME}_config /home/jenkins/images/${CFG01_CONFIG_IMAGE_NAME} --pool default
+ virsh pool-refresh --pool default
""")
}
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml
index be12324..c249522 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml
@@ -3,29 +3,29 @@
{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME', 'cookied-cicd-k8s-calico-sl') %}
{% set DOMAIN_NAME = os_env('DOMAIN_NAME', LAB_CONFIG_NAME + '.local') %}
-{% set HOSTNAME_CFG01 = os_env('HOSTNAME_CFG01', 'cfg01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CID01 = os_env('HOSTNAME_CID01', 'cid01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CID02 = os_env('HOSTNAME_CID02', 'cid02.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CID03 = os_env('HOSTNAME_CID03', 'cid03.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CFG01 = os_env('HOSTNAME_CFG01', 'cfg01') %}
+{% set HOSTNAME_CID01 = os_env('HOSTNAME_CID01', 'cid01') %}
+{% set HOSTNAME_CID02 = os_env('HOSTNAME_CID02', 'cid02') %}
+{% set HOSTNAME_CID03 = os_env('HOSTNAME_CID03', 'cid03') %}
-{% set HOSTNAME_CTL01 = os_env('HOSTNAME_CTL01', 'ctl01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CTL02 = os_env('HOSTNAME_CTL02', 'ctl02.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CTL03 = os_env('HOSTNAME_CTL03', 'ctl03.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CMP01 = os_env('HOSTNAME_CMP01', 'cmp001.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CMP02 = os_env('HOSTNAME_CMP02', 'cmp002.' + DOMAIN_NAME) %}
-{% set HOSTNAME_LOG01 = os_env('HOSTNAME_LOG01', 'log01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_LOG02 = os_env('HOSTNAME_LOG02', 'log02.' + DOMAIN_NAME) %}
-{% set HOSTNAME_LOG03 = os_env('HOSTNAME_LOG03', 'log03.' + DOMAIN_NAME) %}
-{% set HOSTNAME_MTR01 = os_env('HOSTNAME_MTR01', 'mtr01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_MTR02 = os_env('HOSTNAME_MTR02', 'mtr02.' + DOMAIN_NAME) %}
-{% set HOSTNAME_MTR03 = os_env('HOSTNAME_MTR03', 'mtr03.' + DOMAIN_NAME) %}
-{% set HOSTNAME_MON01 = os_env('HOSTNAME_MON01', 'mon01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_MON02 = os_env('HOSTNAME_MON02', 'mon02.' + DOMAIN_NAME) %}
-{% set HOSTNAME_MON03 = os_env('HOSTNAME_MON03', 'mon03.' + DOMAIN_NAME) %}
-{% set HOSTNAME_PRX01 = os_env('HOSTNAME_PRX01', 'prx01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_KVM01 = os_env('HOSTNAME_KVM01', 'kvm01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_KVM02 = os_env('HOSTNAME_KVM02', 'kvm02.' + DOMAIN_NAME) %}
-{% set HOSTNAME_KVM03 = os_env('HOSTNAME_KVM03', 'kvm03.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CTL01 = os_env('HOSTNAME_CTL01', 'ctl01') %}
+{% set HOSTNAME_CTL02 = os_env('HOSTNAME_CTL02', 'ctl02') %}
+{% set HOSTNAME_CTL03 = os_env('HOSTNAME_CTL03', 'ctl03') %}
+{% set HOSTNAME_CMP01 = os_env('HOSTNAME_CMP01', 'cmp001') %}
+{% set HOSTNAME_CMP02 = os_env('HOSTNAME_CMP02', 'cmp002') %}
+{% set HOSTNAME_LOG01 = os_env('HOSTNAME_LOG01', 'log01') %}
+{% set HOSTNAME_LOG02 = os_env('HOSTNAME_LOG02', 'log02') %}
+{% set HOSTNAME_LOG03 = os_env('HOSTNAME_LOG03', 'log03') %}
+{% set HOSTNAME_MTR01 = os_env('HOSTNAME_MTR01', 'mtr01') %}
+{% set HOSTNAME_MTR02 = os_env('HOSTNAME_MTR02', 'mtr02') %}
+{% set HOSTNAME_MTR03 = os_env('HOSTNAME_MTR03', 'mtr03') %}
+{% set HOSTNAME_MON01 = os_env('HOSTNAME_MON01', 'mon01') %}
+{% set HOSTNAME_MON02 = os_env('HOSTNAME_MON02', 'mon02') %}
+{% set HOSTNAME_MON03 = os_env('HOSTNAME_MON03', 'mon03') %}
+{% set HOSTNAME_PRX01 = os_env('HOSTNAME_PRX01', 'prx01') %}
+{% set HOSTNAME_KVM01 = os_env('HOSTNAME_KVM01', 'kvm01') %}
+{% set HOSTNAME_KVM02 = os_env('HOSTNAME_KVM02', 'kvm02') %}
+{% set HOSTNAME_KVM03 = os_env('HOSTNAME_KVM03', 'kvm03') %}
{% import 'cookied-cicd-k8s-calico-sl/underlay--meta-data.yaml' as CLOUDINIT_META_DATA with context %}
{% import 'cookied-cicd-k8s-calico-sl/underlay--user-data-cfg01.yaml' as CLOUDINIT_USER_DATA_CFG01 with context %}
diff --git a/tcp_tests/utils/env_salt b/tcp_tests/utils/env_salt
index 12c4575..4e21f85 100755
--- a/tcp_tests/utils/env_salt
+++ b/tcp_tests/utils/env_salt
@@ -10,7 +10,9 @@
CURRENT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
export PYTHONPATH=${CURRENT_DIR}/../..
-export SALT_MASTER_IP=${SALT_MASTER_IP:-$(for node in $(dos.py slave-ip-list --address-pool-name admin-pool01 ${ENV_NAME}); do echo $node|grep cfg01|cut -d',' -f2; done)}
+export SALT_MASTER_INFO=$(for node in $(dos.py slave-ip-list --address-pool-name admin-pool01 ${ENV_NAME}); do echo $node|grep cfg01; done)
+export SALT_MASTER_HOSTNAME=${SALT_MASTER_HOSTNAME:-$(echo $SALT_MASTER_INFO|cut -d',' -f1)}
+export SALT_MASTER_IP=${SALT_MASTER_IP:-$(echo $SALT_MASTER_INFO|cut -d',' -f2)}
if [ -z "$SALT_MASTER_IP" ]; then
echo "SALT_MASTER_IP not found in the environment '${ENV_NAME}'"