Bug 1185561 - virt-sparsify should ignore read-only LVs
Summary: virt-sparsify should ignore read-only LVs
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: libguestfs
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-24 18:21 UTC by Fabian Deutsch
Modified: 2015-02-02 13:42 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-02 13:42:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Fabian Deutsch 2015-01-24 18:21:39 UTC
Description of problem:
virt-sparsify also tries to sparsify filesystems on read-only LVs. It should not try this.

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

How reproducible:
alwyas

Steps to Reproduce:
1. Create a VG with a read-only LV (vgchange --permission r VG/LV)
2. Run virt-sparsify on the image containing that LV
3.

Actual results:
Failure: virt-sparsify: libguestfs error: zero_free_space: unlink: /sysroot//ev85lpbq.s38: Read-only file system

Expected results:
virt-sparsify ignores the LV/fs.

Additional info:
12:48:11 virt-sparsify --check-tmpdir continue --compress installation.qcow2 installation.qcow2.sparse && mv -v installation.qcow2.sparse installation.qcow2
12:48:11 Input disk virtual size = 10737418240 bytes (10.0G)
12:48:11 
12:48:11 WARNING: There may not be enough free space on /tmp.
12:48:11 You may need to set TMPDIR to point to a directory with more free space.
12:48:11 
12:48:11 Max needed: 10.0G.  Free: 4.4G.  May need another 5.6G.
12:48:11 
12:48:11 Note this is an overestimate.  If the guest disk is full of data
12:48:11 then not as much free space would be required.
12:48:11 
12:48:11 You can ignore this warning or change it to a hard failure using the
12:48:11 --check-tmpdir=(ignore|continue|warn|fail) option.  See virt-sparsify(1).
12:48:11 
12:48:11 Create overlay file in /tmp to protect source disk ...
12:48:11 Examine source disk ...
12:48:26 Fill free space in /dev/HostVG/Image-0.0 with zero ...
12:48:29 Fill free space in /dev/HostVG/Image-0.1 with zero ...
12:49:33 virt-sparsify: libguestfs error: zero_free_space: unlink: /sysroot//ev85lpbq.s38: Read-only file system

Comment 1 Richard W.M. Jones 2015-01-26 09:50:11 UTC
I think you mean "lvchange", not "vgchange" :-)  That had me confused
for a while ...

Simple reproducer:

$ guestfish -N bootrootlv debug sh "lgchange --permission r VG/LV"
$ rm -f test2.img
$ truncate -s 200M test2.img
$ virt-sparsify test1.img test2.img 
Input disk virtual size = 104857600 bytes (100.0M)
Create overlay file in /tmp to protect source disk ...
Examine source disk ...
Fill free space in /dev/VG/LV with zero ...
virt-sparsify: error: libguestfs error: zero_free_space: open: 
/sysroot//xmjgtnhn.qve: Read-only file system

In order to get the read-only status of an LV, we must use
guestfs_lvs_full and look for the 'r' flag in the lv_attr field.

Comment 2 Fabian Deutsch 2015-01-27 11:36:16 UTC
(In reply to Richard W.M. Jones from comment #1)
> I think you mean "lvchange", not "vgchange" :-)  That had me confused
> for a while ...

Argh. Yes, sorry for that typo.

Comment 3 Fabian Deutsch 2015-01-27 11:38:08 UTC
(In reply to Richard W.M. Jones from comment #1)
…
> Simple reproducer:
> 
> $ guestfish -N bootrootlv debug sh "lgchange --permission r VG/LV"

It should actually be lvchange, instead of lgchange.

Comment 4 Richard W.M. Jones 2015-01-28 14:26:14 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2015-January/msg00127.html


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