qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] Snapshot question


From: Dunrong Huang
Subject: Re: [Qemu-discuss] Snapshot question
Date: Tue, 4 Sep 2012 23:51:56 +0800

Hi,
2012/9/4 Angus Gardner <address@hidden>:
> Hi qemu-discuss,
>
>
>
> I have a quick question regarding snapshot mode.
>
>
>
> I have been able to run qemu in snapshot mode and trace file operations.
> The ‘C:’ disk is opened read only and all new writes to the disk image go to
> a second image file, as per the documentation.  EG:
>
>
>
> Opening the disk image RO:
>
> open("winxp.qcow", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 10
>
>
>
> Opening the install cdrom image RO:
>
> open("WinXP_Install.iso", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 6
>
>
>
> A second disk image file is opened (RW):
>
> open("/tmp/vl.hIndzH", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 6
>
>
>
> Qemu then unlinks the new file
>
> unlink("/tmp/vl.hIndzH")
>
> but keeps reading and writing to it until the process is shut down, at which
> time it is lost.
>
>
>
> My question is:
>
> Is there a way to create this temporary disk image file in a user definable
Yes, you can. Take a quick look at block.c, I found the following related code:
int get_tmp_filename(char *filename, int size)
{
// snippet
    int fd;
    const char *tmpdir;
    tmpdir = getenv("TMPDIR");
    if (!tmpdir)
        tmpdir = "/tmp";
    if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) {
        return -EOVERFLOW;
    }
    fd = mkstemp(filename);
    if (fd < 0 || close(fd)) {
        return -errno;
    }
    return 0;
}
So you can simply set a "TMPDIR=/var/whatyouwant" and run QEMU.

> place and have it persist after shutdown?
Please refer to this article for more detailes:
http://lists.gnu.org/archive/html/qemu-devel/2008-09/msg00705.html
>
>
>
> This would be really useful in creating multiple VM’s which use less disk
> space and in creating a VM which can be used for a honeypot.
>
>
>
> Thanks,
>
> angus



-- 
Best Regards,

Dunrong Huang



reply via email to

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