[Libguestfs] [PATCH] builder: create temporary images in the cachedir (RHBZ#1288201)
Richard W.M. Jones
rjones at redhat.com
Fri Dec 4 10:05:33 UTC 2015
On Fri, Dec 04, 2015 at 11:03:48AM +0100, Pino Toscano wrote:
> Temporary images can be quite big, more than the space available in
> $TMPDIR when it's on a tmpfs; hence, place them in our cachedir
> instead.
> ---
> builder/builder.ml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/builder/builder.ml b/builder/builder.ml
> index 957bc37..3750e5f 100644
> --- a/builder/builder.ml
> +++ b/builder/builder.ml
> @@ -378,6 +378,8 @@ let main () =
>
> goal_must, goal_must_not in
>
> + let cache_dir = (open_guestfs ())#get_cachedir () in
> +
> (* Planner: Transitions. *)
> let transitions itags =
> let is t = List.mem_assoc t itags in
> @@ -394,7 +396,7 @@ let main () =
> (* Since the final plan won't run in parallel, we don't only need
> * to choose unique tempfiles per transition, so this is OK:
> *)
> - let tempfile = Filename.temp_file "vb" ".img" in
> + let tempfile = Filename.temp_file ~temp_dir:cache_dir "vb" ".img" in
> unlink_on_exit tempfile;
>
> (* Always possible to copy from one place to another. The only
ACK - thanks for fixing.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list