On Monday, 6 April 2020 17:48:35 CEST Eric Blake wrote:
On 4/6/20 10:40 AM, Pino Toscano wrote:
> Create two temporary directories for all the files created during the
> virt-v2v run:
> 1) tmpdir, created as $TMPDIR/virt-v2v.XXXXXX, for all the small files
> 2) cachedir, created as $LIBGUESTFS_CACHEDIR/virt-v2v.XXXXXX, for the
> big files (e.g. disks)
> This way there is no need to manually schedule all the temporary files
> and directories for removal when the application quits.
> ---
Side note:
> +++ b/v2v/output_glance.ml
> @@ -27,16 +27,6 @@ open Types
> open Utils
>
> class output_glance () =
> - (* Although glance can slurp in a stream from stdin, unfortunately
> - * 'qemu-img convert' cannot write to a stream (although I guess
> - * it could be implemented at least for raw). Therefore we have
> - * to write to a temporary file. XXX
> - *)
> - let tmpdir =
> - let base_dir = (open_guestfs ())#get_cachedir () in
> - let t = Mkdtemp.temp_dir ~base_dir "glance." in
> - rmdir_on_exit t;
> - t in
> object
> inherit output
>
> @@ -60,8 +50,12 @@ object
> method supported_firmware = [ TargetBIOS; TargetUEFI ]
>
> method prepare_targets _ overlays _ =
> - (* Write targets to a temporary local file - see above for reason. *)
> - List.map (fun (_, ov) -> TargetFile (tmpdir // ov.ov_sd)) overlays
> + (* Although glance can slurp in a stream from stdin, unfortunately
> + * 'qemu-img convert' cannot write to a stream (although I guess
> + * it could be implemented at least for raw). Therefore we have
> + * to write to a temporary file. XXX
> + *)
> + List.map (fun (_, ov) -> TargetFile (cachedir // ov.ov_sd)) overlays
I know this was just code motion, but does the nbdkit streaming plugin
help here?
I honestly don't know, I don't have a lot of nbdkit-foo :-)
This is the glance output mode, which creates new templates in the
Glance OpenStack service from each disk of the source VM. In recent
times it was sort of obsoleted by the openstack output mode, which
DTRT by creating a VM in Cinder.
It can be a good improvement, although certainly nothing more than
"nice to have" because of the explanation above.
--
Pino Toscano