[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Add readonly flag to -drive command
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] Add readonly flag to -drive command |
Date: |
Tue, 13 Oct 2009 09:36:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 |
Am 12.10.2009 18:15, schrieb Michael Tokarev:
> Anthony Liguori wrote:
>> Jamie Lokier wrote:
>>> Kevin Wolf wrote:
>>>
>>>> Am 12.10.2009 14:47, schrieb Naphtali Sprei:
>>>>
>>>>> In order to safely share an image between guests (as read only
>>>>> drive), add a 'readonly' flag
>>>>> to the -drive command (qemu command line and monitor).
>>>
>>> Heh. I've been sharing images between guests for ages - using "chmod -r"
>>> :-)
>>
>> Were it not for backwards compatibility, I would remove that and have it
>> error out.
>>
>> I've had multiple people end up with strangely broken guests because
>> they didn't realize the image was read only.
>
> And I had this issue too.
>
> But for me it's still not clear. Some disk drives out there can be
> switched to read-only mode at runtime by using appropriate command.
> Certain (USB and especially SD) flash drives can be read-only too
> (usually a tiny swith does that). Even old good floppy drives had
> a "write protect" switch. How the system determines if such devices
> are read-only? For a HDD or a flash drive, I *guess* the drive return
> appropriate error message, no?
>
> But qemu - apparently - just ignores writes in this case, which
> results in stalled guest which expects some answer to the write
> command.. I guess, because it was always the stalls.
The qemu block layer returns errors. For good old bdrv_write it's
-EACCES, for bdrv_aio_writev it's NULL (and therefore cannot be
distinguished from other errors). Not sure what the devices make out of
it. Probably not the right thing in all cases.
Kevin