On Sun, Mar 25, 2018 at 1:36 AM Nir Soffer <nirsof(a)gmail.com> wrote:
On Thu, Mar 22, 2018 at 5:25 PM Richard W.M. Jones
<rjones(a)redhat.com>
wrote:
> PROBLEMS:
> - -of qcow2 does not work, with multiple problems
> * needs to set NBD size to something larger than virtual size
>
How is this related to the actual file size specified when you create a
disk?
In block storage, qcow2 image is always on a thin provisioned disk, which
in oVirt is a regular logical volume, created at the requested
"initial_size":
From:
https://github.com/oVirt/ovirt-engine-sdk/blob/aba2a83ec94ecac1594adfff62...
if image_info["format"] == "qcow2":
disk_format = types.DiskFormat.COW
else:
disk_format = types.DiskFormat.RAW
disks_service = connection.system_service().disks_service()
disk = disks_service.add(
disk=types.Disk(
name=os.path.basename(image_path),
description='Uploaded disk',
format=disk_format,
initial_size=image_size,
provisioned_size=image_info["virtual-size"],
sparse=disk_format == types.DiskFormat.COW,
storage_domains=[
types.StorageDomain(
name='mydata'
)
]
)
)
Internally we do allocated 10% more then the requested initial_size
to leave room for qcow2 metadata.
But best do not depend on this, I would like to remove it in the future.
[snipped]
> + # Create the disk.
> + disks_service = system_service.disks_service()
> + if params['disk_format'] == "raw":
> + disk_format = types.DiskFormat.RAW
> + else:
> + disk_format = types.DiskFormat.COW
> + disk = disks_service.add(
> + disk = types.Disk(
> + name = params['disk_name'],
> + description = "Uploaded by virt-v2v",
> + format = disk_format,
> + provisioned_size = params['disk_size'],
>
This must be the virtual size.
You don't specify initial_size - in this case you get 1G, and most
images will fail to upload.
Since you are using qemu-img convert, you must give initial_size that it big
enough to hold the image after conversion. The source image size may not
be enough, since it may contain compressed clusters.
The best way to estimate the size it to use the new "qemu-img measure"
command.
The oVirt sdk examples do not care about this since we just copy the image
as is to storage.
Nir