Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1297255

Summary: add possibility to sparsify image during block copy
Product: Red Hat Enterprise Linux 7 Reporter: Fam Zheng <famz>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED CANTFIX QA Contact: yisun
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: areis, asoni, byount, cww, dmaley, dyuan, fjin, hhan, jsuchane, juzhang, knoel, lmen, meili, mkalinin, mtessun, pbonzini, pbrady, pezhang, pkrempa, virt-bugs, virt-maint, xfu, xuzhang
Target Milestone: rcFlags: asoni: needinfo-
Target Release: 7.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1232914 Environment:
Last Closed: 2018-12-18 12:14:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1232914, 1242316, 1533975    
Bug Blocks: 1229843, 1288337, 1401400, 1473733, 1477664, 1546815    

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 ...)