Option to upload Octavia amphora img in RAW format
When deploying an overcloud with Octavia, the amphora image is uploaded
to Glance as QCOW2. When using the RBD backend for Glance and Nova, this
causes the image to be converted to RAW on each deployment. With slower
storage, this leads to load balancer creation to fail with a compute
timeout exception from Octavia.
This patch adds an option to allow amphora image to be automatically
uploaded to Glance in raw format.
Partial-Bug: #1778303
Change-Id: I698ed96881756bb547f5338b147b0c795103acb5
(cherry picked from commit 73631a23ee
)
This commit is contained in:
parent
2a41553e36
commit
a95b5c5b1d
|
@ -6,6 +6,7 @@
|
|||
amp_ssh_key_name: "{{ amp_ssh_key_name }}"
|
||||
amp_ssh_key_path: "{{ amp_ssh_key_path }}"
|
||||
amp_ssh_key_data: "{{ amp_ssh_key_data }}"
|
||||
amp_to_raw: "{{ amp_to_raw | bool }}"
|
||||
auth_username: "{{ auth_username }}"
|
||||
auth_pasword: "{{ auth_password }}"
|
||||
auth_project_name: "{{ auth_project_name }}"
|
||||
|
|
|
@ -4,6 +4,7 @@ amp_image_filename: ""
|
|||
amp_image_tag: "amphora-image"
|
||||
amp_ssh_key_name: "octavia-ssh-key"
|
||||
amp_ssh_key_path: ""
|
||||
amp_to_raw: False
|
||||
auth_username: "octavia"
|
||||
auth_project_name: "service"
|
||||
lb_mgmt_net_name: "lb-mgmt-net"
|
||||
|
|
|
@ -48,10 +48,37 @@
|
|||
upload_image: true
|
||||
when: current_md5 is not defined or replace_image
|
||||
|
||||
- block:
|
||||
- name: create temporary directory
|
||||
tempfile:
|
||||
state: directory
|
||||
register: amp_tmp_dir
|
||||
|
||||
- name: set RAW file name
|
||||
set_fact:
|
||||
raw_filename: "{{ amp_tmp_dir.path }}/{{ image_filename|splitext|first|basename }}.img"
|
||||
|
||||
- name: convert image from qcow2 to raw
|
||||
shell: |
|
||||
qemu-img convert -f qcow2 -O raw {{ image_filename }} {{ raw_filename }}
|
||||
|
||||
- name: setting amphora format to raw
|
||||
set_fact:
|
||||
raw_format: raw
|
||||
when: amp_to_raw
|
||||
|
||||
- name: upload image to glance
|
||||
shell: |
|
||||
openstack image create --disk-format qcow2 --container-format bare --tag {{ amp_image_tag }} \
|
||||
--file {{ image_filename }} {{ amphora_image }}
|
||||
openstack image create --disk-format {{ raw_format|default('qcow2') }} \
|
||||
--container-format bare --tag {{ amp_image_tag }} \
|
||||
--file {{ raw_filename|default(image_filename) }} \
|
||||
{{ amphora_image }}
|
||||
register: image_result
|
||||
changed_when: "image_result.stdout != ''"
|
||||
when: image_file_result.stat.exists and upload_image is defined
|
||||
|
||||
- name: delete converted raw image
|
||||
file:
|
||||
path: "{{ amp_tmp_dir.path }}"
|
||||
state: absent
|
||||
when: amp_to_raw
|
||||
|
|
|
@ -14,6 +14,7 @@ workflows:
|
|||
- amp_ssh_key_name
|
||||
- amp_ssh_key_path
|
||||
- amp_ssh_key_data
|
||||
- amp_to_raw
|
||||
- auth_username
|
||||
- auth_password
|
||||
- auth_project_name
|
||||
|
@ -103,6 +104,7 @@ workflows:
|
|||
amp_ssh_key_name: <% $.amp_ssh_key_name %>
|
||||
amp_ssh_key_path: <% $.amp_ssh_key_path %>
|
||||
amp_ssh_key_data: <% $.amp_ssh_key_data %>
|
||||
amp_to_raw: <% $.amp_to_raw %>
|
||||
auth_username: <% $.auth_username %>
|
||||
auth_password: <% $.auth_password %>
|
||||
auth_project_name: <% $.auth_project_name %>
|
||||
|
|
Loading…
Reference in New Issue