Bug 1277122 - RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefully or ungracefully)
RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefull...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.3
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
: FutureFeature
Depends On: 1218766
Blocks: 1301891 1288337
  Show dependency treegraph
 
Reported: 2015-11-02 07:24 EST by Yaniv Kaul
Modified: 2016-11-03 13:56 EDT (History)
5 users (show)

See Also:
Fixed In Version: libguestfs-1.32.0-2.el7
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 13:56:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Yaniv Kaul 2015-11-02 07:24:02 EST
Description of problem:
I'd be happy if there will be a possibility to use virt-sparsify in '--in-place' mode (where sparsification is not happening on a copy of the disk, but in place) and if a user stops gracefully the process or the process gets killed abruptly, the disk is still safe from corruption.

TIA,
Y.
Comment 2 Richard W.M. Jones 2015-11-03 08:12:19 EST
I posted a thread upstream about this:

https://lists.nongnu.org/archive/html/qemu-devel/2015-11/threads.html#00402

Paolo's reply hasn't appeared in that archive yet, but he agrees
with me that this should be safe.

However it would be nice for virt-sparsify to handle ^C
gracefully, so I'm going to try to implement that.
Comment 3 Richard W.M. Jones 2015-11-04 07:39:23 EST
Patch posted:
https://www.redhat.com/archives/libguestfs/2015-November/thread.html#00032
Comment 4 Richard W.M. Jones 2015-11-04 12:47:14 EST
This is upstream now:
https://github.com/libguestfs/libguestfs/commit/8e3920a334d8d2b3c0a2be8ca84f8f935c41b106

We'll pick this change up in the rebase (bug 1218766).
Comment 5 Richard W.M. Jones 2015-11-04 12:50:16 EST
From an oVirt operational point of view, you just need to send
the virt-sparsify process either SIGINT or SIGQUIT (once).  It
will shut down gracefully (which may take some time), and then
exit with an error code.

If you send a second signal before virt-sparsify exits, then
virt-sparsify will exit immediately (and *un*gracefully), so I
don't recommend doing that.
Comment 7 Xianghua Chen 2016-07-28 07:54:33 EDT
Verified with packages:
libguestfs-1.32.6-1.el7.x86_64

Steps:
1. Prepare a RHEL7 guest image: RHEL-Server-7.2-64-hvm.raw
#  qemu-img  info RHEL-Server-7.2-64-hvm.raw
image: RHEL-Server-7.2-64-hvm.raw
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: 8.0G
# virt-filesystems -a RHEL-Server-7.2-64-hvm.raw -l
Name                      Type       VFS Label Size       Parent
/dev/sda1                 filesystem xfs -     524288000  -
/dev/rhel_dhcp-10-28/root filesystem xfs -     7159676928 -

2. # virt-sparsify --in-place RHEL-Server-7.2-64-hvm.raw

3. #  qemu-img  info RHEL-Server-7.2-64-hvm.raw
image: RHEL-Server-7.2-64-hvm.raw
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: 2.2G
# virt-filesystems -a RHEL-Server-7.2-64-hvm.raw -l
Name                      Type       VFS Label Size       Parent
/dev/sda1                 filesystem xfs -     524288000  -
/dev/rhel_dhcp-10-28/root filesystem xfs -     7159676928 -

4. Execute step 1-3 again, but use ctrl+c to stop it during the process in step 2.

All commands finished successfully, and the guest images is shrinked and can be boot normally after execute virt-sparsify.
Comment 9 errata-xmlrpc 2016-11-03 13:56:26 EDT
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/RHSA-2016-2576.html

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