Received: from [140.186.70.92] (port=33577 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLvO2-0004AB-6V for qemu-devel@nongnu.org; Tue, 08 Jun 2010 05:46:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLvJV-0006P9-Gb for qemu-devel@nongnu.org; Tue, 08 Jun 2010 05:41:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17499) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLvJV-0006Oy-8g for qemu-devel@nongnu.org; Tue, 08 Jun 2010 05:41:41 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o589fegj015301 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Jun 2010 05:41:40 -0400 From: Markus Armbruster References: <4C0B5B0C.2090403@redhat.com> Date: Tue, 08 Jun 2010 11:41:37 +0200 In-Reply-To: <4C0B5B0C.2090403@redhat.com> (Avi Kivity's message of "Sun, 06 Jun 2010 11:23:40 +0300") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: RFC: blockdev_add & friends, brief rationale, QMP docs List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Kevin Wolf , Christoph Hellwig , qemu-devel@nongnu.org, Luiz Capitulino , Gerd Hoffmann Avi Kivity writes: > On 06/04/2010 05:16 PM, Markus Armbruster wrote: >> - "protocol": json-array of json-object >> Each element object has a member "name" >> - Possible values: "file", "nbd", ... >> Additional members depend on the value of "name". >> For "name" = "file": >> - "file": file name (json-string) >> For "name" = "nbd": >> - "domain": address family (json-string, optional) >> - Possible values: "inet" (default), "unix" >> - "file": file name (json-string), only with "domain" = "unix" >> - "host": host name (json-string), only with "domain" = "inet" >> - "port": port (json-int), only with "domain" = "inet" >> ... >> >> > > This loses the nesting that protocols have. I'd like to see the each > nested protocol as member of the parent protocol. Besides the lovely > } } }s in the json representation, this allows us to have more > complicated protocols, for example a mirror protocol that has two > child protocol each specifying a different backing store. Even though we don't have such a protocol yet, not even plans to get it, your argument tips the balance towards nesting. Revised sketch: instead of - "file": the disk image file to use (json-string, optional) - "format": disk format (json-string, optional) - Possible values: "raw", "qcow2", ... have - "format": image format (json-string, optional) - Possible values: "raw", "qcow2", [...] - "protocol": image access protocol (json-object) - It has a member "name" (json-string), and depending on its value additional members. - For "name" = "auto", "file", [...] - "file": name of image file (json-string) - For "name" = "nbd": - "domain": address family (json-string, optional) - Possible values: "inet" (default), "unix" - "file": name of socket file (json-string), only with "domain" = "unix" - "host": host name (json-string), only with "domain" = "inet" - "port": port (json-int), only with "domain" = "inet" - For "name" = "blkdebug": - "config": name of config file (json-string) - "protocol": image access protocol (json-object), as above [...] Examples: * Format "qcow2", protocol "auto" with argument filename "foo.img" "format": "qcow2", "protocol": { "name": "auto", "file": "foo.qcow2" } * Format "raw", protocol "nbd" with arguments domain "unix", filename "/tmp/my_socket" "format": "raw" "protocol": { "name": "nbd", "domain": "unix", "file": "/tmp/my_socket" } * Format not specified (system guesses one), protocol "blkdebug" with argument filename "/tmp/blkdebug.cfg" stacked onto protocol "fat" with arguments floppy true, dirname "/tmp/dir" "protocol": { "name": "blkdebug", "file": "/tmp/blkdebug.cfg", "protocol": { "name": "fat", "floppy": true, "dir": "/tmp/dir" } } This nesting business is easy enough for QMP, but it'll be awkward on the command line. Ideas on how to do it cleanly with -blockdev?