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
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)
I'll send a patch for this shortly.
--
Pino Toscano