Files
openstack-ansible-os_nova/tests/test-nova-functional.yml
Jimmy McCrory aec9d14696 Perform online data migrations
Flavors are being moved to the API database for CellsV2. Add a task to
perform online data migrations as required for both the initial
migration of flavors to the Nova API database in a new Newton deployment
and for all required migrations when upgrading from Mitaka.

Also include the creation and use of a new flavor in this role's
functional testing.

Change-Id: I6b562476a6db8fdbaba81f5872734e5efdb522e1
2016-04-03 23:28:12 -07:00

119 lines
4.0 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Playbook for functional testing of nova
hosts: nova_api_os_compute
user: root
gather_facts: false
tasks:
- name: Check the nova-api-os-compute service
uri:
url: "http://localhost:8774"
status_code: 200
register: nova_api_os_compute_status
until: nova_api_os_compute_status | success
retries: 5
delay: 5
- name: Check the nova-api-metadata service
uri:
url: "http://localhost:8775"
status_code: 200
register: nova_api_metadata_status
until: nova_api_metadata_status | success
retries: 5
delay: 5
- name: Check the nova-spicehtml5proxy service
uri:
url: "http://localhost:6082/spice_auto.html"
status_code: 200
register: nova_spice_status
until: nova_spice_status | success
retries: 5
delay: 5
- name: Install testing pip packages
pip:
name: "{{ item }}"
with_items:
- python-glanceclient
- python-neutronclient
- name: Set glance_image_name fact
set_fact:
glance_image_name: "functional-image-{{ 100|random }}"
- name: Set nova_instance_name fact
set_fact:
nova_instance_name: "functional-instance-{{ 100|random }}"
- name: Set neutron_net_name fact
set_fact:
neutron_net_name: "functional-net-{{ 100|random }}"
- name: Set neutron_subnet_name fact
set_fact:
neutron_subnet_name: "functional-subnet-{{ 100|random }}"
- name: Set nova_flavor_name fact
set_fact:
nova_flavor_name: "functional-flavor-{{ 100|random }}"
- name: Upload the Cirros image
glance:
command: 'image-create'
openrc_path: /root/openrc
image_name: "{{ glance_image_name }}"
image_url: "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz"
image_container_format: bare
image_disk_format: qcow2
image_is_public: True
register: cirros_image_create
until: cirros_image_create | success
retries: 5
delay: 15
# NOTE: We need to ensure the image goes active before we attempt to boot
# from it below
- name: Verify image goes active
shell: |
. /root/openrc
{{ nova_venv_bin }}/glance image-show {{ glance_images[glance_image_name]['id'] }} | grep active
register: image_status
until: image_status|success
retries: 5
delay: 5
- name: Create test network
neutron:
command: create_network
openrc_path: /root/openrc
net_name: "{{ neutron_net_name }}"
- name: Create test subnet
neutron:
command: create_subnet
openrc_path: /root/openrc
net_name: "{{ neutron_net_name }}"
subnet_name: "{{ neutron_subnet_name }}"
cidr: "192.168.74.0/24"
- name: Create test flavor
shell: |
. /root/openrc
{{ nova_venv_bin }}/nova flavor-create {{ nova_flavor_name }} 101 256 1 1
- name: Create nova instance
shell: |
. /root/openrc
{{ nova_venv_bin }}/nova boot --image {{ glance_image_name }} --flavor 101 --nic net-id={{ neutron_networks[neutron_net_name]['id'] }} {{ nova_instance_name }}
- name: Verify nova instance goes active
shell: |
. /root/openrc
{{ nova_venv_bin }}/nova show {{ nova_instance_name }} | grep ACTIVE
register: instance_status
until: instance_status|success
retries: 5
delay: 5
vars_files:
- test-vars.yml