The test for cow preallocated volumes in
file storage was checking that the actual-size
is bigger than virtual-size for the resulting
volume, as reported by qemu-img. However, this
check is not robust enough, and may fail as we
do not really control the allocation between the
image start (at byte 0), and the initial image
end offset.
We need to obtain the initial image end offset
and subtract it from the virtual-size, to ensure
that the resulting image size is bigger
than the allocated bytes (virtual-size - offset).
To get the initial image end offset, create
a reference cow image of the same size as the
volume, and use qemu-img check on it.
The test for cow preallocated volumes in file storage was checking that the actual-size is bigger than virtual-size for the resulting volume, as reported by
qemu-img
. However, this check is not robust enough, and may fail as we do not really control the allocation between the image start (at byte 0), and the initial image end offset.We need to obtain the initial image end offset and subtract it from the virtual-size, to ensure that the resulting image size is bigger than the allocated bytes (
virtual-size - offset
).To get the initial image end offset, create a reference cow image of the same size as the volume, and use
qemu-img check
on it.Signed-off-by: Albert Esteve aesteve@redhat.com