qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] RFE- snapshot data storage location configurable


From: dmc
Subject: Re: [Qemu-devel] RFE- snapshot data storage location configurable
Date: Sun, 05 Aug 2007 14:44:49 -0500
User-agent: Thunderbird 2.0.0.5 (X11/20070719)

J M Cerqueira Esteves wrote:
dmc wrote:
I have a pretty ugly patch against qemu 0.8 which allows the location of
data used with the -snapshot feature to be somewhere other than
/var/tmp.  I have a use-case where I am creating many gigabytes of
changes to disk in snapshot mode.  When 0.9 came out, I looked, but it
seemed less than trivial to update my patch, which was a pretty ugly
hack to begin with.

I don't suppose anybody else thinks this would be a useful feature?

It would certainly be useful, as I found out yesterday :) while testing
installation of a big software package in a Windows virtual machine in
snapshot mode (with 0.9.0) even though the (Linux) host's /tmp had about
1 GB.

I would suggest at least honoring the TMPDIR environment variable (which
is not being taken into account).

Yeah, my 0.8.1 solution was QEMU_COW_TMPDIR, since I was too lazy to do something like tracking down all the places in the code that a more general TMPDIR should probably be respected.

For what it's worth, attached is my trivial 0.8.1 patch. I may take a second look at updating it, but it's not a high priority for me at the moment.

-dmc

diff -Naur qemu-0.8.1.orig/block.c qemu-0.8.1.cowtmpdirenv/block.c
--- qemu-0.8.1.orig/block.c     2006-06-22 02:14:55.000000000 +0000
+++ qemu-0.8.1.cowtmpdirenv/block.c     2006-06-22 02:23:03.000000000 +0000
@@ -169,8 +169,19 @@
 void get_tmp_filename(char *filename, int size)
 {
     int fd;
+    const char *tmpdir;
+
+    tmpdir = getenv("QEMU_COW_TMPDIR");
+    if (!tmpdir)
+        tmpdir = "/tmp";
+    snprintf(filename, size, "%s/vl.XXXXXX", tmpdir);
+
     /* XXX: race condition possible */
-    pstrcpy(filename, size, "/tmp/vl.XXXXXX");
+    /* COWTMPDIR: I don't understand the possible race condition in the 
+       below line of code, so I have no idea if it still applies to 
+       the above alternate method for creating filename */
+    /*    pstrcpy(filename, size, "/tmp/vl.XXXXXX"); */
+
     fd = mkstemp(filename);
     close(fd);
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]