Be moderate about disk space in the CI
We're close to the limit on some testing nodes, so, while building a CentOS image: 1) Delete files as soon as we no longer need them. 2) Do not copy kernel/ramdisk unnecessary Move the libvirt pool for testing VMs to /opt since some testing nodes have small root partitions. Also move irrelevant vars out of zuul definitions. Change-Id: I2a34b19ee823109899dc21031e663a3ea848a5c5
This commit is contained in:
parent
ca7cf52dd3
commit
777ca793c0
|
@ -96,6 +96,7 @@
|
|||
IRONIC_VM_SPECS_CPU: 2
|
||||
IRONIC_VM_SPECS_DISK: 10
|
||||
IRONIC_VM_SPECS_RAM: 1024
|
||||
LIBVIRT_STORAGE_POOL_PATH: /opt/libvirt/images
|
||||
SWIFT_ENABLE_TEMPURLS: true
|
||||
SWIFT_HASH: 54bd5642300c4b45-846f8636a70a07d2
|
||||
SWIFT_START_ALL_SERVICES: false
|
||||
|
@ -104,12 +105,6 @@
|
|||
centos_glance_kernel_image: test-centos-kernel
|
||||
centos_glance_root_image: test-centos-partition
|
||||
centos_glance_whole_disk_image: test-centos-wholedisk
|
||||
centos_image_file: ~/CentOS-7-x86_64-GenericCloud.qcow2
|
||||
centos_image_name: CentOS-7-x86_64-GenericCloud
|
||||
centos_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz
|
||||
centos_initramfs_file: ~/CentOS-7-x86_64-GenericCloud.initramfs
|
||||
centos_kernel_file: ~/CentOS-7-x86_64-GenericCloud.kernel
|
||||
centos_partition_file: ~/CentOS-7-x86_64-GenericCloud-root.qcow2
|
||||
metalsmith_root_size: 9
|
||||
metalsmith_python: python3
|
||||
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
environment:
|
||||
OS_CLOUD: devstack-admin
|
||||
|
||||
vars:
|
||||
centos_image_file: ~/centos-download.qcow2
|
||||
centos_initramfs_file: ~/centos.initramfs
|
||||
centos_kernel_file: ~/centos.kernel
|
||||
centos_partition_file: ~/centos-root.qcow2
|
||||
centos_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz
|
||||
|
||||
tasks:
|
||||
- name: Install guestfish
|
||||
package:
|
||||
|
@ -29,6 +36,13 @@
|
|||
- name: Print filesystems from the image
|
||||
command: virt-filesystems -a {{ centos_image_file }} -l --extra --block-devices
|
||||
|
||||
- name: Upload the CentOS whole-disk image
|
||||
command: >
|
||||
openstack image create --disk-format qcow2
|
||||
--public --file {{ centos_image_file }}
|
||||
{{ centos_glance_whole_disk_image }}
|
||||
when: centos_glance_whole_disk_image is defined
|
||||
|
||||
- name: Create a temporary directory for extraction
|
||||
tempfile:
|
||||
state: directory
|
||||
|
@ -40,20 +54,40 @@
|
|||
virt-get-kernel -a {{ centos_image_file }}
|
||||
-o {{ temp_dir.path }} --unversioned-names
|
||||
|
||||
- name: Copy the kernel and ramdisk to the target directory
|
||||
copy:
|
||||
src: "{{ temp_dir.path }}/{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
remote_src: yes
|
||||
- name: Upload the CentOS kernel image
|
||||
command: >
|
||||
openstack image create --disk-format aki --container-format aki \
|
||||
--public --file {{ temp_dir.path }}/vmlinuz -f value -c id
|
||||
{{ centos_glance_kernel_image }}
|
||||
register: centos_kernel_id
|
||||
failed_when: centos_kernel_id.stdout == ""
|
||||
when: centos_glance_kernel_image is defined
|
||||
|
||||
- name: Upload the CentOS initramfs image
|
||||
command: >
|
||||
openstack image create --disk-format ari --container-format ari \
|
||||
--public --file {{ temp_dir.path }}/initramfs -f value -c id
|
||||
{{ centos_glance_initramds_image }}
|
||||
register: centos_initramfs_id
|
||||
failed_when: centos_initramfs_id.stdout == ""
|
||||
when: centos_glance_initramds_image is defined
|
||||
|
||||
- name: Delete the kernel and ramdisk image files
|
||||
file:
|
||||
state: absent
|
||||
path: "{{ temp_dir.path }}/{{ item }}"
|
||||
with_items:
|
||||
- src: vmlinuz
|
||||
dest: "{{ centos_kernel_file }}"
|
||||
- src: initramfs
|
||||
dest: "{{ centos_initramfs_file }}"
|
||||
- vmlinuz
|
||||
- initramfs
|
||||
|
||||
- name: Extract the root file system
|
||||
command: virt-tar-out -a {{ centos_image_file }} / {{ temp_dir.path }}/root.tar
|
||||
|
||||
- name: Delete the whole-disk image file
|
||||
file:
|
||||
state: absent
|
||||
path: "{{ centos_image_file }}"
|
||||
|
||||
- name: Extract /etc/fstab and /etc/selinux/config
|
||||
command: >
|
||||
tar -f {{ temp_dir.path }}/root.tar
|
||||
|
@ -96,31 +130,6 @@
|
|||
state: absent
|
||||
path: "{{ temp_dir.path }}"
|
||||
|
||||
- name: Upload the CentOS whole-disk image
|
||||
command: >
|
||||
openstack image create --disk-format qcow2
|
||||
--public --file {{ centos_image_file }}
|
||||
{{ centos_glance_whole_disk_image }}
|
||||
when: centos_glance_whole_disk_image is defined
|
||||
|
||||
- name: Upload the CentOS kernel image
|
||||
command: >
|
||||
openstack image create --disk-format aki --container-format aki \
|
||||
--public --file {{ centos_kernel_file }} -f value -c id
|
||||
{{ centos_glance_kernel_image }}
|
||||
register: centos_kernel_id
|
||||
failed_when: centos_kernel_id.stdout == ""
|
||||
when: centos_glance_kernel_image is defined
|
||||
|
||||
- name: Upload the CentOS initramfs image
|
||||
command: >
|
||||
openstack image create --disk-format ari --container-format ari \
|
||||
--public --file {{ centos_initramfs_file }} -f value -c id
|
||||
{{ centos_glance_initramds_image }}
|
||||
register: centos_initramfs_id
|
||||
failed_when: centos_initramfs_id.stdout == ""
|
||||
when: centos_glance_initramds_image is defined
|
||||
|
||||
- name: Upload the CentOS partition image
|
||||
command: >
|
||||
openstack image create --disk-format qcow2
|
||||
|
@ -129,3 +138,8 @@
|
|||
--property ramdisk_id={{ centos_initramfs_id.stdout }}
|
||||
{{ centos_glance_root_image }}
|
||||
when: centos_glance_root_image is defined
|
||||
|
||||
- name: Remove the partition image file
|
||||
file:
|
||||
state: absent
|
||||
path: "{{ centos_partition_file }}"
|
||||
|
|
Loading…
Reference in New Issue