Red Hat Bugzilla – Bug 991228
Invalid argument "cache" for -drive
Last modified: 2013-09-09 09:47:49 EDT
Description of problem:
I'm unable to set -drive cache=none. The command fails with could not open disk image /tmp/stg1.qcow2: Invalid argument
Version-Release number of selected component (if applicable):
Always, I tested it with -drive if=none and if=ide
Steps to Reproduce:
1. qemu-kvm -drive if=ide,cache=none,file=/tmp/asdf
qemu-system-x86_64: -drive if=ide,cache=none,file=/tmp/asdf: could not open disk image /tmp/asdf: Invalid argument
Boot VM with this disk '/tmp/asdf' using cache=none.
Interesting is that I can set cache="writeback", "unsafe", or "directsync". But when I try "none" it doesn't work.
I tested it on upstream qemu 1.5.50 and it works fine.
Oh, sorry, it doesn't work on qemu-1.5.50. Anyway IMO it should work and I'd swear it worked before.
At a guess I would say this has something to do with tmp-on-tmpfs.
cache=none causes the O_DIRECT flag to be used, and this flag
isn't supported by tmpfs.
Hi, yes, that is the cause. It would be nice if qemu could report this with some sane error message instead of "could not open disk image /tmp/asdf: Invalid argument".
(In reply to Lukas Doktor from comment #3)
> Hi, yes, that is the cause. It would be nice if qemu could report this with
> some sane error message instead of "could not open disk image /tmp/asdf:
> Invalid argument".
Unfortunately qemu just calls open(2) and gets errno = EINVAL
back, and no more information than that. It would be nice
if tmpfs could be persuaded to just ignore the O_DIRECT flag,
since this flag has, at best, hazy semantics and they likely
don't matter on an in-memory filesystem.
Stefan posted patches upstream to give an explicit error in this case:
So just closing this as UPSTREAM