Bug 1113020

Summary: Support virt-sparsify option to allow specifying temporary file or block device
Product: Red Hat Enterprise Linux 7 Reporter: Federico Simoncelli <fsimonce>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: amureini, leiwang, mbooth, ptoscano, yuliu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.27.56-1.1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1117540 1134633 1134635 (view as bug list) Environment:
Last Closed: 2015-03-05 13:43:53 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: 1021149    
Bug Blocks: 1035038, 1082754, 1113520, 1117540, 1134633, 1134635    

Description Federico Simoncelli 2014-06-25 09:44:05 UTC
Description of problem:
virt-sparsify requires a large amount of temporary space in order to sparsify an image. On oVirt nodes we may not have enough temporary local space and we don't want to pollute the hosts with potentially sensible data (even though the temporary layer would most likely just contain zeroes).

It should be possible to specify a temporary oVirt volume (residing on the storage domains) that can be used for processing the image.
The volume can either be a single file or a single block device (logical volume).

Comment 2 Richard W.M. Jones 2014-06-25 09:54:27 UTC
Upstream commit is 870c17e99acd038daed9b4004c66d401679475ab
which is in libguestfs >= 1.27.16.

For RHEL 7 this will be solved by the rebase (bug 1021149)
so I will set that as a dependency.

Comment 4 Richard W.M. Jones 2014-06-25 10:49:29 UTC
Please note there is a RHEL 7.1 preview repository:

https://www.redhat.com/archives/libguestfs/2014-May/msg00090.html

Later today I will upload a version of libguestfs which
contains the new virt-sparsify + --tmp option.

Comment 5 Federico Simoncelli 2014-07-15 11:01:16 UTC
We also need the --tmp prebuilt: support.

Comment 6 Richard W.M. Jones 2014-07-15 11:03:00 UTC
(In reply to Federico Simoncelli from comment #5)
> We also need the --tmp prebuilt: support.

The rebase (bug 1021149) will pick that up.  Need to check that
it works in the final package however.

Comment 8 yuliu 2014-11-10 09:34:19 UTC
version: 

Steps:
# virt-sparsify rhel-guest-image-6.5-20140926.0.x86_64.qcow2 /guest-image.qcow2 --tmp /nfs2/

# virt-sparsify rhel-guest-image-6.5-20140926.0.x86_64.qcow2 /guest-image.qcow2 --tmp /nfs2/
Input disk virtual size = 17179869184 bytes (16.0G)
Create overlay file in /nfs2/ to protect source disk ...
Examine source disk ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
Fill free space in /dev/sda1 with zero ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Copy to destination and make sparse ...

Sparsify operation completed with no errors.  Before deleting the old disk, 
carefully check that the target disk boots and works correctly.
# ll guest-image.qcow2 
-rw-r--r--. 1 root root 823721984 Nov 10 17:32 guest-image.qcow2

Verified as above.

Comment 10 errata-xmlrpc 2015-03-05 13:43:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0303.html