mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Merge pull request #453 from CMeza99/compress_qcow
Compress QCOW2 when shrinking
This commit is contained in:
commit
f05c2650d1
1 changed files with 6 additions and 2 deletions
|
@ -70,6 +70,10 @@ class ShrinkVolumeWithQemuImg(Task):
|
|||
@classmethod
|
||||
def run(cls, info):
|
||||
tmp_name = os.path.join(info.workspace, 'shrunk.' + info.volume.extension)
|
||||
log_check_call(
|
||||
['qemu-img', 'convert', '-O', info.volume.extension, info.volume.image_path, tmp_name])
|
||||
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':
|
||||
# '-c' indicates that target image must be compressed (qcow format only)
|
||||
shrink_cmd.insert(4, '-c')
|
||||
log_check_call(shrink_cmd)
|
||||
os.rename(tmp_name, info.volume.image_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue