[Libguestfs] [PATCH virt-v2v v2 2/2] v2v: Allow large temporary directory to be set on a global basis.

Daniel P. Berrangé berrange at redhat.com
Mon Apr 6 18:04:15 UTC 2020


On Mon, Apr 06, 2020 at 01:12:38PM +0200, Pino Toscano wrote:
> On Monday, 6 April 2020 11:19:12 CEST Richard W.M. Jones wrote:
> > Previously we placed large files in g#get_cachedir () (usually
> > /var/tmp).  However the problem is this ties the libguestfs appliance
> > and the virt-v2v overlay files to the same location.
> > 
> > When virt-v2v is run in a container, or any other situation where
> > local storage is limited, it's helpful to be able to put the overlay
> > files on an externally mounted PVC, which might be using NFS and
> > shared between containers.  But putting the libguestfs appliance on
> > NFS in a shared location is certainly not recommended.
> > 
> > This allows the two locations to be set separately:
> > 
> >   VIRT_V2V_TMPDIR - location of large temporary files, can use NFS
> >                     and may be shared
> > 
> >   LIBGUESTFS_CACHEDIR - location of libguestfs appliance
> > 
> > Another motivation for this patch is to allow more reliable cleanup of
> > large temporary files by an external process, as described in the
> > updated documentation.
> > 
> > Small temporary files are placed in $TMPDIR (usually /tmp).  I cleaned
> > up some existing code which used /var/tmp for small temporaries.
> 
> (^ this last change reverts 0bc1411fc8693dd981efef0088b3d335a11332cf )
> 
> > ---
> 
> This is mostly a repost of v1, with even few things that got worse
> (I'll mention it later on). Since my requests [1][2] for actual use
> cases and motivations behind this went unanswered other than with
> - "because containers"
> - "because why not"
> then, I'll keep NACK-ing this patch.
> 
> [1] https://www.redhat.com/archives/libguestfs/2020-April/msg00008.html
> [2] https://www.redhat.com/archives/libguestfs/2020-April/msg00010.html

I've tried to give some more info about container usage in reply to
those threads.

> Since the problem is "let's find out what to clean on failure", I
> propose a different approach, as also looking at this patch pointed out
> to me:
> - create a single virt-v2v.XXXXXX temporary directory in
>   LIBGUESTFS_TMPDIR for small files, like the vmx file, the rhv-upload
>   Python scripts, etc
> - create a single virt-v2v.XXXXXX temporary directory in
>   LIBGUESTFS_CACHEDIR for big files
> Advantages:
> - no more need for the various Mkdtemp.temp_dir all around
> - only two well-defined names for temporary stuff that virt-v2v saves
> - similar to what done in other tools (eg virt-builder, 75fbe4511e05df)

Why not just have $VIRTV2V_TMPDIR & $VIRTV2V_CACHEDIR for the
files created by virt-v2v. Tieing it into the locations used
by libguestfs seems like an unecessary restriction that doesn't
really need to be there, since they are separate codebases with
their own distinct needs.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the Libguestfs mailing list