Initial change to support heat-based environments
Moved the patch from the mcp/mcp-qa repo, ref #1170 to
not lose it after cleaning up.
1.Added envmanager_heat.py to create environment in OpenStack
and use the created heat stack as the metadata source.
Current conventions for heat stack metadata:
- OS::Nova::Server must use 'metadata' property to specify list
of the node roles, example:
cfg01_node:
type: OS::Nova::Server
...
properties:
...
metadata:
roles:
- salt_master
- OS::Neutron::Subnet must use 'tags' property to specify the
address pool name (L3 network roles), example:
control_subnet:
type: OS::Neutron::Subnet
properties:
...
tags:
- private_pool01
2. Change underlay.yaml to use the user data file 'as is', without
indents and jinja blocks. This will allow to use the same
user data file for fuel-devops envs and heat stack envs.
3. Add an example microcloud-8116.env file with some defaults.
For other stacks, another .env files can be created, with different
access keys, networks, images, ...
Related-Bug: PROD-27687
Change-Id: Iaa9e97447bd1b41e5930a1ffbb7312945ba139f4
diff --git a/tcp_tests/templates/_heat_environments/microcloud-8116-cookied-cicd-queens-dvr-sl.sh b/tcp_tests/templates/_heat_environments/microcloud-8116-cookied-cicd-queens-dvr-sl.sh
new file mode 100755
index 0000000..ed0e190
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/microcloud-8116-cookied-cicd-queens-dvr-sl.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+
+#. /root/keystonercv3
+
+#heat -v --debug stack-create teststack \
+# --template-file ../cookied-cicd-queens-dvr-sl/underlay.hot \
+# --environment-file microcloud-8116.env \
+# --parameters keypair=baremetal
+
+set -ex
+
+cd $(pwd)/../../../
+export PYTHONIOENCODING=UTF-8
+export PYTHONPATH=$(pwd)
+
+export IMAGE_PATH1604=/home/jenkins/images/ubuntu-16-04-x64-mcp2019.2.0.qcow2
+export IMAGE_PATH_CFG01_DAY01=/home/jenkins/images/cfg01-day01.qcow2
+export REPOSITORY_SUITE=2019.2.0
+
+export MANAGER=heat
+
+export ENV_NAME=test_env_queens
+export LAB_CONFIG_NAME=cookied-cicd-queens-dvr-sl
+
+export OS_AUTH_URL=https://10.90.0.80:5000/v3
+export OS_USERNAME=admin
+export OS_PASSWORD=sacLMXAucxABoxT3sskVRHMbKuwa1ZIv
+export OS_PROJECT_NAME=admin
+
+#export TEST_GROUP=test_create_environment
+export TEST_GROUP=test_bootstrap_salt
+py.test -vvv -s -p no:django -p no:ipdb --junit-xml=deploy_hardware.xml -k ${TEST_GROUP}
+#dos.py start test-lab-for-ironic
diff --git a/tcp_tests/templates/_heat_environments/microcloud-8116.env b/tcp_tests/templates/_heat_environments/microcloud-8116.env
new file mode 100644
index 0000000..a4cd821
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/microcloud-8116.env
@@ -0,0 +1,18 @@
+---
+
+parameter_defaults:
+ flavor_medium: baremetal
+ image_ubuntu_cloud_xenial: ironic_provision_image
+ #keypair: system-ci-keypair
+ keypair: baremetal
+
+ net_public: public
+
+ # ironic-specific parameters
+ management_physical_network: ironicnet1
+ management_subnet_cidr: 10.13.0.0/24
+ management_subnet_pool_start: 10.13.0.20
+ management_subnet_pool_end: 10.13.0.60
+ management_subnet_gateway_ip: 10.13.0.1
+ dns_nameservers: 172.18.208.44
+...
diff --git a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay--user-data1604-swp.yaml b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay--user-data1604-swp.yaml
index 81936a4..006a798 100644
--- a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay--user-data1604-swp.yaml
+++ b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay--user-data1604-swp.yaml
@@ -1,84 +1,79 @@
-| # All the data below will be stored as a string object
- #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
+#cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
- ssh_pwauth: True
- users:
- - name: root
- sudo: ALL=(ALL) NOPASSWD:ALL
- shell: /bin/bash
- ssh_authorized_keys:
- {% for key in config.underlay.ssh_keys %}
- - ssh-rsa {{ key['public'] }}
- {% endfor %}
+ssh_pwauth: True
+users:
+ - name: root
+ sudo: ALL=(ALL) NOPASSWD:ALL
+ shell: /bin/bash
- disable_root: false
- chpasswd:
- list: |
+disable_root: false
+chpasswd:
+ list: |
root:r00tme
- expire: False
+ expire: False
- bootcmd:
- # Enable root access
- - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
- - service sshd restart
- output:
- all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
+bootcmd:
+ # Enable root access
+ - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
+ - service sshd restart
+output:
+ all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
- runcmd:
- - if lvs vg0; then pvresize /dev/vda3; fi
- - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
+runcmd:
+ - if lvs vg0; then pvresize /dev/vda3; fi
+ - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
- - export TERM=linux
- - export LANG=C
- # Configure dhclient
- - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
- - sudo resolvconf -u
+ - export TERM=linux
+ - export LANG=C
+ # Configure dhclient
+ - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
+ - sudo resolvconf -u
- # Enable grub menu using updated config below
- - update-grub
+ # Enable grub menu using updated config below
+ - update-grub
- # Prepare network connection
- - sudo ifup ens3
- #- sudo route add default gw {gateway} {interface_name}
+ # Prepare network connection
+ - sudo ifup ens3
+ #- sudo route add default gw {gateway} {interface_name}
- # Create swap
- - fallocate -l 16G /swapfile
- - chmod 600 /swapfile
- - mkswap /swapfile
- - swapon /swapfile
- - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
+ # Create swap
+ - fallocate -l 16G /swapfile
+ - chmod 600 /swapfile
+ - mkswap /swapfile
+ - swapon /swapfile
+ - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
- write_files:
- - path: /etc/default/grub.d/97-enable-grub-menu.cfg
- content: |
- GRUB_RECORDFAIL_TIMEOUT=30
- GRUB_TIMEOUT=3
- GRUB_TIMEOUT_STYLE=menu
+write_files:
+ - path: /etc/default/grub.d/97-enable-grub-menu.cfg
+ content: |
+ GRUB_RECORDFAIL_TIMEOUT=30
+ GRUB_TIMEOUT=3
+ GRUB_TIMEOUT_STYLE=menu
- - path: /etc/network/interfaces
- content: |
- auto ens3
- iface ens3 inet dhcp
+ - path: /etc/network/interfaces
+ content: |
+ auto ens3
+ iface ens3 inet dhcp
- - path: /usr/share/growlvm/image-layout.yml
- content: |
- root:
- size: '30%VG'
- home:
- size: '1G'
- var_log:
- size: '11%VG'
- var_log_audit:
- size: '5G'
- var_tmp:
- size: '11%VG'
- tmp:
- size: '5G'
- owner: root:root
+ - path: /usr/share/growlvm/image-layout.yml
+ content: |
+ root:
+ size: '30%VG'
+ home:
+ size: '1G'
+ var_log:
+ size: '11%VG'
+ var_log_audit:
+ size: '5G'
+ var_tmp:
+ size: '11%VG'
+ tmp:
+ size: '5G'
+ owner: root:root
- growpart:
- mode: auto
- devices:
- - '/'
- - '/dev/vda3'
- ignore_growroot_disabled: false
+growpart:
+ mode: auto
+ devices:
+ - '/'
+ - '/dev/vda3'
+ ignore_growroot_disabled: false
diff --git a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay.yaml b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay.yaml
index c529421..8f17648 100644
--- a/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay.yaml
+++ b/tcp_tests/templates/cookied-cicd-queens-dvr-sl/underlay.yaml
@@ -3,12 +3,14 @@
{% import 'cookied-cicd-queens-dvr-sl/underlay--meta-data.yaml' as CLOUDINIT_META_DATA with context %}
{% import 'cookied-cicd-queens-dvr-sl/underlay--user-data1604-swp.yaml' as CLOUDINIT_USER_DATA_1604_SWP with context %}
+{%- macro user_data() %}{{ CLOUDINIT_USER_DATA_1604_SWP }}{% endmacro %}
---
aliases:
- &interface_model {{ os_env('INTERFACE_MODEL', 'virtio') }}
- &cloudinit_meta_data {{ CLOUDINIT_META_DATA }}
- - &cloudinit_user_data_1604_swp {{ CLOUDINIT_USER_DATA_1604_SWP }}
+ - &cloudinit_user_data_1604_swp |
+{{ user_data()|indent(4, first=True) }}
{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME', 'cookied-cicd-queens-dvr-sl') %}
{% set DOMAIN_NAME = os_env('DOMAIN_NAME', LAB_CONFIG_NAME) + '.local' %}