On Tue, Apr 21, 2015 at 03:53:11PM +0200, Kashyap Chamarthy wrote: [. . .]
> And, invoking `drive-backup` *without* pre-creating the target image > (i.e. 'incremental.o.img'): > > { 'execute': 'drive-backup', > 'arguments': { > 'device': 'ide0-0-0', > 'bitmap': 'bitmap0', > 'sync': 'dirty-bitmap', > 'target': 'incremental.0.img', > 'mode': 'existing', > 'format': 'qcow2' > } > } > > Results in: > > {"QMP": {"version": {"qemu": {"micro": 93, "minor": 2, "major": 2}, > "package": ""}, "capabilities": []}} {"return": {}} > > Instead of an "error". Is this a bug? Answering myself, no, it's not. I learnt from John Snow and Eric Blake that I needed additional 'reads' to see event lines in my trivial QMP shell script[1] -- "because QEMU sends events as the job makes progress, when you first connect, the qemu sends a line BEFORE you send your 'qmp_capabilities' response so you're off by one if you don't read the initial server greeting" (detail by Eric). A minimal test below: (1) This time, invoke QEMU w/ QMP server over Unix socket: --------------- $ ./invoke-qemu-with-qmp.sh . . . -qmp unix:./qmp-sock,server char device redirected to /dev/pts/49 (label charserial0) QEMU waiting for connection on: disconnected:unix:./qmp-sock,server --------------- (2) Pre-create the target destination: $ qemu-img create -f qcow2 incremental.0.img -b full_backup.img -F qcow2 (3) And, use `rlwrap` in combination with `socat` (previously learnt this trick from Markus Armbruster, it conveniently retains the command history) to connect to the QMP server and issue 'block-dirty-bitmap-add' and 'drive-mirror' commands with 'dirty-bitmap': ---------------- $ rlwrap -H ~/.qmp_history socat UNIX-CONNECT:./qmp-sock STDIO {"QMP": {"version": {"qemu": {"micro": 93, "minor": 2, "major": 2}, "package": ""}, "capabilities": []}} {"execute":"qmp_capabilities"} {"return": {}} { 'execute': 'block-dirty-bitmap-add', 'arguments': { 'node': 'drive-ide0-0-0', 'name': 'bitmap0' } } {"return": {}} { 'execute': 'drive-backup', 'arguments': { 'device': 'drive-ide0-0-0', 'bitmap': 'bitmap0', 'sync': 'dirty-bitmap', 'target': '/home/kashyapc/work/virt/qemu/incremental-backup-test-qemu/tests/incremental.0.img', 'mode': 'existing', 'format': 'qcow2' } } {"return": {}} {"timestamp": {"seconds": 1429647518, "microseconds": 663755}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "drive-ide0-0-0", "len": 41126400, "offset": 41156608, "speed": 0, "type": "backup"}} ---------------- Thanks, John/Eric. [1] Discussion thread here which contains the trivial script used: http://lists.nongnu.org/archive/html/qemu-devel/2015-04/msg02432.html