Unable to insert cd media located on ro nfs mount
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
Bug Description
When issuing a "change" command via the monitor, qemu is unable to open the iso file if it is mounted on a read-only nfs share. If I mount read-write (and make sure the file is writable by the qemu process), then the change command succeeds. Note that this doesn't affect media specified on the command line when starting qemu, only when changing via the monitor.
To reproduce, mount cd images directory read only, e.g.
[root@kvmhost0 ~]# grep iso /etc/fstab
10.48.50.20:/iso /srv/kvm/iso nfs4 defaults,ro 0 0
Start qemu with minimal options, just need access to the monitor:
[root@kvmhost0 ~]# kvm -vnc 127.0.0.1:0 -S
Connect to the monitor and issue a change command:
(qemu) change ide1-cd0 /srv/kvm/
Could not open '/srv/kvm/
Re-mount the iso directory read-write and notice that the command succeeds:
[root@kvmhost0 ~]# mount -o remount,rw /srv/kvm/iso
(qemu) change ide1-cd0 /srv/kvm/
(qemu)
[root@kvmhost0 ~]# kvm --version
QEMU emulator version 1.1.1 (qemu-kvm-1.1.1), Copyright (c) 2003-2008 Fabrice Bellard
[root@kvmhost0 ~]# uname -a
Linux kvmhost0 3.4.5-1-ARCH #1 SMP PREEMPT Mon Jul 16 21:35:54 CEST 2012 x86_64 GNU/Linux
I ran strace while running the test and I see few times:
open("/ srv/kvm/ iso/ubuntu- 12.04-server- amd64.iso" , O_RDONLY| O_NONBLOCK) = 12 S_IFREG| 0666, st_size=717533184, ...}) = 0
fstat(12, {st_mode=
close(12)
But the final open looks like this:
open("/ srv/kvm/ iso/ubuntu- 12.04-server- amd64.iso" , O_RDWR| O_DSYNC| O_CLOEXEC) = -1 EROFS (Read-only file system)
For some reason, the O_RDRW flag was requested.