diff --git a/.zuul.yaml b/.zuul.yaml index f45577b75..abeac35b0 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,10 +1,8 @@ - job: name: packstack-base parent: base - timeout: 3600 - nodeset: centos-7 + timeout: 7200 pre-run: playbooks/packstack-pre.yaml - run: playbooks/packstack-integration-tempest.yaml post-run: playbooks/upload-logs.yaml irrelevant-files: - ^docs/.*$ @@ -36,31 +34,62 @@ - openstack/puppet-vswitch - job: - name: packstack-integration-scenario001-tempest + name: packstack-allinone parent: packstack-base + nodeset: + nodes: + - name: allinone + label: centos-7 + run: playbooks/packstack-integration-tempest.yaml + +- job: + name: packstack-multinode + parent: packstack-base + nodeset: + nodes: + - name: controller + label: centos-7 + - name: compute + label: centos-7 + run: playbooks/packstack-multinode.yaml + +- job: + name: packstack-integration-scenario001-tempest + parent: packstack-allinone vars: scenario: scenario001 - job: name: packstack-integration-scenario002-tempest - parent: packstack-base + parent: packstack-allinone vars: scenario: scenario002 - job: name: packstack-integration-scenario003-tempest - parent: packstack-base + parent: packstack-allinone vars: scenario: scenario003 +# We should have nested post-run jobs, according to +# https://docs.openstack.org/infra/zuul/user/config.html#job +- job: + name: packstack-multinode-scenario002-tempest + parent: packstack-multinode + post-run: playbooks/packstack-post-compute.yaml + vars: + scenario: scenario002 + - project: check: jobs: - packstack-integration-scenario001-tempest - packstack-integration-scenario002-tempest - packstack-integration-scenario003-tempest + - packstack-multinode-scenario002-tempest gate: jobs: - packstack-integration-scenario001-tempest - packstack-integration-scenario002-tempest - packstack-integration-scenario003-tempest + - packstack-multinode-scenario002-tempest diff --git a/playbooks/packstack-multinode.yaml b/playbooks/packstack-multinode.yaml new file mode 100644 index 000000000..821683072 --- /dev/null +++ b/playbooks/packstack-multinode.yaml @@ -0,0 +1,59 @@ +- hosts: compute + name: setup RDO Trunk repositories + vars: + delorean: "https://trunk.rdoproject.org/centos7-master/current-passed-ci/delorean.repo" + delorean_deps: "https://trunk.rdoproject.org/centos7-master/delorean-deps.repo" + tasks: + - name: Fetch DLRN repo + get_url: + url: "{{ delorean }}" + dest: /etc/yum.repos.d/delorean.repo + mode: 0640 + become: true + - name: Fetch DLRN dependency repo + get_url: + url: "{{ delorean_deps }}" + dest: /etc/yum.repos.d/delorean-deps.repo + mode: 0640 + become: true + +- hosts: controller + name: packstack-multinode + tasks: + - name: Generate SSH key on controller + shell: ssh-keygen -t rsa -f /root/.ssh/id_rsa -P "" + args: + creates: /root/.ssh/id_rsa + become: true + + - name: Fetch SSH key + shell: cat /root/.ssh/id_rsa.pub + become: true + register: ssh_key + + - name: Deploy SSH key on compute node + authorized_key: + user: root + state: present + key: "{{ ssh_key.stdout }}" + delegate_to: "{{ hostvars['compute'].ansible_host }}" + become: true + + - name: Deploy SSH key on controller + authorized_key: + user: root + state: present + key: "{{ ssh_key.stdout }}" + become: true + + - name: Run Packstack + shell: + cmd: | + set -e + set -x + export SCENARIO='{{ scenario }}' + export CONTROLLER_NODE="{{ hostvars['controller'].nodepool.public_ipv4 }}" + export COMPUTE_NODE="{{ hostvars['compute'].nodepool.public_ipv4 }}" + ./run_tests.sh + executable: /bin/bash + chdir: '{{ ansible_user_dir }}/workspace/packstack' diff --git a/playbooks/packstack-post-compute.yaml b/playbooks/packstack-post-compute.yaml new file mode 100644 index 000000000..c54f092af --- /dev/null +++ b/playbooks/packstack-post-compute.yaml @@ -0,0 +1,20 @@ +- hosts: compute + name: store compute node logs + tasks: + - file: + path: /tmp/logs + state: directory + mode: 0755 + + - file: + path: /tmp/compute + state: directory + mode: 0755 + + - shell: + cmd: | + source /home/zuul/src/git.openstack.org/openstack/packstack/tools/copy-logs.sh + recover_default_logs + mv /tmp/logs/* /tmp/compute + mv /tmp/compute /tmp/logs + become: true diff --git a/run_tests.sh b/run_tests.sh index a161c24af..ef08a1aa3 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -28,6 +28,10 @@ SELINUX_ENFORCING=${SELINUX_ENFORCING:-true} # If logs should be retrieved automatically COPY_LOGS=${COPY_LOGS:-true} +# Let's add an option for a secondary node, to act as a compute +CONTROLLER_NODE=${CONTROLLER_NODE:-} +COMPUTE_NODE=${COMPUTE_NODE:-} + # Install external Puppet modules with r10k # Uses the following variables: # diff --git a/tests/scenario001.sh b/tests/scenario001.sh index 4c165b3e8..937d2aca4 100755 --- a/tests/scenario001.sh +++ b/tests/scenario001.sh @@ -1,4 +1,7 @@ #!/bin/bash +CONTROLLER_NODE=${CONTROLLER_NODE:-} +COMPUTE_NODE=${COMPUTE_NODE:-} + if [ $(id -u) != 0 ]; then SUDO='sudo' fi @@ -14,8 +17,14 @@ echo -e "Generating packstack config for: echo "tempest will run if packstack's installation completes successfully." echo +if [ -z $COMPUTE_NODE ]; then + NODE_FLAGS="--allinone" +else + NODE_FLAGS="--allinone --os-controller-host=$CONTROLLER_NODE --os-network-hosts=$CONTROLLER_NODE --os-compute-hosts=$COMPUTE_NODE" +fi + $SUDO packstack ${ADDITIONAL_ARGS} \ - --allinone \ + ${NODE_FLAGS} \ --cinder-volume-name="aVolume" \ --debug \ --service-workers=2 \ diff --git a/tests/scenario002.sh b/tests/scenario002.sh index 4f3cb3294..48ccc67c7 100755 --- a/tests/scenario002.sh +++ b/tests/scenario002.sh @@ -1,4 +1,7 @@ #!/bin/bash +CONTROLLER_NODE=${CONTROLLER_NODE:-} +COMPUTE_NODE=${COMPUTE_NODE:-} + if [ $(id -u) != 0 ]; then SUDO='sudo' fi @@ -16,9 +19,16 @@ echo -e "Generating packstack config for: echo "tempest will run if packstack's installation completes successfully." echo +if [ -z $COMPUTE_NODE ]; then + NODE_FLAGS="--allinone" +else + NODE_FLAGS="--allinone --os-controller-host=$CONTROLLER_NODE --os-network-hosts=$CONTROLLER_NODE --os-compute-hosts=$COMPUTE_NODE" +fi + $SUDO packstack ${ADDITIONAL_ARGS} \ - --allinone \ + ${NODE_FLAGS} \ --debug \ + --os-debug-mode=y \ --service-workers=2 \ --default-password="packstack" \ --os-aodh-install=n \ diff --git a/tests/scenario003.sh b/tests/scenario003.sh index 1754751e1..512ecf894 100755 --- a/tests/scenario003.sh +++ b/tests/scenario003.sh @@ -1,4 +1,7 @@ #!/bin/bash +CONTROLLER_NODE=${CONTROLLER_NODE:-} +COMPUTE_NODE=${COMPUTE_NODE:-} + if [ $(id -u) != 0 ]; then SUDO='sudo' fi @@ -18,9 +21,16 @@ echo -e "Generating packstack config for: echo "tempest will run if packstack's installation completes successfully." echo +if [ -z $COMPUTE_NODE ]; then + NODE_FLAGS="--allinone" +else + NODE_FLAGS="--allinone --os-controller-host=$CONTROLLER_NODE --os-network-hosts=$CONTROLLER_NODE --os-compute-hosts=$COMPUTE_NODE" +fi + $SUDO packstack ${ADDITIONAL_ARGS} \ - --allinone \ + ${NODE_FLAGS} \ --debug \ + --os-debug-mode=y \ --service-workers=2 \ --default-password="packstack" \ --os-swift-install=n \