oVirt / vdsm

The Virtual Desktop Server Manager
GNU General Public License v2.0
161 stars 202 forks source link

localfssd_test: fix cow prealloc check #318

Closed aesteve-rh closed 2 years ago

aesteve-rh commented 2 years ago

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