Received: from [140.186.70.92] (port=51347 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPVzX-0000p9-4c for qemu-devel@nongnu.org; Fri, 18 Jun 2010 03:27:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPVzV-0006rB-Sm for qemu-devel@nongnu.org; Fri, 18 Jun 2010 03:27:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45962) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPVzV-0006r7-IV for qemu-devel@nongnu.org; Fri, 18 Jun 2010 03:27:53 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] RFC v3: blockdev_add & friends, brief rationale, QMP docs References: Date: Fri, 18 Jun 2010 09:27:48 +0200 In-Reply-To: (Stefan Hajnoczi's message of "Thu, 17 Jun 2010 20:40:06 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Christoph Hellwig , qemu-devel@nongnu.org, Luiz Capitulino , Avi Kivity , Gerd Hoffmann Stefan Hajnoczi writes: > On Thu, Jun 17, 2010 at 1:49 PM, Markus Armbruster wr= ote: >> Stefan Hajnoczi writes: >> >>> On Wed, Jun 16, 2010 at 6:27 PM, Markus Armbruster = wrote: >>>> blockdev_add >>>> ------------ >>>> >>>> Add host block device. >>>> >>>> Arguments: >>>> >>>> - "id": the host block device's ID, must be unique (json-string) >>>> - "format": image format (json-string, optional) >>>> =C2=A0 =C2=A0- Possible values: "raw", "qcow2", ... >>> >>> What is the default when unset? =C2=A0(I expect we'll auto-detect the >>> format but this should be documented.) >> >> For command line and human monitor, we definitely want a sensible >> default. =C2=A0I sketched one in section "Command line syntax". =C2=A0I'= ll quote >> it for your convenience a few lines down. > > Ahem...the part that I skipped over ;). I should have read your > entire email, thanks for pointing it out. :) >> To let users ask for this explicitely, we could have pseudo-format >> "auto". >> >> We also need a pseudo-format "probe", which guesses the format from the >> image contents. =C2=A0Can't be made the default, because it's insecure. > > In which scenario is probing the image format a security issue? I'm > trying to think up scenarios where a cloud user modifies the guest > disk image and gets QEMU to re-open the image file as another format, > perhaps this would make the cloud owner/admin unhappy. I don't see a > threat except for image format drivers have security bugs (corrupt > images leading to arbitrary code execution). User creates a raw image file. VM starts. Image file gets probed, it's raw. Guest has access to the complete file. Guest writes a valid QCOW2 image to it, chosen to include the full backing file in the resulting image contents. Set the backing file to /secret/treasure. Reboot VM. Image file gets probed, it's qcow2. Backing file gets probed, it's raw. Guest has access to the contents of QCOW2 image. This includes the backing file. Oops. >>>> (2) It's possible to list supported disk formats and protocols by >>>> =C2=A0 =C2=A0running QEMU with arguments "-blockdev_add \?". >>> >>> Is there an query-block-driver command or something in QMP to >>> enumerate supported formats and protocols? =C2=A0Not sure how useful th= is >>> would be to the management stack - blockdev_add will probably return >>> an error if an attempt is made to open an unsupported file. >> >> QMP should be "self-documenting": a client should be able to list >> commands, their arguments, and possible argument values. =C2=A0Listing >> supported formats then becomes "list possible values of command >> blockdev_add's argument format". > > Nice :). We still need to deliver the niceties... >>>> blockdev_del >>>> ------------ >>>> >>>> Remove a host block device. >>>> >>>> Arguments: >>>> >>>> - "id": the host block device's ID (json-string) >>>> >>>> Example: >>>> >>>> -> { "execute": "blockdev_del", "arguments": { "id": "blk1" } } >>>> <- { "return": {} } >>> >>> What about an attached guest device? =C2=A0Will this fail if the virtio= -blk >>> PCI device is still present? =C2=A0For SCSI I imagine we can usually ju= st >>> remove the host block device. =C2=A0For IDE there isn't hotplug support >>> AFAIK, what happens? >> >> Command fails. =C2=A0You have to device_del the device first. =C2=A0Whic= h is only >> possible if its bus supports hot-plug. > > I think this deserves to be in the documentation. Yes, QMP documentation should cover errors. It generally doesn't so far.