Skip to content

Commit da00200

Browse files
committed
Issue #129 Workaround for virt-sparsify to work with immutable partition
With OpenShift-4.3 the rh-coreos image failed during sparsify because of the immutable attribute set for /dev/sda4 partition. Need to use guestfish to remove it and run the virt-sparsify and then apply back. - https://bugzilla.redhat.com/show_bug.cgi?id=1771257
1 parent bfbbee0 commit da00200

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

createdisk.sh

+6
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ function create_qemu_image {
6161
exit 1
6262
fi
6363

64+
# Remove immutable attribute for OpenShift 4.3+
65+
guestfish -a $destDir/${CRC_VM_NAME}.qcow2 -m /dev/sda4 set-e2attrs / i clear:true
66+
6467
# TMPDIR must point at a directory with as much free space as the size of the image we want to sparsify
6568
# Read limitation section of `man virt-sparsify`.
6669
TMPDIR=$(pwd)/$destDir ${VIRT_SPARSIFY} -o lazy_refcounts=on $destDir/${CRC_VM_NAME}.qcow2 $destDir/${CRC_VM_NAME}_sparse.qcow2
6770
rm -f $destDir/${CRC_VM_NAME}.qcow2
6871
mv $destDir/${CRC_VM_NAME}_sparse.qcow2 $destDir/${CRC_VM_NAME}.qcow2
6972
rm -fr $destDir/.guestfs-*
7073

74+
# Set immutable attribute back for /dev/sda4
75+
guestfish -a $destDir/${CRC_VM_NAME}.qcow2 -m /dev/sda4 set-e2attrs / i
76+
7177
# Before using the created qcow2, check if it has lazy_refcounts set to true.
7278
${QEMU_IMG} info ${destDir}/${CRC_VM_NAME}.qcow2 | grep "lazy refcounts: true" 2>&1 >/dev/null
7379
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)