Use upstream openstack image module

Replace the use of OSA's glance library with the upstream Ansible
os_image module. This should be much more reliable for larger images,
such as magnum's. Include the in-role task in testing and remove the
additional testing tasks that were performing the image upload outside
of the role.

Related-Bug: 1538642
Change-Id: I017303e9a731ebc60315ea1784ba184a8294b08e
This commit is contained in:
Jimmy McCrory 2016-11-10 11:47:45 -08:00
parent 72e6840c70
commit 2e096ecd54
4 changed files with 31 additions and 34 deletions

View File

@ -92,12 +92,14 @@ magnum_glance_images: []
# public: true #Boolean - is the image public
# file: https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2
# distro: fedora-atomic #Value for the os_distro metadata
# checksum: "sha1:dab00359cfa5cd393f0a6044f77c4a78c6167a47"
magnum_requires_pip_packages:
- httplib2
- python-glanceclient
- python-keystoneclient
- pyyaml
- shade
- virtualenv
- virtualenv-tools

View File

@ -36,17 +36,25 @@
config_overrides: "{{ magnum_api_paste_ini_overrides }}"
config_type: "ini"
- name: Upload images to Glance
glance:
command: 'image-create'
image_name: "{{ item.name }}"
image_disk_format: "{{ item.disk_format }}"
image_container_format: "{{ item.image_format }}"
image_is_public: "{{ item.public }}"
image_url: "{{ item.file }}"
image_properties:
os_distro: "{{ item.distro }}"
insecure: "{{ keystone_service_internaluri_insecure }}"
openrc_path: /root/openrc
- name: Download magnum images
get_url:
url: "{{ item.file }}"
dest: "/var/tmp/{{ item.file | basename }}"
checksum: "{{ item.checksum | default(omit) }}"
with_items: "{{ magnum_glance_images }}"
when: inventory_hostname == groups['magnum_all'][0]
- name: Upload images to Glance
os_image:
cloud: default
endpoint_type: internal
validate_certs: "{{ keystone_service_internaluri_insecure | ternary(false, true) }}"
name: "{{ item.name }}"
disk_format: "{{ item.disk_format }}"
container_format: "{{ item.image_format }}"
is_public: "{{ item.public }}"
filename: "/var/tmp/{{ item.file | basename }}"
properties:
os_distro: "{{ item.distro }}"
with_items: "{{ magnum_glance_images }}"
when: inventory_hostname == groups['magnum_all'][0]

View File

@ -18,6 +18,15 @@ magnum_config_overrides:
certificates:
cert_manager_type: x509keypair
magnum_glance_images:
- name: fedora-atomic-latest
disk_format: qcow2
image_format: bare
public: true
file: https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2
distro: fedora-atomic
checksum: "sha1:dab00359cfa5cd393f0a6044f77c4a78c6167a47"
heat_venv_tag: "testing"
heat_developer_mode: true
heat_git_install_branch: master

View File

@ -17,28 +17,6 @@
hosts: magnum_all
user: root
gather_facts: false
pre_tasks:
- name: Install testing pip packages
pip:
name: "python-openstackclient"
# using the glance library with a large image sometimes results in an incomplete image
# this should be more reliable
- name: Download magnum fedora-atomic-latest image
get_url:
url: "https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2"
dest: "/var/tmp/fedora-atomic-latest.qcow2"
register: image_download
- name: Upload magnum fedora-atomic-latest image to glance
shell: |
. /root/openrc
openstack image create \
--disk-format=qcow2 \
--container-format=bare \
--file=/var/tmp/fedora-atomic-latest.qcow2 \
--property os_distro='fedora-atomic' \
--public \
fedora-atomic-latest
when: image_download | changed
tasks:
- name: Run tempest
shell: |