From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MxLY9-0006YI-7i for qemu-devel@nongnu.org; Mon, 12 Oct 2009 10:06:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MxLY4-0006VN-KY for qemu-devel@nongnu.org; Mon, 12 Oct 2009 10:06:56 -0400 Received: from [199.232.76.173] (port=46317 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxLY4-0006VE-Er for qemu-devel@nongnu.org; Mon, 12 Oct 2009 10:06:52 -0400 Received: from mail-ew0-f205.google.com ([209.85.219.205]:35748) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxLY3-0003T7-Vd for qemu-devel@nongnu.org; Mon, 12 Oct 2009 10:06:52 -0400 Received: by ewy1 with SMTP id 1so808142ewy.34 for ; Mon, 12 Oct 2009 07:06:50 -0700 (PDT) Message-ID: <4AD337F4.7070405@codemonkey.ws> Date: Mon, 12 Oct 2009 09:06:44 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Add readonly flag to -drive command References: <4AD32550.8040901@redhat.com> <4AD32DF6.4050100@redhat.com> In-Reply-To: <4AD32DF6.4050100@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Naphtali Sprei , qemu-devel@nongnu.org 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). >> >> Still missing passing the read only attribute to the guest, where possible. I don't know which device types supports >> read only, and don't know how to pass this information to guests. >> >> Also not sure what to do when qemu cannot open the file as writeable. Currently it opens it as read only. >> We might change it to give a warning or even an error. >> >> From 6e297da79a4c015555e3927e6d28744933a31ebe Mon Sep 17 00:00:00 2001 >> From: Naphtali Sprei >> Date: Mon, 12 Oct 2009 14:25:25 +0200 >> Subject: [PATCH] Added readonly flag to -drive command. >> This enables sharing same image between guests, with readonly access. >> Implementaion mark the drive as read_only and changes the flags when actually opening the file. >> > > Is this enough? Basically none of the block drivers know that their > image could be read-only, so we'll likely trigger some unexpected error > cases there. For a simple write I guess we'll be okay (not sure if we'll > return the right error code, though), but I have no idea what, say, > savevm would do with a read-only image. > Yes, this is why patches like this have been rejected in the past. This concept needs to be plumbed to the device emulation so that a guest realizes it has a read-only disk. Throwing away writes without telling the guest is a recipe for disaster. Regards, Anthony Liguori