MNAIO: Compress the disk image when saving it
When we save the VM disks, we now use compression to prepare the base disk so that it reduces the base disk file sizes to a much smaller base. For the infra hosts this reduces the file from ~23GB to ~8GB. Once this is done, we then also create a copy-on-write image in the original disk's place so that the VM can be booted up to verify functionality or continue work without having to re-run the 'deploy-vms' playbook. Change-Id: If95b71d8625b4d5b2a036cec13952e4fd73cecd4
This commit is contained in:
parent
42189e272f
commit
c72cc198c4
@ -46,13 +46,14 @@
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
- name: Save VM Disk Image
|
||||
- name: Commit, compress and save VM Disk Image and prepare new copy-on-write image
|
||||
shell: |
|
||||
if [[ -e {{ hostvars[item]['server_hostname'] }}.img ]]; then
|
||||
if [[ -e {{ hostvars[item]['server_hostname'] }}-base.img ]]; then
|
||||
qemu-img commit {{ hostvars[item]['server_hostname'] }}.img
|
||||
else
|
||||
mv {{ hostvars[item]['server_hostname'] }}.img {{ hostvars[item]['server_hostname'] }}-base.img
|
||||
qemu-img convert -O qcow2 -c {{ hostvars[item]['server_hostname'] }}.img {{ hostvars[item]['server_hostname'] }}-base.img
|
||||
qemu-img create -f qcow2 -b {{ hostvars[item]['server_hostname'] }}-base.img {{ hostvars[item]['server_hostname'] }}.img
|
||||
fi
|
||||
exit 2
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user