On Mon, Jan 13, 2020 at 11:18 AM <m.skrzetuski@gmail.com> wrote:
Hallo Jan,

maybe I worded my findings not clearly enough, sorry. oVirt is showing that the disk I create is 500GiB (like in your test) but inside the CentOS VM I have only a 8GiB disk, which I can see with lsblk and fdisk.

Can you share the output of this command on the image being uploaded?

qemu-img info /path/to/omage

oVirt SDK lets you create disk of any size when you upload an image. You must create disk
large enough to be able to upload the image, but oVirt cannot prevent you from creating a bigger
disk, and it can make sense for some cases.

The virtual size of the disk is called provisioned_size in the SDK. This must be the same size
as reported by qemu-img info "virtual size". It you specify smaller value the upload will fail at
the end, when oVirt verify that uploaded image. Specifying more is allowed (for backward 
compatibility) but is not recommended.

When uploading qcow2 images to block storage (e.g iSCSI/FC) you must specify the initial_size.
You can find this value using:

    qemu-img measure -f qcow2 -O qcow2 /path/to/image.qcow2

You must use the value returned as "required size".

The best tool to upload images is upload_disk.py from ovirt sdk examples:
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/upload_disk.py

With oVirt 4.4 you can upload any image format to any disk format, and the tool detect the image
format and calculate the correct size without errors.

Here are some examples (eliminating the engine details).

Upload raw image to qcow2 disk:

$ python3 upload_disk.py ... --disk-format qcow2 --disk-sparse fedora-30.raw Checking image... Image format: raw Disk format: cow Disk content type: data Disk provisioned size: 6442450944 Disk initial size: 1236336640 Disk name: fedora-30.qcow2 Connecting... Creating disk... Creating transfer session... Uploading image... [ 100.00% ] 6.00 GiB, 4.27 seconds, 1.40 GiB/s Finalizing transfer session... Upload completed successfully
 
Upload qcow2 disk to raw disk:

$ python3 upload_disk.py ... --disk-format raw --disk-sparse disk.qcow2 Checking image... Image format: qcow2 Disk format: raw Disk content type: data Disk provisioned size: 6442450944 Disk initial size: 6442450944 Disk name: disk.raw Connecting... Creating disk... Creating transfer session... Uploading image... [ 100.00% ] 6.00 GiB, 4.51 seconds, 1.33 GiB/s Finalizing transfer session... Upload completed successfully

Run upload_disk.py --help to learn about the available options.

I guess the ansible module should be updated to upload the disk properly
based on the sdk example.

Nir