Received: from eggs.gnu.org ([2001:4830:134:3::10]:57131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VN2V2-0007bY-El for qemu-devel@nongnu.org; Fri, 20 Sep 2013 11:20:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VN2Uw-00039k-Fc for qemu-devel@nongnu.org; Fri, 20 Sep 2013 11:20:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VN2Uw-00039e-7L for qemu-devel@nongnu.org; Fri, 20 Sep 2013 11:19:58 -0400 Date: Fri, 20 Sep 2013 16:26:21 +0200 From: Kevin Wolf Message-ID: <20130920142621.GH2800@dhcp-200-207.str.redhat.com> References: <20130917124413.GA822@stefanha-thinkpad.str.redhat.com> <20130918150527.GA5025@irqsave.net> <20130919082653.GC22814@stefanha-thinkpad.redhat.com> <20130919085750.GA3631@dhcp-200-207.str.redhat.com> <20130919125536.GA12498@irqsave.net> <20130919132146.GB3631@dhcp-200-207.str.redhat.com> <20130919133818.GB12498@irqsave.net> <20130919142354.GC3631@dhcp-200-207.str.redhat.com> <20130920120849.GA2872@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20130920120849.GA2872@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Merging the quorum block driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Stefan Hajnoczi Am 20.09.2013 um 14:08 hat Beno=EEt Canet geschrieben: > Le Thursday 19 Sep 2013 =E0 16:23:54 (+0200), Kevin Wolf a =E9crit : > > Am 19.09.2013 um 15:38 hat Beno=EEt Canet geschrieben: > > > Le Thursday 19 Sep 2013 =E0 15:21:46 (+0200), Kevin Wolf a =E9crit = : > > > > Am 19.09.2013 um 14:55 hat Beno=EEt Canet geschrieben: > > > > > Le Thursday 19 Sep 2013 =E0 10:57:50 (+0200), Kevin Wolf a =E9c= rit : > > > > > > Am 19.09.2013 um 10:26 hat Stefan Hajnoczi geschrieben: > > > > > > > On Wed, Sep 18, 2013 at 05:05:27PM +0200, Beno=EEt Canet wr= ote: > > > > > > > > Le Tuesday 17 Sep 2013 =E0 14:44:13 (+0200), Stefan Hajno= czi a =E9crit : > > > > > > > > > Hi Benoit, > > > > > > > > > Kevin and I had a chance to chat face-to-face and we di= scussed what > > > > > > > > > concrete changes are necessary to merge quorum (without= solving all the > > > > > > > > > other block layers problems at once). > > > > > > > > > > > > > > > > > > I think quorum could be merged relatively quickly (and = without massive > > > > > > > > > BlockFilter investments) by changing the following: > > > > > > > > > > > > > > > > > > 1. Defining children on the command-line > > > > > > > > > > > > > > > > > > Existing "filter" drivers use the protocol filename to = embed their > > > > > > > > > children, for example the blkverify driver. This is a = big hack because > > > > > > > > > we have no proper syntax or escaping for the embedded d= rive definitions > > > > > > > > > in the file=3D option. > > > > > > > > > > > > > > > > > > This was one of the main arguments against merging quor= um. Now that > > > > > > > > > Kevin has implemented driver-specific open options (see > > > > > > > > > block/qcow2.c:qcow2_runtime_opts), it is possible for t= he quorum driver > > > > > > > > > to open children specific on the command-line: > > > > > > > > > > > > > > > > > > -drive if=3Dnone,file.driver=3Dquorum,format=3Draw,\ > > > > > > > > > file.children0.file=3D/nfs1/test.qcow2,\ > > > > > > > > > file.children1.file=3D/nfs2/test.qcow2,\ > > > > > > > > > file.children2.file=3D/nfs3/test.qcow2 > > > > > > > > > > > > By the way, I think he concrete syntax might have to be a bit= different > > > > > > so it can be mapped to QAPI for blockdev-add. I think we'll w= ant to use > > > > > > a JSON list for the children; a mapping to QDict and to the c= ommand line > > > > > > is yet to be implemented I guess. > > > > > > > > > > Hi, > > > > > > > > > > Just to make sure I'll code the right thing; is the following c= orrect ? > > > > > > > > > > -drive if=3Dnone,file.driver=3Dquorum,format=3Draw,\ > > > > > file.children=3D[/nfs1/test.qcow2, /nfs2/test.qcow2, /nf= s3/test.qcow2], \ > > > > > file.vote_threshold=3D2 > > > > > > > > I was thinking more along the lines of: > > > > > > > > -drive if=3Dnone,file.driver=3Dquorum,format=3Draw,\ > > > > file.children[0].file.filename=3D/nfs1/test.qcow2, \ > > > > file.children[1].file.filename=3D/nfs2/test.qcow2, \ > > > > file.children[1].file.cache.direct=3Don, \ > > > > file.children[2].file.driver=3Dnbd, \ > > > > file.children[2].file.host=3Dlocalhost, \ > > > > file.vote_threshold=3D2 > > > > > > > > The exact syntax doesn't matter all that much as long as it can b= e > > > > mapped to QAPI, but as you can see this allows specifying detaile= d > > > > options even for the children. I think this is a requirement. > > > > > > So does it mean that on top of your blockdev branch qemu_opts_to_qd= ict should do > > > a little parsing of opt->name to regroup options of the same childr= en together ? > > > > > > e.g: converting the incoming qoption into the qdict equivalent of: > > > dict =3D { "driver": "quorum", > > > "children[0]": "file.filename=3D/nfs1/test.qcow2", > > > "children[1]": "file.filename=3D/nfs2/test.qcow2,file.cach= e.direct=3Don", > > > "children[2]": "file.driver=3Dnbd,file.host=3Dlocalhost", > > > "vote_threshold": 2 } > > > > No, the qdict is supposed to be completely flat. I think there are tw= o > > parts to it: > > > > 1. Extend qdict_flatten() so that it converts QLists into an array > > representation. The resulting qdict should look pretty much like t= he > > command line: > > > > dict =3D { "driver": "quorum", > > "children[0].file.filename": "/nfs1/test.qcow2", > > "children[1].file.filename": "/nfs2/test.qcow2", > > "children[1].file.cache.direct": "on", > > "children[2].file.driver": "nbd", > > "children[2].file.host": "localhost", > > "vote_threshold": 2 } > > > > 2. The option parsing code in quorum must find a way to walk this > > flattened children array. Basically it will end up checking if > > the keys start with a "children[%d]", and if so, use > > extract_subqdict() to get the full array element back. >=20 > I made this. > The block driver complains that no filename is provided at startup. > --- > } else if (!drv->bdrv_parse_filename && !filename) { > qerror_report(ERROR_CLASS_GENERIC_ERROR, > "The '%s' block driver requires a file name", > drv->format_name); > ret =3D -EINVAL; > goto fail; > } > ---- >=20 > How can I write a patch to fix this ? There's a hidden assumption here: All drivers that support driver-specific options have drv->bdrv_parse_filename implemented. This isn't true for quorum, obviously, so the condition doesn't work here any more. Perhaps introduce a bool drv->bdrv_needs_filename to be checked here instead of drv->bdrv_parse_filename? Kevin