[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] non-file-based storage and -snapshot ?
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] non-file-based storage and -snapshot ? |
Date: |
Thu, 26 Apr 2012 10:59:49 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.3) Gecko/20120329 Icedove/10.0.3 |
It is interesting that no one hit this bug before.
Apparenlty, no non-file-based storage works with
-snapshot or ,snapshot=on today. Here's how:
$ qemu -drive file=nbd:localhost:12345 -snapshot
qemu: -drive file=nbd:localhost:12345: could not open disk image
nbd:localhost:12345: No such file or directory
Here's the relevant code, block.c:bdrv_open(), with
irrelevant details removed:
if (flags & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1;
int is_protocol = 0;
char backing_filename[PATH_MAX];
/* if there is a backing file, use it */
bs1 = bdrv_new("");
ret = bdrv_open(bs1, filename, 0, drv);
if (bs1->drv && bs1->drv->protocol_name)
is_protocol = 1;
/* Real path is meaningless for protocols */
if (is_protocol)
snprintf(backing_filename, sizeof(backing_filename),
"%s", filename);
else if (!realpath(filename, backing_filename)) <=== it fails here
return -errno;
set_option_parameter(options, BLOCK_OPT_BACKING_FILE, backing_filename);
}
Now, the "protocol" for this file is "raw", and
bs1->drv->protocol_name is NULL.
This thing is rather twisted, with lots of variables with
similar but slightly different meaning, so I'm not sure
how to fix this.
For now I changed the code to:
set_option_parameter(options, BLOCK_OPT_BACKING_FILE, filename);
instead of
set_option_parameter(options, BLOCK_OPT_BACKING_FILE, backing_filename);
and removed all the surrounding cruft.
I understand this will break for some things, but at least
it lets me to do my work now.
Any idea for a real fix?
Thanks!
/mjt
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] non-file-based storage and -snapshot ?,
Michael Tokarev <=