From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zs2aE-0002gF-7Q for qemu-devel@nongnu.org; Fri, 30 Oct 2015 01:50:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zs2aC-0005UC-Ui for qemu-devel@nongnu.org; Fri, 30 Oct 2015 01:50:38 -0400 References: <1443161858-20533-1-git-send-email-wency@cn.fujitsu.com> <1443161858-20533-2-git-send-email-wency@cn.fujitsu.com> <56181072.1020805@redhat.com> From: Wen Congyang Message-ID: <563304CD.8040201@cn.fujitsu.com> Date: Fri, 30 Oct 2015 13:49:01 +0800 MIME-Version: 1.0 In-Reply-To: <56181072.1020805@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v10 01/10] allow writing to the backing file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu devel , Fam Zheng , Max Reitz , Paolo Bonzini , Stefan Hajnoczi Cc: Kevin Wolf , zhanghailiang , qemu block , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , "Michael R. Hines" , Gonglei , Yang Hongyang On 10/10/2015 03:07 AM, Eric Blake wrote: > On 09/25/2015 12:17 AM, Wen Congyang wrote: >> For block replication, we have such backing chain: >> secondary disk <-- hidden disk <-- active disk >> secondary disk is top BDS(use bacing reference), so it can be opened in > > s/BDS(use bacing/BDS (use backing/ > >> read-write mode. But hidden disk is read only, and we need to write to >> hidden disk(backup job will write data to it). > > s/disk(/disk (/ > >> >> TODO: support opening backing file in read-write mode if the BDS is >> created by QMP command blockdev-add. >> >> Signed-off-by: Wen Congyang >> Signed-off-by: zhanghailiang >> Signed-off-by: Gonglei >> --- >> block.c | 41 ++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 40 insertions(+), 1 deletion(-) >> > > I really don't like this patch. We are able to automatically (re-)open > backing files for write during block-commit, without having to expose a > knob to the user then, so exposing a knob to the user here feels wrong. I try to reopen the backing files for write when starting block replication. I tested it, and it doesn't work. Here is my usage: command line: -drive if=none,id=colo-disk1,file.filename=/data/images/kvm/suse/temp.img,driver=raw -drive if=virtio,id=active-disk1,driver=replication,mode=secondary,file.driver=qcow2,file.file.filename=/mnt/ramfs/active_disk.img,file.backing.driver=qcow2,file.backing.file.filename=/mnt/ramfs/hidden_disk.img,file.backing.backing.file.filename=/data/images/kvm/suse/suse11_3.img,file.backing.backing.driver=raw,file.backing.backing.node-name=sdisk {'execute': 'blockdev-remove-medium', 'arguments': {'device': 'colo-disk1'} } {'execute': 'blockdev-insert-medium', 'arguments': {'device': 'colo-disk1', 'node-name': 'sdisk'} } {'execute': 'nbd-server-start', 'arguments': {'addr': {'type': 'inet', 'data': {'host': '192.168.3.1', 'port': '8889'} } } } {'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk1', 'writable': true } } All qmp command success, but the disk exported to nbd server is readonly even if I specify 'writable': true in the QMP commad. The reason is that the BDS is readonly. > >> +#define ALLOW_WRITE_BACKING_FILE "allow-write-backing-file" >> +static QemuOptsList backing_file_opts = { >> + .name = "backing_file", >> + .head = QTAILQ_HEAD_INITIALIZER(backing_file_opts.head), >> + .desc = { >> + { >> + .name = ALLOW_WRITE_BACKING_FILE, >> + .type = QEMU_OPT_BOOL, >> + .help = "allow writes to backing file", >> + }, > > And even if we DO need this knob (which I doubt), you need corresponding > documentation of the knob in qapi/block-core.json, since we are trying > to keep the command line and QMP in sync when it comes to adding new > options. > Yes, I know it, but I don't know how to do it. Update BlockdevOptions? Thanks Wen Congyang