[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH v4] v2v: Add --print-estimate option to print copy size estimate.



On Thursday, 23 August 2018 17:59:36 CEST Richard W.M. Jones wrote:
> This option prints the estimated size of the data that will be copied
> from the source disk.
> 
> Currently this overestimates by the size of the qcow2 header, but for
> real disk images that doesn't matter much.
> 
> For example:
> 
> $ virt-builder fedora-27
> $ virt-v2v -i disk fedora-27.img -o null --print-estimate
> [...]
> virt-v2v: This guest has virtio drivers installed.
> [  44.0] Mapping filesystem data to avoid copying unused and blank areas
> [  44.5] Closing the overlay
> 1047920640

IMHO a better output is similar to what the --print-source prints --
so for example something like:

Estimation of the disks of the guest:
     Total size: 100000
         disk 1: 50000
         disk 2: 50000

While the --machine-readable a JSON snippet:

{
  "total": 100000,
  "disks": [
    50000,
    50000
  ]
}

IMHO providing the sizes of all the disks is a good idea, so it is
possible to do better estimation on the progress, in case.  Imagine
if a VM has a much bigger disk than the others, for example.
Also, I'd do the same no matter the number of disks, for coherency.

> +  let json = Filename.temp_file "v2vmeasure" ".json" in
> +  unlink_on_exit json;
> +
> +  let fd = Unix.openfile json [O_WRONLY; O_CREAT; O_TRUNC] 0o600 in

IMHO these can be replaced by Filename.open_temp_file +
Unix.descr_of_in_channel (still with unlink_on_exit).

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]