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?

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to