>>What I don't understand is how do you map device to the blockdev ? Ah,ok, got it.
info qtree show me that device drive is now the new nodename ! So it's working fine. Thanks for help. ----- Mail original ----- De: "aderumier" <aderum...@odiso.com> À: "Kashyap Chamarthy" <kcham...@redhat.com> Cc: "qemu-devel" <qemu-devel@nongnu.org> Envoyé: Mercredi 19 Avril 2017 15:36:48 Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ? Ok, I have same result than my test: {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 1073741824, "filename": "base.raw", "format": "raw", "actual-size": 0, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "node1", "backing_file_depth": 0, "drv": "raw", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "base.qcow2, "encryption_key_missing": false}, {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 1073741824, "filename": "base.qcow2", "format": "file", "actual-size": 0, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "#block194", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "base.qcow2", "encryption_key_missing": false}, {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 1073741824, "filename": "target.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 352256, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "foo", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "target.qcow2", "encryption_key_missing": false}, {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 1074135040, "filename": "target.qcow2", "format": "file", "actual-size": 352256, "dirty-flag": false}, "iops_wr": 0, "ro": false, "node-name": "#block008", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "target.qcow2", "encryption_key_missing": false}]} What I don't understand is how do you map device to the blockdev ? qemu doc said something like -device virtio-blk,drive=blk0 where blk0 is the nodename. but when I blockdev-mirror, the target blockdev has a new nodename. So how does it work ? ----- Mail original ----- De: "Kashyap Chamarthy" <kcham...@redhat.com> À: "aderumier" <aderum...@odiso.com> Cc: "qemu-devel" <qemu-devel@nongnu.org> Envoyé: Mercredi 19 Avril 2017 14:58:01 Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ? On Wed, Apr 19, 2017 at 02:28:46PM +0200, Alexandre DERUMIER wrote: > Thanks I'll try. (I'm on 2.9.0-rc4) > > can you send your initial qemu command line ? $ ~/build/qemu-upstream/x86_64-softmmu/qemu-system-x86_64 \ -display none -nodefconfig -nodefaults -m 512 \ -device virtio-scsi-pci,id=scsi -device virtio-serial-pci \ -blockdev node-name=foo,driver=qcow2,file.driver=file,file.filename=./base.qcow2 \ -monitor stdio -qmp unix:./qmp-sock,server,nowait > also : > > >>"execute":"blockdev-add", > >>"arguments":{ > >>"driver":"qcow2", > >>"node-name":"node1", Oops, it should be 'node2'. Copy / paste mistake, sorry. > ... > > then > > > >>"execute":"blockdev-mirror", > >>"arguments":{ > >>"device":"foo", > >>"job-id":"job-2", > >>"target":"node2", --> node2 ? > >>"sync":"full" With the above copy / paste error I noted in the `blockdev-add` command, the commands I noted in my previous email should work as expected. Regards, Kashyap > ----- Mail original ----- > De: "Kashyap Chamarthy" <kcham...@redhat.com> > À: "aderumier" <aderum...@odiso.com> > Cc: "qemu-devel" <qemu-devel@nongnu.org> > Envoyé: Mercredi 19 Avril 2017 12:43:00 > Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new > nodename ? > > On Wed, Apr 19, 2017 at 09:08:20AM +0200, Alexandre DERUMIER wrote: > > Hi, > > > > I'm trying to implement blockdev-mirror, to replace drive-mirror as we > > can pass more options with blockdev-mirror. > > > > > > I would like to mirror an attached blockdev to a new blockdev, then > > switch at the end of block-job-complete, like for drive-mirror. > > [...] > > > blockdev-mirror: > > > > {"arguments":{"job-id":"drive-virtio0","target":"tempmirror","sync":"full","replaces":"drive-virtio0","device":"drive-virtio0"},"execute":"blockdev-mirror"} > > > > > > (I have try with or without replaces option) > > > > then query-name-block-nodes, show vm-138-disk-2.raw file on tempmirror > > "node-name", and vm-138-disk1.qcow2 on "drive-virtio0" node-name > > > > I expected that both was switched, like for drive-mirror. > > For me, 'blockdev-mirror' does do the switch when I issue > 'block-job-complete' (similar to 'drive-mirror') > > The below is my test from Git: > > I was here (on Git): > > $ git describe > v2.9.0-rc5 > > ----------------------------------------------------------------------- > $ qemu-img create -f qcow2 /export/target2.qcow2 1G > Formatting '/export/target2.qcow2', fmt=qcow2 size=1073741824 encryption=off > cluster_size=65536 lazy_refcounts=off refcount_bits=16 > ----------------------------------------------------------------------- > QMP> > { > "execute":"blockdev-add", > "arguments":{ > "driver":"qcow2", > "node-name":"node1", > "file":{ > "driver":"file", > "filename":"/export/target2.qcow2" > } > } > } > {"return": {}} > ----------------------------------------------------------------------- > QMP> > {"execute":"query-named-block-nodes"} > [...] > ----------------------------------------------------------------------- > QMP> > { > "execute":"blockdev-mirror", > "arguments":{ > "device":"foo", > "job-id":"job-2", > "target":"node2", > "sync":"full" > } > } > {"return": {}} > {"timestamp": {"seconds": 1492598410, "microseconds": 35946}, "event": > "BLOCK_JOB_READY", "data": {"device": "job-2", "len": 24182784, "offset": > 24182784, "speed": 0, "type": "mirror"}} > ----------------------------------------------------------------------- > QMP> > { > "execute":"block-job-complete", > "arguments":{ > "device":"job-2" > } > } > {"return": {}} > {"timestamp": {"seconds": 1492598419, "microseconds": 115458}, "event": > "BLOCK_JOB_COMPLETED", "data": {"device": "job-2", "len": 24182784, "offset": > 24182784, "speed": 0, "type": "mirror"}} > ----------------------------------------------------------------------- > > > [...] > > > -- > /kashyap >