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 1122557 - virt-sparsify overwrites block devices if used as output files
Summary: virt-sparsify overwrites block devices if used as output files
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1056290
Blocks: 1056556 1056558
TreeView+ depends on / blocked
 
Reported: 2014-07-23 13:46 UTC by Federico Simoncelli
Modified: 2015-07-22 05:55 UTC (History)
9 users (show)

Fixed In Version: libguestfs-1.20.11-13.el6
Doc Type: Bug Fix
Doc Text:
As a result of the fix for BZ#1056558, it was not possible to use a block device for output when using the virt-sparsify utility. This update re-enables block devices to be used as ouput in virt-sparsify.
Clone Of: 1056290
Environment:
Last Closed: 2015-07-22 05:55:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1444 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-07-20 18:44:02 UTC

Description Federico Simoncelli 2014-07-23 13:46:29 UTC
To implement virt-sparsify in oVirt we actually need the full support for block devices.

+++ This bug was initially created as a clone of Bug #1056290 +++

Description of problem:

(Reported by shawnjgoff on IRC)

If you do something like:

  virt-sparsify infile /dev/vg/lv

then virt-sparsify will overwrite /dev/vg/lv with a file, which
is not exactly as intended.

It should detect if the output is a block device and (probably)
reject the attempt, although there is a possible use case which
is writing a qcow2 file into an LV (as used by oVirt).

Version-Release number of selected component (if applicable):

virt-sparsify 1.20.11rhel=6,release=2.el6

--- Additional comment from Richard W.M. Jones on 2014-01-22 08:12:47 EST ---

Upstream fix is: 13bca32e4ec9213e69ea55e837dea846719fb67e
available in libguestfs >= 1.25.26 and >= 1.24.6.

Comment 2 Richard W.M. Jones 2014-07-23 14:09:30 UTC
Patch posted:

https://www.redhat.com/archives/libguestfs/2014-July/msg00073.html

Comment 3 Federico Simoncelli 2014-07-23 14:23:44 UTC
(In reply to Richard W.M. Jones from comment #2)
> Patch posted:
> 
> https://www.redhat.com/archives/libguestfs/2014-July/msg00073.html

Just for the record, we are not risking to hit bug 1056290 again? Thanks.

Comment 4 Richard W.M. Jones 2014-07-23 14:56:52 UTC
(In reply to Federico Simoncelli from comment #3)
> (In reply to Richard W.M. Jones from comment #2)
> > Patch posted:
> > 
> > https://www.redhat.com/archives/libguestfs/2014-July/msg00073.html
> 
> Just for the record, we are not risking to hit bug 1056290 again? Thanks.

It's a good question.  The code in virt-sparsify just runs:

  qemu-img convert overlay outdisk

The root cause of bug 1056290 was not in libguestfs, it was in
qemu-img, or more specifically in the block layer in qemu.

I have tested qemu-img convert in RHEL 6.5 against a loop device
and it correctly opens the block device.  It doesn't delete or
overwrite the device node.

I have also tested virt-sparsify against an LV on recent Fedora,
and that works.

So we may have just hit a transient bug in qemu-img.

Comment 6 Lingfei Kong 2014-08-28 10:55:57 UTC
Can reproduce with libguestfs-1.20.11-2.el6

Steps to reproduce:
#virt-sparsify rhel77.img  /dev/VolGroup/test 
qemu-img version 0.9
Create overlay file to protect source disk ...
Examine source disk ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
Fill free space in /dev/rhel/root with zero ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Clearing Linux swap on /dev/rhel/swap ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Fill free space in /dev/sda1 with zero ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Copy to destination and make sparse ...
......

Comment 8 Hu Zhang 2015-03-11 07:04:26 UTC
Verified with the package version:
libguestfs-1.20.11-14.el6.x86_64

Verify steps:
1. # virt-sparsify RHEL-Server-7.1-64-hvm-2.raw /dev/vg_ibmx3650m303/test
qemu-img version 0.9
Input disk virtual size = 10486808576 bytes (9.8G)
Create overlay file in /tmp to protect source disk ...
Examine source disk ...
Fill free space in /dev/rhel/root with zero ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Clearing Linux swap on /dev/rhel/swap ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Fill free space in /dev/sda1 with zero ...
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Fill free space in volgroup rhel with zero ...
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.
--------end--------

2. # virt-sparsify RHEL-Server-7.1-64-hvm-2.raw /dev/input/mouse0
virt-sparsify: error: output '/dev/vcs' cannot be a character device, 
it must be a regular file

virt-sparsify: If reporting bugs, run virt-sparsify with debugging 
enabled (-v) and include the complete output.
--------end--------

So the output can be a block device, but not a char device. Verified.

Comment 10 errata-xmlrpc 2015-07-22 05:55:25 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-1444.html


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