mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
expose ability to no compress qcow
This commit is contained in:
parent
f05c2650d1
commit
d31cc3a34c
3 changed files with 6 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)
|
||||
|
|
Loading…
Add table
Reference in a new issue