Bug 1064041
| Summary: | virt-sparsify fails if a btrfs filesystem contains readonly snapshots | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Richard W.M. Jones <rjones> | |
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 7.0 | CC: | jbastian, leiwang, linl, martin, mbooth, ptoscano, sherold, wshi, xchen | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | libguestfs-1.32.0-2.el7 | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1079625 (view as bug list) | Environment: | ||
| Last Closed: | 2016-11-03 17:46:31 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: | 1079625, 1218766 | |||
| Bug Blocks: | 1288337, 1301891 | |||
|
Description
Richard W.M. Jones
2014-02-11 21:20:18 UTC
Reproducer:
---------------------------------------------------------------
guestfish -x -N fs:btrfs -m /dev/sda1 <<EOF
btrfs-subvolume-create /vol1
# libguestfs has no API for this yet:
debug sh "btrfs subvolume snapshot -r /sysroot/vol1 /sysroot/snapshot"
# This will fail with the same error as virt-sparsify:
-zero-free-space /snapshot
EOF
virt-sparsify test1.img test1-out.img
---------------------------------------------------------------
The virt-sparsify command at the end will fail with:
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/sda1 with zero ...
Fill free space in btrfsvol:/dev/sda1/snapshot with zero ...
Fatal error: exception Guestfs.Error("zero_free_space: open: /sysroot//idpr6elo.o7z: Read-only file system")
Virt-sparsify should generally avoid read-only filesystems. The same thing would happen if, for example, there was an ISO9660 filesystem contained in any partition and you tried to sparsify the disk image. This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux. As written in https://bugzilla.redhat.com/show_bug.cgi?id=1079625#c1: Fixed upstream with https://github.com/libguestfs/libguestfs/commit/864c2ee371f65388b18e737136663986cfc9eb08 Also, https://github.com/libguestfs/libguestfs/commit/4bb3c44a286beb0dd8cdf337d64d8ce71e361dd6 makes virt-sparsify ignore read-only filesystems. Both available in libguestfs >= 1.29.24. So this bug fix will be picked by the rebase (bug #1218766). Verified with the packages: libguestfs-1.32.5-6.el7.x86_64 Verify steps: 1. Prepare a RHEL guest image with a snapshot: # qemu-img snapshot -l rhel7.1.qcow2 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 snapshot1 0 2016-06-28 10:35:03 00:00:00.000 2. virt-sparsify rhel7.1.qcow2 --convert raw rhel7.1.raw [ 0.1] Create overlay file in /tmp to protect source disk [ 0.1] Examine source disk [ 2.7] Fill free space in /dev/rhel/root with zero 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 [ 290.1] Clearing Linux swap on /dev/rhel/swap 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 [ 313.8] Fill free space in /dev/sda1 with zero [ 314.4] Fill free space in /dev/sda2 with zero [ 315.5] Fill free space in volgroup rhel with zero [ 324.8] Copy to destination and make sparse [ 757.1] Sparsify operation completed with no errors. virt-sparsify: Before deleting the old disk, carefully check that the target disk boots and works correctly. No error occurs. So Verified. 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 |