Bug 1297255 - add possibility to sparsify image during block copy
Summary: add possibility to sparsify image during block copy
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 7.4
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
Depends On: 1232914 1242316 1533975
Blocks: 1229843 Red Hat1288337 Red Hat1401400 Red Hat1473733 Red Hat1477664 Red Hat1546815
TreeView+ depends on / blocked
 
Reported: 2016-01-11 01:39 UTC by Fam Zheng
Modified: 2022-03-13 13:59 UTC (History)
23 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1232914
Environment:
Last Closed: 2018-12-18 12:14:35 UTC
Target Upstream Version:
asoni: needinfo-


Attachments (Terms of Use)

Comment 24 Peter Krempa 2017-12-12 09:01:46 UTC
Fixing summary to clarify. 

Description asks libvirt to add possibility to enable sparsification of the regions of the image containing only zero blocks so that they are actually unmapped.

Note that this comes with a performance penalty thus it should not be enabled by default.

Also note that qemu already keeps the unmaped regions unmapped when copying, so this is useful only when the regions were not unmapped before for some reasons.

Comment 31 Peter Krempa 2018-12-18 12:14:35 UTC
So unfortunately it looks like qemu will not provide the required interface (https://bugzilla.redhat.com/show_bug.cgi?id=1533975) which will allow to skip zero-writes when doing a block-copy operation into a raw file.

Closing as CANTFIX

It is possible to do a workaround with a few manual/external steps:
1) create a snapshot on top of the raw file on the local filesystem or NFS (virsh snapshot-create --no-metadata ...)
2) manually copy over the original file and sparsify it since it's no longer written to
3) manually create an empty qcow2 file with a backing file which points to the new file copied in step 2
4) use block copy operation to switch to the new file: (virsh blockcopy --reuse-external --transient-job --shallow --pivot ...) and wait for it to finish
5) use block-commit to remove the temporary snapshot and start using the copied file (virsh blockcommit --active --pivot ...)


Note You need to log in before you can comment on or make changes to this bug.