mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Merge pull request #461 from CMeza99/compress_qcow-no
Ability to create non-compressed QCOW
This commit is contained in:
commit
3f58a35d95
4 changed files with 54 additions and 3 deletions
|
@ -16,6 +16,8 @@ def get_shrink_type(plugins):
|
|||
shrink_type = 'vmware-vdiskmanager'
|
||||
elif shrink_type is False:
|
||||
shrink_type = None
|
||||
elif shrink_type == 'qemu-img-no-compression':
|
||||
shrink_type = 'qemu-img'
|
||||
return shrink_type
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ properties:
|
|||
shrink:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- enum: [vmware-vdiskmanager, qemu-img]
|
||||
- enum: [vmware-vdiskmanager, qemu-img, qemu-img-no-compression]
|
||||
zerofree:
|
||||
type: boolean
|
||||
apt:
|
||||
|
|
|
@ -71,8 +71,9 @@ class ShrinkVolumeWithQemuImg(Task):
|
|||
def run(cls, info):
|
||||
tmp_name = os.path.join(info.workspace, 'shrunk.' + info.volume.extension)
|
||||
shrink_cmd = ['qemu-img', 'convert', '-O', info.volume.extension, info.volume.image_path, tmp_name]
|
||||
# Compress QCOW2 image when shrinking
|
||||
if info.volume.extension == 'qcow2':
|
||||
# Compress QCOW2 image when shrinking except when explicitly set not to
|
||||
if (info.volume.extension == 'qcow2' and
|
||||
info.manifest.plugins['minimize_size']['shrink'] != 'qemu-img-no-compression'):
|
||||
# '-c' indicates that target image must be compressed (qcow format only)
|
||||
shrink_cmd.insert(4, '-c')
|
||||
log_check_call(shrink_cmd)
|
||||
|
|
48
manifests/examples/kvm/stretch-cloudimg.yml
Normal file
48
manifests/examples/kvm/stretch-cloudimg.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
name: debian-{system.release}-{system.architecture}-{%Y}{%m}{%d}
|
||||
provider:
|
||||
name: kvm
|
||||
virtio:
|
||||
- virtio
|
||||
- virtio_pci
|
||||
- virtio_balloon
|
||||
- virtio_blk
|
||||
- virtio_net
|
||||
- virtio_ring
|
||||
console: virtual
|
||||
bootstrapper:
|
||||
workspace: /target
|
||||
system:
|
||||
release: stretch
|
||||
architecture: amd64
|
||||
bootloader: grub
|
||||
charmap: UTF-8
|
||||
locale: en_US
|
||||
timezone: UTC
|
||||
packages:
|
||||
components:
|
||||
- main
|
||||
- contrib
|
||||
- non-free
|
||||
install_standard: true
|
||||
install:
|
||||
- task-ssh-server
|
||||
- cloud-init
|
||||
- cloud-utils
|
||||
volume:
|
||||
backing: qcow2
|
||||
partitions:
|
||||
type: msdos
|
||||
root:
|
||||
filesystem: ext4
|
||||
size: 2GiB
|
||||
mountopts:
|
||||
- defaults
|
||||
- noatime
|
||||
- errors=remount-ro
|
||||
plugins:
|
||||
minimize_size:
|
||||
zerofree: true
|
||||
shrink: qemu-img
|
||||
apt:
|
||||
autoclean: true
|
Loading…
Add table
Reference in a new issue