Bug 1277122 - RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefully or ungracefully)
Summary: RFE: virt-sparsify: make '--in-place' sparsification safe to abort (gracefull...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1218766
Blocks: 1288337 1301891
TreeView+ depends on / blocked
 
Reported: 2015-11-02 12:24 UTC by Yaniv Kaul
Modified: 2016-11-03 17:56 UTC (History)
5 users (show)

Fixed In Version: libguestfs-1.32.0-2.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 17:56:26 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2576 normal SHIPPED_LIVE Moderate: libguestfs and virt-p2v security, bug fix, and enhancement update 2016-11-03 12:06:51 UTC

Description Yaniv Kaul 2015-11-02 12:24:02 UTC
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 13:12:19 UTC
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 12:39:23 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2015-November/thread.html#00032

Comment 4 Richard W.M. Jones 2015-11-04 17:47:14 UTC
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 17:50:16 UTC
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 11:54:33 UTC
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 17:56:26 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/RHSA-2016-2576.html


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