Bug 991228

Summary: Invalid argument "cache" for -drive
Product: [Fedora] Fedora Reporter: Lukáš Doktor <ldoktor>
Component: qemuAssignee: Fedora Virtualization Maintainers <virt-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: amit.shah, berrange, cfergeau, crobinso, dwmw2, itamar, pbonzini, rjones, scottt.tw, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-09 13:47:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 826015    

Description Lukáš Doktor 2013-08-01 22:19:56 UTC
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):
qemu-kvm-1.4.2-4.fc19.x86_64

How reproducible:
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

Actual results:
qemu-system-x86_64: -drive if=ide,cache=none,file=/tmp/asdf: could not open disk image /tmp/asdf: Invalid argument


Expected results:
Boot VM with this disk '/tmp/asdf' using cache=none.

Additional info:
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.

Comment 1 Lukáš Doktor 2013-08-01 22:31:57 UTC
Oh, sorry, it doesn't work on qemu-1.5.50. Anyway IMO it should work and I'd swear it worked before.

Comment 2 Richard W.M. Jones 2013-08-02 07:14:21 UTC
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.

Comment 3 Lukáš Doktor 2013-08-05 14:46:05 UTC
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".

Comment 4 Richard W.M. Jones 2013-08-05 14:54:45 UTC
(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.

Comment 5 Cole Robinson 2013-09-09 13:47:49 UTC
Stefan posted patches upstream to give an explicit error in this case:

https://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg03019.html

So just closing this as UPSTREAM