From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgCnx-0001sd-5Z for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:15:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgCnr-0007cN-1j for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:15:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgCnq-0007cG-P8 for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:15:14 -0400 Message-ID: <54450AD7.8000901@redhat.com> Date: Mon, 20 Oct 2014 15:15:03 +0200 From: Max Reitz MIME-Version: 1.0 References: <1413785643-20336-1-git-send-email-pl@kamp.de> <5444CED9.8070402@redhat.com> <5444D28F.4010005@kamp.de> <5444D57C.6080409@redhat.com> <5444DDF4.40800@kamp.de> <5444F730.4000003@redhat.com> <5444FD07.6030702@kamp.de> <5444FDBE.9060501@redhat.com> <54450491.7060506@kamp.de> In-Reply-To: <54450491.7060506@kamp.de> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block: add a knob to disable multiwrite_merge List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, armbru@redhat.com, stefanha@redhat.com On 20.10.2014 at 14:48, Peter Lieven wrote: > On 20.10.2014 14:19, Max Reitz wrote: >> On 2014-10-20 at 14:16, Peter Lieven wrote: >>> On 20.10.2014 13:51, Max Reitz wrote: >>>> On 2014-10-20 at 12:03, Peter Lieven wrote: >>>> [...] >>> >>> Can you further help here. I think my problem was that I don't have >>> access to the commandline options in bdrv_open?! >> >> You do. It's the "options" QDict. :-) > > Maybe I just don't get it. > > If I specify > > qemu -drive if=virtio,file=image.qcow2,write-merging=off > > and check with > > qdict_get_try_bool(options, "write-merging", true); > > in bdrv_open() directly before bdrv_swap I always get true. Hm, judging from fprintf(stderr, "%s\n", qstring_get_str(qobject_to_json_pretty(QOBJECT(options))));, it's there for me (directly after qdict_del(options, "node-name"). The output is: Qemu wrote: > { > "filename": "image.qcow2" > } > { > "write-merging": "off" > } > qemu-system-x86_64: -drive > if=virtio,file=image.qcow2,write-merging=off: could not open disk > image image.qcow2: Block format 'qcow2' used by device 'virtio0' > doesn't support the option 'write-merging' But as you can see, it's a string and not a bool. So the problem is that there are (at least) two parameter "types" in qemu: One is just giving a QDict, and the other are QemuOpts. QDicts are just the raw user input and the user can only input strings, so everything is just a string. As far as I know, typing everything correctly is done by converting the QDict to a QemuOpts object (as you can see in generally every block driver which supports some options (e.g. qcow2) and also in blockdev_init(), it's qemu_opts_absorb_qdict()). Sooo, right, I forgot that. Currently, there are no non-string non-block-driver-specific options for mid-tree BDS (in contrast to the root BDS, which are parsed in blockdev_init()), so you now have the honorable task of introducing such a QemuOptsList along with qemu_opts_absorb_qdict() and everything to bdrv_open_common(). *cough* Max