blockdev-mirror , how to replace old nodename by new nodename ?
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.
qemu command line (vm-138-disk-1.qcow2 filename on "drive-virtio0" nodename:
-blockdev {"node-name":"drive-virtio0","cache":{"direct":true},"driver":"qcow2","file":{"filename":"/var/lib/vz/images/138/vm-138-disk-1.qcow2","aio":"threads","driver":"file"}} -device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,write-cache=on
add a new blockdev with blockdev-add: (a file vm-138-disk-2.raw has been created before, I assign it to a "tempmirror" nodename)
{"arguments":{"driver":"raw","cache":{"direct":true},"node-name":"tempmirror","file":{"driver":"file","aio":"threads","filename":"/var/lib/vz/images/138/vm-138-disk-2.raw"}},"execute":"blockdev-add"}
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.
Any idea ?
Regards,
Alexandre
[query-named-block-nodes","arguments":{}
$VAR1 = [
{
'bps_wr' => 0,
'cache' => {
'no-flush' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
'direct' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
'writeback' => $VAR1->[0]{'cache'}{'direct'}
},
'bps' => 0,
'iops' => 0,
'node-name' => 'toto',
'ro' => $VAR1->[0]{'cache'}{'no-flush'},
'image' => {
'actual-size' => 1074794496,
'filename' => '/var/lib/vz/images/138/vm-138-disk-2.raw',
'dirty-flag' => $VAR1->[0]{'cache'}{'no-flush'},
'format' => 'raw',
'virtual-size' => 1073741824
},
'write_threshold' => 0,
'iops_rd' => 0,
'bps_rd' => 0,
'encrypted' => $VAR1->[0]{'cache'}{'no-flush'},
'encryption_key_missing' => $VAR1->[0]{'cache'}{'no-flush'},
'backing_file_depth' => 0,
'detect_zeroes' => 'off',
'file' => '/var/lib/vz/images/138/vm-138-disk-2.raw',
'drv' => 'raw',
'iops_wr' => 0
},
{
'ro' => $VAR1->[0]{'cache'}{'no-flush'},
'node-name' => '#block132',
'file' => '/var/lib/vz/images/138/vm-138-disk-2.raw',
'detect_zeroes' => 'off',
'iops_wr' => 0,
'drv' => 'file',
'iops_rd' => 0,
'bps_rd' => 0,
'image' => {
'actual-size' => 1074794496,
'filename' => '/var/lib/vz/images/138/vm-138-disk-2.raw',
'dirty-flag' => $VAR1->[0]{'cache'}{'no-flush'},
'virtual-size' => 1073741824,
'format' => 'file'
},
'write_threshold' => 0,
'backing_file_depth' => 0,
'encryption_key_missing' => $VAR1->[0]{'cache'}{'no-flush'},
'encrypted' => $VAR1->[0]{'cache'}{'no-flush'},
'bps_wr' => 0,
'bps' => 0,
'iops' => 0,
'cache' => {
'no-flush' => $VAR1->[0]{'cache'}{'no-flush'},
'direct' => $VAR1->[0]{'cache'}{'direct'},
'writeback' => $VAR1->[0]{'cache'}{'direct'}
}
},
{
'drv' => 'qcow2',
'iops_wr' => 0,
'detect_zeroes' => 'off',
'file' => '/var/lib/vz/images/138/vm-138-disk-1.qcow2',
'encrypted' => $VAR1->[0]{'cache'}{'no-flush'},
'encryption_key_missing' => $VAR1->[0]{'cache'}{'no-flush'},
'backing_file_depth' => 0,
'image' => {
'cluster-size' => 65536,
'virtual-size' => 1073741824,
'format-specific' => {
'type' => 'qcow2',
'data' => {
'corrupt' => $VAR1->[0]{'cache'}{'no-flush'},
'compat' => '1.1',
'lazy-refcounts' => $VAR1->[0]{'cache'}{'no-flush'},
'refcount-bits' => 16
}
},
'format' => 'qcow2'
},
'write_threshold' => 0,
'bps_rd' => 0,
'iops_rd' => 0,
'ro' => $VAR1->[0]{'cache'}{'no-flush'},
'node-name' => 'drive-virtio0',
'bps' => 0,
'iops' => 0,
'cache' => {
'writeback' => $VAR1->[0]{'cache'}{'direct'},
'no-flush' => $VAR1->[0]{'cache'}{'no-flush'},
'direct' => $VAR1->[0]{'cache'}{'direct'}
},
'bps_wr' => 0
},
{
'detect_zeroes' => 'off',
'file' => '/var/lib/vz/images/138/vm-138-disk-1.qcow2',
'drv' => 'file',
'iops_wr' => 0,
'write_threshold' => 0,
'image' => {
'format' => 'file',
'virtual-size' => 1074135040,
'dirty-flag' => $VAR1->[0]{'cache'}{'no-flush'},
'filename' => '/var/lib/vz/images/138/vm-138-disk-1.qcow2',
'actual-size' => 1075130368
},
'bps_rd' => 0,
'iops_rd' => 0,
'encryption_key_missing' => $VAR1->[0]{'cache'}{'no-flush'},
'encrypted' => $VAR1->[0]{'cache'}{'no-flush'},
'backing_file_depth' => 0,
'ro' => $VAR1->[0]{'cache'}{'no-flush'},
'node-name' => '#block071',
'bps' => 0,
'iops' => 0,
'cache' => {
'writeback' => $VAR1->[0]{'cache'}{'direct'},
'no-flush' => $VAR1->[0]{'cache'}{'no-flush'},
'direct' => $VAR1->[0]{'cache'}{'direct'}
},
'bps_wr' => 0
}
];Quoted 22 lines · Alexandre DERUMIER
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.
qemu command line (vm-138-disk-1.qcow2 filename on "drive-virtio0" nodename:
(quoted diff) +0
-2-blockdev {"node-name":"drive-virtio0","cache":{"direct":true},"driver":"qcow2","file":{"filename":"/var/lib/vz/images/138/vm-138-disk-1.qcow2","aio":"threads","driver":"file"}} -device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,write-cache=onadd a new blockdev with blockdev-add: (a file vm-138-disk-2.raw has been created before, I assign it to a "tempmirror" nodename)
{"arguments":{"driver":"raw","cache":{"direct":true},"node-name":"tempmirror","file":{"driver":"file","aio":"threads","filename":"/var/lib/vz/images/138/vm-138-disk-2.raw"}},"execute":"blockdev-add"}
blockdev-mirror:
Quoted 8 lines
{"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.
The replace/switch happens when you do block-job-complete.
And I think in your use case "replaces" is not needed. That one is for replacing a node under quorum
Fam
Ok thanks.
I'll retry without replaces, but I'm pretty sure It was not working too.
Also, I notice something strange,
when I define the job-id (which is mandatory), it's replace the device option. (If I set a random job-id name, the mirroring is not working because it don't find the device).
----- Mail original -----
De: "Fam Zheng" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 11:02:36
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?
Quoted 22 lines · Alexandre DERUMIER
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.
qemu command line (vm-138-disk-1.qcow2 filename on "drive-virtio0" nodename:
(quoted diff) +0
-2-blockdev {"node-name":"drive-virtio0","cache":{"direct":true},"driver":"qcow2","file":{"filename":"/var/lib/vz/images/138/vm-138-disk-1.qcow2","aio":"threads","driver":"file"}} -device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,write-cache=onadd a new blockdev with blockdev-add: (a file vm-138-disk-2.raw has been created before, I assign it to a "tempmirror" nodename)
{"arguments":{"driver":"raw","cache":{"direct":true},"node-name":"tempmirror","file":{"driver":"file","aio":"threads","filename":"/var/lib/vz/images/138/vm-138-disk-2.raw"}},"execute":"blockdev-add"}
blockdev-mirror:
Quoted 8 lines
{"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.
The replace/switch happens when you do block-job-complete.
And I think in your use case "replaces" is not needed. That one is for replacing a node under quorum
Fam
Quoted 8 lines · Alexandre DERUMIER
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.
[...]
Quoted 10 lines
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"}}
-----------------------------------------------------------------------[...]
Signature · 1 line
/kashyap
Thanks I'll try. (I'm on 2.9.0-rc4)
can you send your initial qemu command line ?
also :
Quoted 4 lines
Quoted 4 lines
"execute":"blockdev-add",
"arguments":{
"driver":"qcow2",
"node-name":"node1",
...
then
Quoted 6 lines
Quoted 6 lines
"execute":"blockdev-mirror",
"arguments":{
"device":"foo",
"job-id":"job-2",
"target":"node2", --> node2 ?
"sync":"full"
----- Mail original -----
De: "Kashyap Chamarthy" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 12:43:00
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?
Quoted 8 lines · Alexandre DERUMIER
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.
[...]
Quoted 10 lines
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"}}
----------------------------------------------------------------------- [...]
Signature · 1 line
/kashyap
Quoted 3 lines · Alexandre DERUMIER
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
Quoted 6 lines
also :
Quoted 4 lines
Quoted 4 lines
"execute":"blockdev-add",
"arguments":{
"driver":"qcow2",
"node-name":"node1",
Oops, it should be 'node2'. Copy / paste mistake, sorry.
Quoted 11 lines
...
then
Quoted 6 lines
Quoted 6 lines
"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
Quoted 93 lines
----- Mail original -----
De: "Kashyap Chamarthy" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 12:43:00
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?Quoted 8 lines · Alexandre DERUMIER
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.
[...]
Quoted 10 lines
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"}} -----------------------------------------------------------------------[...]
Signature · 1 line
/kashyap
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" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 14:58:01
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?
Quoted 3 lines · Alexandre DERUMIER
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
Quoted 6 lines
also :
Quoted 4 lines
Quoted 4 lines
"execute":"blockdev-add",
"arguments":{
"driver":"qcow2",
"node-name":"node1",
Oops, it should be 'node2'. Copy / paste mistake, sorry.
Quoted 11 lines
...
then
Quoted 6 lines
Quoted 6 lines
"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
Quoted 93 lines
----- Mail original -----
De: "Kashyap Chamarthy" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 12:43:00
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?Quoted 8 lines · Alexandre DERUMIER
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.
[...]
Quoted 10 lines
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"}} -----------------------------------------------------------------------[...]
Signature · 1 line
/kashyap
Quoted 1 line
Quoted 1 line
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" <[email protected]>
À: "Kashyap Chamarthy" <[email protected]>
Cc: "qemu-devel" <[email protected]>
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" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 14:58:01
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?
Quoted 3 lines · Alexandre DERUMIER
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
Quoted 6 lines
also :
Quoted 4 lines
Quoted 4 lines
"execute":"blockdev-add",
"arguments":{
"driver":"qcow2",
"node-name":"node1",
Oops, it should be 'node2'. Copy / paste mistake, sorry.
Quoted 11 lines
...
then
Quoted 6 lines
Quoted 6 lines
"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
Quoted 93 lines
----- Mail original -----
De: "Kashyap Chamarthy" <[email protected]>
À: "aderumier" <[email protected]>
Cc: "qemu-devel" <[email protected]>
Envoyé: Mercredi 19 Avril 2017 12:43:00
Objet: Re: [Qemu-devel] blockdev-mirror , how to replace old nodename by new nodename ?Quoted 8 lines · Alexandre DERUMIER
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.
[...]
Quoted 10 lines
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"}} -----------------------------------------------------------------------[...]
Signature · 1 line
/kashyap