xref: /openbmc/qemu/tests/qemu-iotests/257.out (revision ebe15582)
1
2=== Mode bitmap; Bitmap Sync never with simulated failure ===
3
4--- Preparing image & VM ---
5
6{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
7{"return": {}}
8{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
9{"return": {}}
10
11--- Write #0 ---
12
13write -P0x49 0x0000000 0x10000
14{"return": ""}
15write -P0x6c 0x0100000 0x10000
16{"return": ""}
17write -P0x6f 0x2000000 0x10000
18{"return": ""}
19write -P0x76 0x3ff0000 0x10000
20{"return": ""}
21{
22  "bitmaps": {
23    "device0": []
24  }
25}
26
27--- Reference Backup #0 ---
28
29{}
30{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
31{"return": {}}
32{}
33{}
34{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
35{"return": {}}
36{}
37{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
38{"return": {}}
39{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
40
41--- Add Bitmap ---
42
43{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
44{"return": {}}
45
46--- Write #1 ---
47
48write -P0x65 0x0000000 0x10000
49{"return": ""}
50write -P0x77 0x00f8000 0x10000
51{"return": ""}
52write -P0x72 0x2008000 0x10000
53{"return": ""}
54write -P0x69 0x3fe0000 0x10000
55{"return": ""}
56{
57  "bitmaps": {
58    "device0": [
59      {
60        "busy": false,
61        "count": 393216,
62        "granularity": 65536,
63        "name": "bitmap0",
64        "persistent": false,
65        "recording": true,
66        "status": "active"
67      }
68    ]
69  }
70}
71
72= Checking Bitmap bitmap0 =
73expecting 6 dirty sectors; have 6. OK!
74
75--- Reference Backup #1 ---
76
77{}
78{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
79{"return": {}}
80{}
81{}
82{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
83{"return": {}}
84{}
85{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
86{"return": {}}
87{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
88
89--- Test Backup #1 ---
90
91{}
92{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
93{"return": {}}
94{}
95{}
96{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
97{"return": {}}
98{}
99{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
100{"return": {}}
101
102--- Write #2 ---
103
104write -P0x74 0x0010000 0x10000
105{"return": ""}
106write -P0x69 0x00e8000 0x10000
107{"return": ""}
108write -P0x6e 0x2018000 0x10000
109{"return": ""}
110write -P0x67 0x3fe0000 0x20000
111{"return": ""}
112{
113  "bitmaps": {
114    "device0": [
115      {
116        "busy": false,
117        "count": 0,
118        "granularity": 65536,
119        "persistent": false,
120        "recording": false,
121        "status": "disabled"
122      },
123      {
124        "busy": false,
125        "count": 458752,
126        "granularity": 65536,
127        "persistent": false,
128        "recording": true,
129        "status": "active"
130      },
131      {
132        "busy": true,
133        "count": 393216,
134        "granularity": 65536,
135        "name": "bitmap0",
136        "persistent": false,
137        "recording": true,
138        "status": "frozen"
139      }
140    ]
141  }
142}
143
144= Checking Bitmap bitmap0 =
145expecting 6 dirty sectors; have 6. OK!
146
147= Checking Bitmap (anonymous) =
148expecting 7 dirty sectors; have 7. OK!
149
150{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
151{"return": {}}
152{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
153{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
154{
155  "bitmaps": {
156    "device0": [
157      {
158        "busy": false,
159        "count": 655360,
160        "granularity": 65536,
161        "name": "bitmap0",
162        "persistent": false,
163        "recording": true,
164        "status": "active"
165      }
166    ]
167  }
168}
169
170= Checking Bitmap bitmap0 =
171expecting 10 dirty sectors; have 10. OK!
172
173--- Write #3 ---
174
175write -P0xaa 0x0010000 0x30000
176{"return": ""}
177write -P0xbb 0x00d8000 0x10000
178{"return": ""}
179write -P0xcc 0x2028000 0x10000
180{"return": ""}
181write -P0xdd 0x3fc0000 0x10000
182{"return": ""}
183{
184  "bitmaps": {
185    "device0": [
186      {
187        "busy": false,
188        "count": 983040,
189        "granularity": 65536,
190        "name": "bitmap0",
191        "persistent": false,
192        "recording": true,
193        "status": "active"
194      }
195    ]
196  }
197}
198
199= Checking Bitmap bitmap0 =
200expecting 15 dirty sectors; have 15. OK!
201
202--- Reference Backup #2 ---
203
204{}
205{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
206{"return": {}}
207{}
208{}
209{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
210{"return": {}}
211{}
212{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
213{"return": {}}
214{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
215
216--- Test Backup #2 ---
217
218{}
219{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
220{"return": {}}
221{}
222{}
223{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
224{"return": {}}
225{}
226{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
227{"return": {}}
228{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
229{"return": {}}
230{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
231{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
232{
233  "bitmaps": {
234    "device0": [
235      {
236        "busy": false,
237        "count": 983040,
238        "granularity": 65536,
239        "name": "bitmap0",
240        "persistent": false,
241        "recording": true,
242        "status": "active"
243      }
244    ]
245  }
246}
247
248= Checking Bitmap bitmap0 =
249expecting 15 dirty sectors; have 15. OK!
250
251--- Cleanup ---
252
253{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
254{"return": {}}
255{
256  "bitmaps": {
257    "device0": []
258  }
259}
260
261--- Verification ---
262
263qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
264qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
265qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
266
267
268=== Mode bitmap; Bitmap Sync never with intermediate failure ===
269
270--- Preparing image & VM ---
271
272{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
273{"return": {}}
274{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
275{"return": {}}
276
277--- Write #0 ---
278
279write -P0x49 0x0000000 0x10000
280{"return": ""}
281write -P0x6c 0x0100000 0x10000
282{"return": ""}
283write -P0x6f 0x2000000 0x10000
284{"return": ""}
285write -P0x76 0x3ff0000 0x10000
286{"return": ""}
287{
288  "bitmaps": {
289    "device0": []
290  }
291}
292
293--- Reference Backup #0 ---
294
295{}
296{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
297{"return": {}}
298{}
299{}
300{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
301{"return": {}}
302{}
303{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
304{"return": {}}
305{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
306
307--- Add Bitmap ---
308
309{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
310{"return": {}}
311
312--- Write #1 ---
313
314write -P0x65 0x0000000 0x10000
315{"return": ""}
316write -P0x77 0x00f8000 0x10000
317{"return": ""}
318write -P0x72 0x2008000 0x10000
319{"return": ""}
320write -P0x69 0x3fe0000 0x10000
321{"return": ""}
322{
323  "bitmaps": {
324    "device0": [
325      {
326        "busy": false,
327        "count": 393216,
328        "granularity": 65536,
329        "name": "bitmap0",
330        "persistent": false,
331        "recording": true,
332        "status": "active"
333      }
334    ]
335  }
336}
337
338= Checking Bitmap bitmap0 =
339expecting 6 dirty sectors; have 6. OK!
340
341--- Reference Backup #1 ---
342
343{}
344{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
345{"return": {}}
346{}
347{}
348{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
349{"return": {}}
350{}
351{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
352{"return": {}}
353{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
354
355{"return": ""}
356
357--- Test Backup #1 ---
358
359{}
360{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
361{"return": {}}
362{}
363{}
364{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
365{"return": {}}
366{}
367{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
368{"return": {}}
369{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
370{"data": {"device": "backup_1", "error": "Input/output error", "len": 393216, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
371{
372  "bitmaps": {
373    "device0": [
374      {
375        "busy": false,
376        "count": 393216,
377        "granularity": 65536,
378        "name": "bitmap0",
379        "persistent": false,
380        "recording": true,
381        "status": "active"
382      }
383    ]
384  }
385}
386
387= Checking Bitmap bitmap0 =
388expecting 6 dirty sectors; have 6. OK!
389
390--- Write #3 ---
391
392write -P0xaa 0x0010000 0x30000
393{"return": ""}
394write -P0xbb 0x00d8000 0x10000
395{"return": ""}
396write -P0xcc 0x2028000 0x10000
397{"return": ""}
398write -P0xdd 0x3fc0000 0x10000
399{"return": ""}
400{
401  "bitmaps": {
402    "device0": [
403      {
404        "busy": false,
405        "count": 917504,
406        "granularity": 65536,
407        "name": "bitmap0",
408        "persistent": false,
409        "recording": true,
410        "status": "active"
411      }
412    ]
413  }
414}
415
416= Checking Bitmap bitmap0 =
417expecting 14 dirty sectors; have 14. OK!
418
419--- Reference Backup #2 ---
420
421{}
422{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
423{"return": {}}
424{}
425{}
426{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
427{"return": {}}
428{}
429{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
430{"return": {}}
431{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
432
433--- Test Backup #2 ---
434
435{}
436{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
437{"return": {}}
438{}
439{}
440{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
441{"return": {}}
442{}
443{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
444{"return": {}}
445{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
446{"return": {}}
447{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
448{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
449{
450  "bitmaps": {
451    "device0": [
452      {
453        "busy": false,
454        "count": 917504,
455        "granularity": 65536,
456        "name": "bitmap0",
457        "persistent": false,
458        "recording": true,
459        "status": "active"
460      }
461    ]
462  }
463}
464
465= Checking Bitmap bitmap0 =
466expecting 14 dirty sectors; have 14. OK!
467
468--- Cleanup ---
469
470{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
471{"return": {}}
472{
473  "bitmaps": {
474    "device0": []
475  }
476}
477
478--- Verification ---
479
480qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
481qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
482qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
483
484
485=== Mode bitmap; Bitmap Sync never without failure ===
486
487--- Preparing image & VM ---
488
489{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
490{"return": {}}
491{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
492{"return": {}}
493
494--- Write #0 ---
495
496write -P0x49 0x0000000 0x10000
497{"return": ""}
498write -P0x6c 0x0100000 0x10000
499{"return": ""}
500write -P0x6f 0x2000000 0x10000
501{"return": ""}
502write -P0x76 0x3ff0000 0x10000
503{"return": ""}
504{
505  "bitmaps": {
506    "device0": []
507  }
508}
509
510--- Reference Backup #0 ---
511
512{}
513{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
514{"return": {}}
515{}
516{}
517{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
518{"return": {}}
519{}
520{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
521{"return": {}}
522{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
523
524--- Add Bitmap ---
525
526{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
527{"return": {}}
528
529--- Write #1 ---
530
531write -P0x65 0x0000000 0x10000
532{"return": ""}
533write -P0x77 0x00f8000 0x10000
534{"return": ""}
535write -P0x72 0x2008000 0x10000
536{"return": ""}
537write -P0x69 0x3fe0000 0x10000
538{"return": ""}
539{
540  "bitmaps": {
541    "device0": [
542      {
543        "busy": false,
544        "count": 393216,
545        "granularity": 65536,
546        "name": "bitmap0",
547        "persistent": false,
548        "recording": true,
549        "status": "active"
550      }
551    ]
552  }
553}
554
555= Checking Bitmap bitmap0 =
556expecting 6 dirty sectors; have 6. OK!
557
558--- Reference Backup #1 ---
559
560{}
561{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
562{"return": {}}
563{}
564{}
565{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
566{"return": {}}
567{}
568{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
569{"return": {}}
570{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
571
572--- Test Backup #1 ---
573
574{}
575{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
576{"return": {}}
577{}
578{}
579{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
580{"return": {}}
581{}
582{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
583{"return": {}}
584
585--- Write #2 ---
586
587write -P0x74 0x0010000 0x10000
588{"return": ""}
589write -P0x69 0x00e8000 0x10000
590{"return": ""}
591write -P0x6e 0x2018000 0x10000
592{"return": ""}
593write -P0x67 0x3fe0000 0x20000
594{"return": ""}
595{
596  "bitmaps": {
597    "device0": [
598      {
599        "busy": false,
600        "count": 0,
601        "granularity": 65536,
602        "persistent": false,
603        "recording": false,
604        "status": "disabled"
605      },
606      {
607        "busy": false,
608        "count": 458752,
609        "granularity": 65536,
610        "persistent": false,
611        "recording": true,
612        "status": "active"
613      },
614      {
615        "busy": true,
616        "count": 393216,
617        "granularity": 65536,
618        "name": "bitmap0",
619        "persistent": false,
620        "recording": true,
621        "status": "frozen"
622      }
623    ]
624  }
625}
626
627= Checking Bitmap bitmap0 =
628expecting 6 dirty sectors; have 6. OK!
629
630= Checking Bitmap (anonymous) =
631expecting 7 dirty sectors; have 7. OK!
632
633{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
634{"return": {}}
635{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
636{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
637{
638  "bitmaps": {
639    "device0": [
640      {
641        "busy": false,
642        "count": 655360,
643        "granularity": 65536,
644        "name": "bitmap0",
645        "persistent": false,
646        "recording": true,
647        "status": "active"
648      }
649    ]
650  }
651}
652
653= Checking Bitmap bitmap0 =
654expecting 10 dirty sectors; have 10. OK!
655
656--- Write #3 ---
657
658write -P0xaa 0x0010000 0x30000
659{"return": ""}
660write -P0xbb 0x00d8000 0x10000
661{"return": ""}
662write -P0xcc 0x2028000 0x10000
663{"return": ""}
664write -P0xdd 0x3fc0000 0x10000
665{"return": ""}
666{
667  "bitmaps": {
668    "device0": [
669      {
670        "busy": false,
671        "count": 983040,
672        "granularity": 65536,
673        "name": "bitmap0",
674        "persistent": false,
675        "recording": true,
676        "status": "active"
677      }
678    ]
679  }
680}
681
682= Checking Bitmap bitmap0 =
683expecting 15 dirty sectors; have 15. OK!
684
685--- Reference Backup #2 ---
686
687{}
688{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
689{"return": {}}
690{}
691{}
692{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
693{"return": {}}
694{}
695{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
696{"return": {}}
697{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
698
699--- Test Backup #2 ---
700
701{}
702{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
703{"return": {}}
704{}
705{}
706{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
707{"return": {}}
708{}
709{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
710{"return": {}}
711{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
712{"return": {}}
713{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
714{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
715{
716  "bitmaps": {
717    "device0": [
718      {
719        "busy": false,
720        "count": 983040,
721        "granularity": 65536,
722        "name": "bitmap0",
723        "persistent": false,
724        "recording": true,
725        "status": "active"
726      }
727    ]
728  }
729}
730
731= Checking Bitmap bitmap0 =
732expecting 15 dirty sectors; have 15. OK!
733
734--- Cleanup ---
735
736{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
737{"return": {}}
738{
739  "bitmaps": {
740    "device0": []
741  }
742}
743
744--- Verification ---
745
746qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
747qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
748qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
749
750
751=== Mode bitmap; Bitmap Sync on-success with simulated failure ===
752
753--- Preparing image & VM ---
754
755{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
756{"return": {}}
757{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
758{"return": {}}
759
760--- Write #0 ---
761
762write -P0x49 0x0000000 0x10000
763{"return": ""}
764write -P0x6c 0x0100000 0x10000
765{"return": ""}
766write -P0x6f 0x2000000 0x10000
767{"return": ""}
768write -P0x76 0x3ff0000 0x10000
769{"return": ""}
770{
771  "bitmaps": {
772    "device0": []
773  }
774}
775
776--- Reference Backup #0 ---
777
778{}
779{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
780{"return": {}}
781{}
782{}
783{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
784{"return": {}}
785{}
786{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
787{"return": {}}
788{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
789
790--- Add Bitmap ---
791
792{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
793{"return": {}}
794
795--- Write #1 ---
796
797write -P0x65 0x0000000 0x10000
798{"return": ""}
799write -P0x77 0x00f8000 0x10000
800{"return": ""}
801write -P0x72 0x2008000 0x10000
802{"return": ""}
803write -P0x69 0x3fe0000 0x10000
804{"return": ""}
805{
806  "bitmaps": {
807    "device0": [
808      {
809        "busy": false,
810        "count": 393216,
811        "granularity": 65536,
812        "name": "bitmap0",
813        "persistent": false,
814        "recording": true,
815        "status": "active"
816      }
817    ]
818  }
819}
820
821= Checking Bitmap bitmap0 =
822expecting 6 dirty sectors; have 6. OK!
823
824--- Reference Backup #1 ---
825
826{}
827{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
828{"return": {}}
829{}
830{}
831{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
832{"return": {}}
833{}
834{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
835{"return": {}}
836{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
837
838--- Test Backup #1 ---
839
840{}
841{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
842{"return": {}}
843{}
844{}
845{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
846{"return": {}}
847{}
848{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
849{"return": {}}
850
851--- Write #2 ---
852
853write -P0x74 0x0010000 0x10000
854{"return": ""}
855write -P0x69 0x00e8000 0x10000
856{"return": ""}
857write -P0x6e 0x2018000 0x10000
858{"return": ""}
859write -P0x67 0x3fe0000 0x20000
860{"return": ""}
861{
862  "bitmaps": {
863    "device0": [
864      {
865        "busy": false,
866        "count": 0,
867        "granularity": 65536,
868        "persistent": false,
869        "recording": false,
870        "status": "disabled"
871      },
872      {
873        "busy": false,
874        "count": 458752,
875        "granularity": 65536,
876        "persistent": false,
877        "recording": true,
878        "status": "active"
879      },
880      {
881        "busy": true,
882        "count": 393216,
883        "granularity": 65536,
884        "name": "bitmap0",
885        "persistent": false,
886        "recording": true,
887        "status": "frozen"
888      }
889    ]
890  }
891}
892
893= Checking Bitmap bitmap0 =
894expecting 6 dirty sectors; have 6. OK!
895
896= Checking Bitmap (anonymous) =
897expecting 7 dirty sectors; have 7. OK!
898
899{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
900{"return": {}}
901{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
902{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
903{
904  "bitmaps": {
905    "device0": [
906      {
907        "busy": false,
908        "count": 655360,
909        "granularity": 65536,
910        "name": "bitmap0",
911        "persistent": false,
912        "recording": true,
913        "status": "active"
914      }
915    ]
916  }
917}
918
919= Checking Bitmap bitmap0 =
920expecting 10 dirty sectors; have 10. OK!
921
922--- Write #3 ---
923
924write -P0xaa 0x0010000 0x30000
925{"return": ""}
926write -P0xbb 0x00d8000 0x10000
927{"return": ""}
928write -P0xcc 0x2028000 0x10000
929{"return": ""}
930write -P0xdd 0x3fc0000 0x10000
931{"return": ""}
932{
933  "bitmaps": {
934    "device0": [
935      {
936        "busy": false,
937        "count": 983040,
938        "granularity": 65536,
939        "name": "bitmap0",
940        "persistent": false,
941        "recording": true,
942        "status": "active"
943      }
944    ]
945  }
946}
947
948= Checking Bitmap bitmap0 =
949expecting 15 dirty sectors; have 15. OK!
950
951--- Reference Backup #2 ---
952
953{}
954{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
955{"return": {}}
956{}
957{}
958{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
959{"return": {}}
960{}
961{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
962{"return": {}}
963{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
964
965--- Test Backup #2 ---
966
967{}
968{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
969{"return": {}}
970{}
971{}
972{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
973{"return": {}}
974{}
975{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
976{"return": {}}
977{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
978{"return": {}}
979{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
980{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
981{
982  "bitmaps": {
983    "device0": [
984      {
985        "busy": false,
986        "count": 0,
987        "granularity": 65536,
988        "name": "bitmap0",
989        "persistent": false,
990        "recording": true,
991        "status": "active"
992      }
993    ]
994  }
995}
996
997= Checking Bitmap bitmap0 =
998expecting 0 dirty sectors; have 0. OK!
999
1000--- Cleanup ---
1001
1002{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
1003{"return": {}}
1004{
1005  "bitmaps": {
1006    "device0": []
1007  }
1008}
1009
1010--- Verification ---
1011
1012qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
1013qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1014qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1015
1016
1017=== Mode bitmap; Bitmap Sync on-success with intermediate failure ===
1018
1019--- Preparing image & VM ---
1020
1021{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
1022{"return": {}}
1023{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
1024{"return": {}}
1025
1026--- Write #0 ---
1027
1028write -P0x49 0x0000000 0x10000
1029{"return": ""}
1030write -P0x6c 0x0100000 0x10000
1031{"return": ""}
1032write -P0x6f 0x2000000 0x10000
1033{"return": ""}
1034write -P0x76 0x3ff0000 0x10000
1035{"return": ""}
1036{
1037  "bitmaps": {
1038    "device0": []
1039  }
1040}
1041
1042--- Reference Backup #0 ---
1043
1044{}
1045{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1046{"return": {}}
1047{}
1048{}
1049{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1050{"return": {}}
1051{}
1052{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
1053{"return": {}}
1054{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1055
1056--- Add Bitmap ---
1057
1058{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
1059{"return": {}}
1060
1061--- Write #1 ---
1062
1063write -P0x65 0x0000000 0x10000
1064{"return": ""}
1065write -P0x77 0x00f8000 0x10000
1066{"return": ""}
1067write -P0x72 0x2008000 0x10000
1068{"return": ""}
1069write -P0x69 0x3fe0000 0x10000
1070{"return": ""}
1071{
1072  "bitmaps": {
1073    "device0": [
1074      {
1075        "busy": false,
1076        "count": 393216,
1077        "granularity": 65536,
1078        "name": "bitmap0",
1079        "persistent": false,
1080        "recording": true,
1081        "status": "active"
1082      }
1083    ]
1084  }
1085}
1086
1087= Checking Bitmap bitmap0 =
1088expecting 6 dirty sectors; have 6. OK!
1089
1090--- Reference Backup #1 ---
1091
1092{}
1093{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1094{"return": {}}
1095{}
1096{}
1097{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1098{"return": {}}
1099{}
1100{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
1101{"return": {}}
1102{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1103
1104{"return": ""}
1105
1106--- Test Backup #1 ---
1107
1108{}
1109{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1110{"return": {}}
1111{}
1112{}
1113{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1114{"return": {}}
1115{}
1116{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
1117{"return": {}}
1118{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1119{"data": {"device": "backup_1", "error": "Input/output error", "len": 393216, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1120{
1121  "bitmaps": {
1122    "device0": [
1123      {
1124        "busy": false,
1125        "count": 393216,
1126        "granularity": 65536,
1127        "name": "bitmap0",
1128        "persistent": false,
1129        "recording": true,
1130        "status": "active"
1131      }
1132    ]
1133  }
1134}
1135
1136= Checking Bitmap bitmap0 =
1137expecting 6 dirty sectors; have 6. OK!
1138
1139--- Write #3 ---
1140
1141write -P0xaa 0x0010000 0x30000
1142{"return": ""}
1143write -P0xbb 0x00d8000 0x10000
1144{"return": ""}
1145write -P0xcc 0x2028000 0x10000
1146{"return": ""}
1147write -P0xdd 0x3fc0000 0x10000
1148{"return": ""}
1149{
1150  "bitmaps": {
1151    "device0": [
1152      {
1153        "busy": false,
1154        "count": 917504,
1155        "granularity": 65536,
1156        "name": "bitmap0",
1157        "persistent": false,
1158        "recording": true,
1159        "status": "active"
1160      }
1161    ]
1162  }
1163}
1164
1165= Checking Bitmap bitmap0 =
1166expecting 14 dirty sectors; have 14. OK!
1167
1168--- Reference Backup #2 ---
1169
1170{}
1171{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1172{"return": {}}
1173{}
1174{}
1175{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1176{"return": {}}
1177{}
1178{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
1179{"return": {}}
1180{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1181
1182--- Test Backup #2 ---
1183
1184{}
1185{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1186{"return": {}}
1187{}
1188{}
1189{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1190{"return": {}}
1191{}
1192{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
1193{"return": {}}
1194{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
1195{"return": {}}
1196{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1197{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1198{
1199  "bitmaps": {
1200    "device0": [
1201      {
1202        "busy": false,
1203        "count": 0,
1204        "granularity": 65536,
1205        "name": "bitmap0",
1206        "persistent": false,
1207        "recording": true,
1208        "status": "active"
1209      }
1210    ]
1211  }
1212}
1213
1214= Checking Bitmap bitmap0 =
1215expecting 0 dirty sectors; have 0. OK!
1216
1217--- Cleanup ---
1218
1219{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
1220{"return": {}}
1221{
1222  "bitmaps": {
1223    "device0": []
1224  }
1225}
1226
1227--- Verification ---
1228
1229qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
1230qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1231qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1232
1233
1234=== Mode bitmap; Bitmap Sync on-success without failure ===
1235
1236--- Preparing image & VM ---
1237
1238{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
1239{"return": {}}
1240{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
1241{"return": {}}
1242
1243--- Write #0 ---
1244
1245write -P0x49 0x0000000 0x10000
1246{"return": ""}
1247write -P0x6c 0x0100000 0x10000
1248{"return": ""}
1249write -P0x6f 0x2000000 0x10000
1250{"return": ""}
1251write -P0x76 0x3ff0000 0x10000
1252{"return": ""}
1253{
1254  "bitmaps": {
1255    "device0": []
1256  }
1257}
1258
1259--- Reference Backup #0 ---
1260
1261{}
1262{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1263{"return": {}}
1264{}
1265{}
1266{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1267{"return": {}}
1268{}
1269{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
1270{"return": {}}
1271{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1272
1273--- Add Bitmap ---
1274
1275{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
1276{"return": {}}
1277
1278--- Write #1 ---
1279
1280write -P0x65 0x0000000 0x10000
1281{"return": ""}
1282write -P0x77 0x00f8000 0x10000
1283{"return": ""}
1284write -P0x72 0x2008000 0x10000
1285{"return": ""}
1286write -P0x69 0x3fe0000 0x10000
1287{"return": ""}
1288{
1289  "bitmaps": {
1290    "device0": [
1291      {
1292        "busy": false,
1293        "count": 393216,
1294        "granularity": 65536,
1295        "name": "bitmap0",
1296        "persistent": false,
1297        "recording": true,
1298        "status": "active"
1299      }
1300    ]
1301  }
1302}
1303
1304= Checking Bitmap bitmap0 =
1305expecting 6 dirty sectors; have 6. OK!
1306
1307--- Reference Backup #1 ---
1308
1309{}
1310{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1311{"return": {}}
1312{}
1313{}
1314{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1315{"return": {}}
1316{}
1317{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
1318{"return": {}}
1319{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1320
1321--- Test Backup #1 ---
1322
1323{}
1324{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1325{"return": {}}
1326{}
1327{}
1328{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1329{"return": {}}
1330{}
1331{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
1332{"return": {}}
1333
1334--- Write #2 ---
1335
1336write -P0x74 0x0010000 0x10000
1337{"return": ""}
1338write -P0x69 0x00e8000 0x10000
1339{"return": ""}
1340write -P0x6e 0x2018000 0x10000
1341{"return": ""}
1342write -P0x67 0x3fe0000 0x20000
1343{"return": ""}
1344{
1345  "bitmaps": {
1346    "device0": [
1347      {
1348        "busy": false,
1349        "count": 0,
1350        "granularity": 65536,
1351        "persistent": false,
1352        "recording": false,
1353        "status": "disabled"
1354      },
1355      {
1356        "busy": false,
1357        "count": 458752,
1358        "granularity": 65536,
1359        "persistent": false,
1360        "recording": true,
1361        "status": "active"
1362      },
1363      {
1364        "busy": true,
1365        "count": 393216,
1366        "granularity": 65536,
1367        "name": "bitmap0",
1368        "persistent": false,
1369        "recording": true,
1370        "status": "frozen"
1371      }
1372    ]
1373  }
1374}
1375
1376= Checking Bitmap bitmap0 =
1377expecting 6 dirty sectors; have 6. OK!
1378
1379= Checking Bitmap (anonymous) =
1380expecting 7 dirty sectors; have 7. OK!
1381
1382{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
1383{"return": {}}
1384{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1385{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1386{
1387  "bitmaps": {
1388    "device0": [
1389      {
1390        "busy": false,
1391        "count": 458752,
1392        "granularity": 65536,
1393        "name": "bitmap0",
1394        "persistent": false,
1395        "recording": true,
1396        "status": "active"
1397      }
1398    ]
1399  }
1400}
1401
1402= Checking Bitmap bitmap0 =
1403expecting 7 dirty sectors; have 7. OK!
1404
1405--- Write #3 ---
1406
1407write -P0xaa 0x0010000 0x30000
1408{"return": ""}
1409write -P0xbb 0x00d8000 0x10000
1410{"return": ""}
1411write -P0xcc 0x2028000 0x10000
1412{"return": ""}
1413write -P0xdd 0x3fc0000 0x10000
1414{"return": ""}
1415{
1416  "bitmaps": {
1417    "device0": [
1418      {
1419        "busy": false,
1420        "count": 786432,
1421        "granularity": 65536,
1422        "name": "bitmap0",
1423        "persistent": false,
1424        "recording": true,
1425        "status": "active"
1426      }
1427    ]
1428  }
1429}
1430
1431= Checking Bitmap bitmap0 =
1432expecting 12 dirty sectors; have 12. OK!
1433
1434--- Reference Backup #2 ---
1435
1436{}
1437{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1438{"return": {}}
1439{}
1440{}
1441{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1442{"return": {}}
1443{}
1444{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
1445{"return": {}}
1446{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1447
1448--- Test Backup #2 ---
1449
1450{}
1451{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1452{"return": {}}
1453{}
1454{}
1455{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1456{"return": {}}
1457{}
1458{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
1459{"return": {}}
1460{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
1461{"return": {}}
1462{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1463{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1464{
1465  "bitmaps": {
1466    "device0": [
1467      {
1468        "busy": false,
1469        "count": 0,
1470        "granularity": 65536,
1471        "name": "bitmap0",
1472        "persistent": false,
1473        "recording": true,
1474        "status": "active"
1475      }
1476    ]
1477  }
1478}
1479
1480= Checking Bitmap bitmap0 =
1481expecting 0 dirty sectors; have 0. OK!
1482
1483--- Cleanup ---
1484
1485{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
1486{"return": {}}
1487{
1488  "bitmaps": {
1489    "device0": []
1490  }
1491}
1492
1493--- Verification ---
1494
1495qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
1496qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1497qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1498
1499
1500=== Mode bitmap; Bitmap Sync always with simulated failure ===
1501
1502--- Preparing image & VM ---
1503
1504{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
1505{"return": {}}
1506{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
1507{"return": {}}
1508
1509--- Write #0 ---
1510
1511write -P0x49 0x0000000 0x10000
1512{"return": ""}
1513write -P0x6c 0x0100000 0x10000
1514{"return": ""}
1515write -P0x6f 0x2000000 0x10000
1516{"return": ""}
1517write -P0x76 0x3ff0000 0x10000
1518{"return": ""}
1519{
1520  "bitmaps": {
1521    "device0": []
1522  }
1523}
1524
1525--- Reference Backup #0 ---
1526
1527{}
1528{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1529{"return": {}}
1530{}
1531{}
1532{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1533{"return": {}}
1534{}
1535{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
1536{"return": {}}
1537{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1538
1539--- Add Bitmap ---
1540
1541{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
1542{"return": {}}
1543
1544--- Write #1 ---
1545
1546write -P0x65 0x0000000 0x10000
1547{"return": ""}
1548write -P0x77 0x00f8000 0x10000
1549{"return": ""}
1550write -P0x72 0x2008000 0x10000
1551{"return": ""}
1552write -P0x69 0x3fe0000 0x10000
1553{"return": ""}
1554{
1555  "bitmaps": {
1556    "device0": [
1557      {
1558        "busy": false,
1559        "count": 393216,
1560        "granularity": 65536,
1561        "name": "bitmap0",
1562        "persistent": false,
1563        "recording": true,
1564        "status": "active"
1565      }
1566    ]
1567  }
1568}
1569
1570= Checking Bitmap bitmap0 =
1571expecting 6 dirty sectors; have 6. OK!
1572
1573--- Reference Backup #1 ---
1574
1575{}
1576{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1577{"return": {}}
1578{}
1579{}
1580{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1581{"return": {}}
1582{}
1583{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
1584{"return": {}}
1585{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1586
1587--- Test Backup #1 ---
1588
1589{}
1590{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1591{"return": {}}
1592{}
1593{}
1594{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1595{"return": {}}
1596{}
1597{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
1598{"return": {}}
1599
1600--- Write #2 ---
1601
1602write -P0x74 0x0010000 0x10000
1603{"return": ""}
1604write -P0x69 0x00e8000 0x10000
1605{"return": ""}
1606write -P0x6e 0x2018000 0x10000
1607{"return": ""}
1608write -P0x67 0x3fe0000 0x20000
1609{"return": ""}
1610{
1611  "bitmaps": {
1612    "device0": [
1613      {
1614        "busy": false,
1615        "count": 0,
1616        "granularity": 65536,
1617        "persistent": false,
1618        "recording": false,
1619        "status": "disabled"
1620      },
1621      {
1622        "busy": false,
1623        "count": 458752,
1624        "granularity": 65536,
1625        "persistent": false,
1626        "recording": true,
1627        "status": "active"
1628      },
1629      {
1630        "busy": true,
1631        "count": 393216,
1632        "granularity": 65536,
1633        "name": "bitmap0",
1634        "persistent": false,
1635        "recording": true,
1636        "status": "frozen"
1637      }
1638    ]
1639  }
1640}
1641
1642= Checking Bitmap bitmap0 =
1643expecting 6 dirty sectors; have 6. OK!
1644
1645= Checking Bitmap (anonymous) =
1646expecting 7 dirty sectors; have 7. OK!
1647
1648{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
1649{"return": {}}
1650{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1651{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1652{
1653  "bitmaps": {
1654    "device0": [
1655      {
1656        "busy": false,
1657        "count": 458752,
1658        "granularity": 65536,
1659        "name": "bitmap0",
1660        "persistent": false,
1661        "recording": true,
1662        "status": "active"
1663      }
1664    ]
1665  }
1666}
1667
1668= Checking Bitmap bitmap0 =
1669expecting 7 dirty sectors; have 7. OK!
1670
1671--- Write #3 ---
1672
1673write -P0xaa 0x0010000 0x30000
1674{"return": ""}
1675write -P0xbb 0x00d8000 0x10000
1676{"return": ""}
1677write -P0xcc 0x2028000 0x10000
1678{"return": ""}
1679write -P0xdd 0x3fc0000 0x10000
1680{"return": ""}
1681{
1682  "bitmaps": {
1683    "device0": [
1684      {
1685        "busy": false,
1686        "count": 786432,
1687        "granularity": 65536,
1688        "name": "bitmap0",
1689        "persistent": false,
1690        "recording": true,
1691        "status": "active"
1692      }
1693    ]
1694  }
1695}
1696
1697= Checking Bitmap bitmap0 =
1698expecting 12 dirty sectors; have 12. OK!
1699
1700--- Reference Backup #2 ---
1701
1702{}
1703{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1704{"return": {}}
1705{}
1706{}
1707{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1708{"return": {}}
1709{}
1710{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
1711{"return": {}}
1712{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1713
1714--- Test Backup #2 ---
1715
1716{}
1717{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1718{"return": {}}
1719{}
1720{}
1721{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1722{"return": {}}
1723{}
1724{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
1725{"return": {}}
1726{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
1727{"return": {}}
1728{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1729{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1730{
1731  "bitmaps": {
1732    "device0": [
1733      {
1734        "busy": false,
1735        "count": 0,
1736        "granularity": 65536,
1737        "name": "bitmap0",
1738        "persistent": false,
1739        "recording": true,
1740        "status": "active"
1741      }
1742    ]
1743  }
1744}
1745
1746= Checking Bitmap bitmap0 =
1747expecting 0 dirty sectors; have 0. OK!
1748
1749--- Cleanup ---
1750
1751{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
1752{"return": {}}
1753{
1754  "bitmaps": {
1755    "device0": []
1756  }
1757}
1758
1759--- Verification ---
1760
1761qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
1762qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1763qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1764
1765
1766=== Mode bitmap; Bitmap Sync always with intermediate failure ===
1767
1768--- Preparing image & VM ---
1769
1770{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
1771{"return": {}}
1772{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
1773{"return": {}}
1774
1775--- Write #0 ---
1776
1777write -P0x49 0x0000000 0x10000
1778{"return": ""}
1779write -P0x6c 0x0100000 0x10000
1780{"return": ""}
1781write -P0x6f 0x2000000 0x10000
1782{"return": ""}
1783write -P0x76 0x3ff0000 0x10000
1784{"return": ""}
1785{
1786  "bitmaps": {
1787    "device0": []
1788  }
1789}
1790
1791--- Reference Backup #0 ---
1792
1793{}
1794{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1795{"return": {}}
1796{}
1797{}
1798{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1799{"return": {}}
1800{}
1801{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
1802{"return": {}}
1803{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1804
1805--- Add Bitmap ---
1806
1807{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
1808{"return": {}}
1809
1810--- Write #1 ---
1811
1812write -P0x65 0x0000000 0x10000
1813{"return": ""}
1814write -P0x77 0x00f8000 0x10000
1815{"return": ""}
1816write -P0x72 0x2008000 0x10000
1817{"return": ""}
1818write -P0x69 0x3fe0000 0x10000
1819{"return": ""}
1820{
1821  "bitmaps": {
1822    "device0": [
1823      {
1824        "busy": false,
1825        "count": 393216,
1826        "granularity": 65536,
1827        "name": "bitmap0",
1828        "persistent": false,
1829        "recording": true,
1830        "status": "active"
1831      }
1832    ]
1833  }
1834}
1835
1836= Checking Bitmap bitmap0 =
1837expecting 6 dirty sectors; have 6. OK!
1838
1839--- Reference Backup #1 ---
1840
1841{}
1842{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1843{"return": {}}
1844{}
1845{}
1846{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1847{"return": {}}
1848{}
1849{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
1850{"return": {}}
1851{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1852
1853{"return": ""}
1854
1855--- Test Backup #1 ---
1856
1857{}
1858{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1859{"return": {}}
1860{}
1861{}
1862{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1863{"return": {}}
1864{}
1865{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
1866{"return": {}}
1867{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1868{"data": {"device": "backup_1", "error": "Input/output error", "len": 393216, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1869{
1870  "bitmaps": {
1871    "device0": [
1872      {
1873        "busy": false,
1874        "count": 327680,
1875        "granularity": 65536,
1876        "name": "bitmap0",
1877        "persistent": false,
1878        "recording": true,
1879        "status": "active"
1880      }
1881    ]
1882  }
1883}
1884
1885= Checking Bitmap bitmap0 =
1886expecting 5 dirty sectors; have 5. OK!
1887
1888--- Write #3 ---
1889
1890write -P0xaa 0x0010000 0x30000
1891{"return": ""}
1892write -P0xbb 0x00d8000 0x10000
1893{"return": ""}
1894write -P0xcc 0x2028000 0x10000
1895{"return": ""}
1896write -P0xdd 0x3fc0000 0x10000
1897{"return": ""}
1898{
1899  "bitmaps": {
1900    "device0": [
1901      {
1902        "busy": false,
1903        "count": 851968,
1904        "granularity": 65536,
1905        "name": "bitmap0",
1906        "persistent": false,
1907        "recording": true,
1908        "status": "active"
1909      }
1910    ]
1911  }
1912}
1913
1914= Checking Bitmap bitmap0 =
1915expecting 13 dirty sectors; have 13. OK!
1916
1917--- Reference Backup #2 ---
1918
1919{}
1920{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1921{"return": {}}
1922{}
1923{}
1924{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1925{"return": {}}
1926{}
1927{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
1928{"return": {}}
1929{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1930
1931--- Test Backup #2 ---
1932
1933{}
1934{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
1935{"return": {}}
1936{}
1937{}
1938{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
1939{"return": {}}
1940{}
1941{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
1942{"return": {}}
1943{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
1944{"return": {}}
1945{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1946{"data": {"device": "backup_2", "len": 851968, "offset": 851968, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
1947{
1948  "bitmaps": {
1949    "device0": [
1950      {
1951        "busy": false,
1952        "count": 0,
1953        "granularity": 65536,
1954        "name": "bitmap0",
1955        "persistent": false,
1956        "recording": true,
1957        "status": "active"
1958      }
1959    ]
1960  }
1961}
1962
1963= Checking Bitmap bitmap0 =
1964expecting 0 dirty sectors; have 0. OK!
1965
1966--- Cleanup ---
1967
1968{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
1969{"return": {}}
1970{
1971  "bitmaps": {
1972    "device0": []
1973  }
1974}
1975
1976--- Verification ---
1977
1978qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
1979qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1980qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
1981
1982
1983=== Mode bitmap; Bitmap Sync always without failure ===
1984
1985--- Preparing image & VM ---
1986
1987{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
1988{"return": {}}
1989{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
1990{"return": {}}
1991
1992--- Write #0 ---
1993
1994write -P0x49 0x0000000 0x10000
1995{"return": ""}
1996write -P0x6c 0x0100000 0x10000
1997{"return": ""}
1998write -P0x6f 0x2000000 0x10000
1999{"return": ""}
2000write -P0x76 0x3ff0000 0x10000
2001{"return": ""}
2002{
2003  "bitmaps": {
2004    "device0": []
2005  }
2006}
2007
2008--- Reference Backup #0 ---
2009
2010{}
2011{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2012{"return": {}}
2013{}
2014{}
2015{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2016{"return": {}}
2017{}
2018{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
2019{"return": {}}
2020{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2021
2022--- Add Bitmap ---
2023
2024{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
2025{"return": {}}
2026
2027--- Write #1 ---
2028
2029write -P0x65 0x0000000 0x10000
2030{"return": ""}
2031write -P0x77 0x00f8000 0x10000
2032{"return": ""}
2033write -P0x72 0x2008000 0x10000
2034{"return": ""}
2035write -P0x69 0x3fe0000 0x10000
2036{"return": ""}
2037{
2038  "bitmaps": {
2039    "device0": [
2040      {
2041        "busy": false,
2042        "count": 393216,
2043        "granularity": 65536,
2044        "name": "bitmap0",
2045        "persistent": false,
2046        "recording": true,
2047        "status": "active"
2048      }
2049    ]
2050  }
2051}
2052
2053= Checking Bitmap bitmap0 =
2054expecting 6 dirty sectors; have 6. OK!
2055
2056--- Reference Backup #1 ---
2057
2058{}
2059{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2060{"return": {}}
2061{}
2062{}
2063{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2064{"return": {}}
2065{}
2066{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
2067{"return": {}}
2068{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2069
2070--- Test Backup #1 ---
2071
2072{}
2073{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2074{"return": {}}
2075{}
2076{}
2077{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2078{"return": {}}
2079{}
2080{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "bitmap", "target": "backup_target_1"}}
2081{"return": {}}
2082
2083--- Write #2 ---
2084
2085write -P0x74 0x0010000 0x10000
2086{"return": ""}
2087write -P0x69 0x00e8000 0x10000
2088{"return": ""}
2089write -P0x6e 0x2018000 0x10000
2090{"return": ""}
2091write -P0x67 0x3fe0000 0x20000
2092{"return": ""}
2093{
2094  "bitmaps": {
2095    "device0": [
2096      {
2097        "busy": false,
2098        "count": 0,
2099        "granularity": 65536,
2100        "persistent": false,
2101        "recording": false,
2102        "status": "disabled"
2103      },
2104      {
2105        "busy": false,
2106        "count": 458752,
2107        "granularity": 65536,
2108        "persistent": false,
2109        "recording": true,
2110        "status": "active"
2111      },
2112      {
2113        "busy": true,
2114        "count": 393216,
2115        "granularity": 65536,
2116        "name": "bitmap0",
2117        "persistent": false,
2118        "recording": true,
2119        "status": "frozen"
2120      }
2121    ]
2122  }
2123}
2124
2125= Checking Bitmap bitmap0 =
2126expecting 6 dirty sectors; have 6. OK!
2127
2128= Checking Bitmap (anonymous) =
2129expecting 7 dirty sectors; have 7. OK!
2130
2131{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
2132{"return": {}}
2133{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2134{"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2135{
2136  "bitmaps": {
2137    "device0": [
2138      {
2139        "busy": false,
2140        "count": 458752,
2141        "granularity": 65536,
2142        "name": "bitmap0",
2143        "persistent": false,
2144        "recording": true,
2145        "status": "active"
2146      }
2147    ]
2148  }
2149}
2150
2151= Checking Bitmap bitmap0 =
2152expecting 7 dirty sectors; have 7. OK!
2153
2154--- Write #3 ---
2155
2156write -P0xaa 0x0010000 0x30000
2157{"return": ""}
2158write -P0xbb 0x00d8000 0x10000
2159{"return": ""}
2160write -P0xcc 0x2028000 0x10000
2161{"return": ""}
2162write -P0xdd 0x3fc0000 0x10000
2163{"return": ""}
2164{
2165  "bitmaps": {
2166    "device0": [
2167      {
2168        "busy": false,
2169        "count": 786432,
2170        "granularity": 65536,
2171        "name": "bitmap0",
2172        "persistent": false,
2173        "recording": true,
2174        "status": "active"
2175      }
2176    ]
2177  }
2178}
2179
2180= Checking Bitmap bitmap0 =
2181expecting 12 dirty sectors; have 12. OK!
2182
2183--- Reference Backup #2 ---
2184
2185{}
2186{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2187{"return": {}}
2188{}
2189{}
2190{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2191{"return": {}}
2192{}
2193{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
2194{"return": {}}
2195{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2196
2197--- Test Backup #2 ---
2198
2199{}
2200{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2201{"return": {}}
2202{}
2203{}
2204{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2205{"return": {}}
2206{}
2207{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
2208{"return": {}}
2209{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
2210{"return": {}}
2211{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2212{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2213{
2214  "bitmaps": {
2215    "device0": [
2216      {
2217        "busy": false,
2218        "count": 0,
2219        "granularity": 65536,
2220        "name": "bitmap0",
2221        "persistent": false,
2222        "recording": true,
2223        "status": "active"
2224      }
2225    ]
2226  }
2227}
2228
2229= Checking Bitmap bitmap0 =
2230expecting 0 dirty sectors; have 0. OK!
2231
2232--- Cleanup ---
2233
2234{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
2235{"return": {}}
2236{
2237  "bitmaps": {
2238    "device0": []
2239  }
2240}
2241
2242--- Verification ---
2243
2244qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
2245qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2246qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2247
2248
2249=== Mode full; Bitmap Sync on-success with simulated failure ===
2250
2251--- Preparing image & VM ---
2252
2253{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
2254{"return": {}}
2255{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
2256{"return": {}}
2257
2258--- Write #0 ---
2259
2260write -P0x49 0x0000000 0x10000
2261{"return": ""}
2262write -P0x6c 0x0100000 0x10000
2263{"return": ""}
2264write -P0x6f 0x2000000 0x10000
2265{"return": ""}
2266write -P0x76 0x3ff0000 0x10000
2267{"return": ""}
2268{
2269  "bitmaps": {
2270    "device0": []
2271  }
2272}
2273
2274--- Reference Backup #0 ---
2275
2276{}
2277{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2278{"return": {}}
2279{}
2280{}
2281{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2282{"return": {}}
2283{}
2284{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
2285{"return": {}}
2286{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2287
2288--- Add Bitmap ---
2289
2290{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
2291{"return": {}}
2292
2293--- Write #1 ---
2294
2295write -P0x65 0x0000000 0x10000
2296{"return": ""}
2297write -P0x77 0x00f8000 0x10000
2298{"return": ""}
2299write -P0x72 0x2008000 0x10000
2300{"return": ""}
2301write -P0x69 0x3fe0000 0x10000
2302{"return": ""}
2303{
2304  "bitmaps": {
2305    "device0": [
2306      {
2307        "busy": false,
2308        "count": 393216,
2309        "granularity": 65536,
2310        "name": "bitmap0",
2311        "persistent": false,
2312        "recording": true,
2313        "status": "active"
2314      }
2315    ]
2316  }
2317}
2318
2319= Checking Bitmap bitmap0 =
2320expecting 6 dirty sectors; have 6. OK!
2321
2322--- Reference Backup #1 ---
2323
2324{}
2325{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2326{"return": {}}
2327{}
2328{}
2329{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2330{"return": {}}
2331{}
2332{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
2333{"return": {}}
2334{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2335
2336--- Test Backup #1 ---
2337
2338{}
2339{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2340{"return": {}}
2341{}
2342{}
2343{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2344{"return": {}}
2345{}
2346{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "full", "target": "backup_target_1"}}
2347{"return": {}}
2348
2349--- Write #2 ---
2350
2351write -P0x74 0x0010000 0x10000
2352{"return": ""}
2353write -P0x69 0x00e8000 0x10000
2354{"return": ""}
2355write -P0x6e 0x2018000 0x10000
2356{"return": ""}
2357write -P0x67 0x3fe0000 0x20000
2358{"return": ""}
2359{
2360  "bitmaps": {
2361    "device0": [
2362      {
2363        "busy": false,
2364        "count": 0,
2365        "granularity": 65536,
2366        "persistent": false,
2367        "recording": false,
2368        "status": "disabled"
2369      },
2370      {
2371        "busy": false,
2372        "count": 458752,
2373        "granularity": 65536,
2374        "persistent": false,
2375        "recording": true,
2376        "status": "active"
2377      },
2378      {
2379        "busy": true,
2380        "count": 393216,
2381        "granularity": 65536,
2382        "name": "bitmap0",
2383        "persistent": false,
2384        "recording": true,
2385        "status": "frozen"
2386      }
2387    ]
2388  }
2389}
2390
2391= Checking Bitmap bitmap0 =
2392expecting 6 dirty sectors; have 6. OK!
2393
2394= Checking Bitmap (anonymous) =
2395expecting 7 dirty sectors; have 7. OK!
2396
2397{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
2398{"return": {}}
2399{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2400{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2401{
2402  "bitmaps": {
2403    "device0": [
2404      {
2405        "busy": false,
2406        "count": 655360,
2407        "granularity": 65536,
2408        "name": "bitmap0",
2409        "persistent": false,
2410        "recording": true,
2411        "status": "active"
2412      }
2413    ]
2414  }
2415}
2416
2417= Checking Bitmap bitmap0 =
2418expecting 10 dirty sectors; have 10. OK!
2419
2420--- Write #3 ---
2421
2422write -P0xaa 0x0010000 0x30000
2423{"return": ""}
2424write -P0xbb 0x00d8000 0x10000
2425{"return": ""}
2426write -P0xcc 0x2028000 0x10000
2427{"return": ""}
2428write -P0xdd 0x3fc0000 0x10000
2429{"return": ""}
2430{
2431  "bitmaps": {
2432    "device0": [
2433      {
2434        "busy": false,
2435        "count": 983040,
2436        "granularity": 65536,
2437        "name": "bitmap0",
2438        "persistent": false,
2439        "recording": true,
2440        "status": "active"
2441      }
2442    ]
2443  }
2444}
2445
2446= Checking Bitmap bitmap0 =
2447expecting 15 dirty sectors; have 15. OK!
2448
2449--- Reference Backup #2 ---
2450
2451{}
2452{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2453{"return": {}}
2454{}
2455{}
2456{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2457{"return": {}}
2458{}
2459{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
2460{"return": {}}
2461{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2462
2463--- Test Backup #2 ---
2464
2465{}
2466{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2467{"return": {}}
2468{}
2469{}
2470{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2471{"return": {}}
2472{}
2473{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
2474{"return": {}}
2475{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
2476{"return": {}}
2477{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2478{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2479{
2480  "bitmaps": {
2481    "device0": [
2482      {
2483        "busy": false,
2484        "count": 0,
2485        "granularity": 65536,
2486        "name": "bitmap0",
2487        "persistent": false,
2488        "recording": true,
2489        "status": "active"
2490      }
2491    ]
2492  }
2493}
2494
2495= Checking Bitmap bitmap0 =
2496expecting 0 dirty sectors; have 0. OK!
2497
2498--- Cleanup ---
2499
2500{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
2501{"return": {}}
2502{
2503  "bitmaps": {
2504    "device0": []
2505  }
2506}
2507
2508--- Verification ---
2509
2510qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
2511qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2512qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2513
2514
2515=== Mode full; Bitmap Sync on-success with intermediate failure ===
2516
2517--- Preparing image & VM ---
2518
2519{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
2520{"return": {}}
2521{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
2522{"return": {}}
2523
2524--- Write #0 ---
2525
2526write -P0x49 0x0000000 0x10000
2527{"return": ""}
2528write -P0x6c 0x0100000 0x10000
2529{"return": ""}
2530write -P0x6f 0x2000000 0x10000
2531{"return": ""}
2532write -P0x76 0x3ff0000 0x10000
2533{"return": ""}
2534{
2535  "bitmaps": {
2536    "device0": []
2537  }
2538}
2539
2540--- Reference Backup #0 ---
2541
2542{}
2543{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2544{"return": {}}
2545{}
2546{}
2547{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2548{"return": {}}
2549{}
2550{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
2551{"return": {}}
2552{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2553
2554--- Add Bitmap ---
2555
2556{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
2557{"return": {}}
2558
2559--- Write #1 ---
2560
2561write -P0x65 0x0000000 0x10000
2562{"return": ""}
2563write -P0x77 0x00f8000 0x10000
2564{"return": ""}
2565write -P0x72 0x2008000 0x10000
2566{"return": ""}
2567write -P0x69 0x3fe0000 0x10000
2568{"return": ""}
2569{
2570  "bitmaps": {
2571    "device0": [
2572      {
2573        "busy": false,
2574        "count": 393216,
2575        "granularity": 65536,
2576        "name": "bitmap0",
2577        "persistent": false,
2578        "recording": true,
2579        "status": "active"
2580      }
2581    ]
2582  }
2583}
2584
2585= Checking Bitmap bitmap0 =
2586expecting 6 dirty sectors; have 6. OK!
2587
2588--- Reference Backup #1 ---
2589
2590{}
2591{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2592{"return": {}}
2593{}
2594{}
2595{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2596{"return": {}}
2597{}
2598{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
2599{"return": {}}
2600{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2601
2602{"return": ""}
2603
2604--- Test Backup #1 ---
2605
2606{}
2607{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2608{"return": {}}
2609{}
2610{}
2611{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2612{"return": {}}
2613{}
2614{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "full", "target": "backup_target_1"}}
2615{"return": {}}
2616{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2617{"data": {"device": "backup_1", "error": "Input/output error", "len": 67108864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2618{
2619  "bitmaps": {
2620    "device0": [
2621      {
2622        "busy": false,
2623        "count": 393216,
2624        "granularity": 65536,
2625        "name": "bitmap0",
2626        "persistent": false,
2627        "recording": true,
2628        "status": "active"
2629      }
2630    ]
2631  }
2632}
2633
2634= Checking Bitmap bitmap0 =
2635expecting 6 dirty sectors; have 6. OK!
2636
2637--- Write #3 ---
2638
2639write -P0xaa 0x0010000 0x30000
2640{"return": ""}
2641write -P0xbb 0x00d8000 0x10000
2642{"return": ""}
2643write -P0xcc 0x2028000 0x10000
2644{"return": ""}
2645write -P0xdd 0x3fc0000 0x10000
2646{"return": ""}
2647{
2648  "bitmaps": {
2649    "device0": [
2650      {
2651        "busy": false,
2652        "count": 917504,
2653        "granularity": 65536,
2654        "name": "bitmap0",
2655        "persistent": false,
2656        "recording": true,
2657        "status": "active"
2658      }
2659    ]
2660  }
2661}
2662
2663= Checking Bitmap bitmap0 =
2664expecting 14 dirty sectors; have 14. OK!
2665
2666--- Reference Backup #2 ---
2667
2668{}
2669{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2670{"return": {}}
2671{}
2672{}
2673{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2674{"return": {}}
2675{}
2676{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
2677{"return": {}}
2678{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2679
2680--- Test Backup #2 ---
2681
2682{}
2683{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2684{"return": {}}
2685{}
2686{}
2687{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2688{"return": {}}
2689{}
2690{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
2691{"return": {}}
2692{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
2693{"return": {}}
2694{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2695{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2696{
2697  "bitmaps": {
2698    "device0": [
2699      {
2700        "busy": false,
2701        "count": 0,
2702        "granularity": 65536,
2703        "name": "bitmap0",
2704        "persistent": false,
2705        "recording": true,
2706        "status": "active"
2707      }
2708    ]
2709  }
2710}
2711
2712= Checking Bitmap bitmap0 =
2713expecting 0 dirty sectors; have 0. OK!
2714
2715--- Cleanup ---
2716
2717{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
2718{"return": {}}
2719{
2720  "bitmaps": {
2721    "device0": []
2722  }
2723}
2724
2725--- Verification ---
2726
2727qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
2728qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2729qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2730
2731
2732=== Mode full; Bitmap Sync on-success without failure ===
2733
2734--- Preparing image & VM ---
2735
2736{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
2737{"return": {}}
2738{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
2739{"return": {}}
2740
2741--- Write #0 ---
2742
2743write -P0x49 0x0000000 0x10000
2744{"return": ""}
2745write -P0x6c 0x0100000 0x10000
2746{"return": ""}
2747write -P0x6f 0x2000000 0x10000
2748{"return": ""}
2749write -P0x76 0x3ff0000 0x10000
2750{"return": ""}
2751{
2752  "bitmaps": {
2753    "device0": []
2754  }
2755}
2756
2757--- Reference Backup #0 ---
2758
2759{}
2760{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2761{"return": {}}
2762{}
2763{}
2764{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2765{"return": {}}
2766{}
2767{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
2768{"return": {}}
2769{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2770
2771--- Add Bitmap ---
2772
2773{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
2774{"return": {}}
2775
2776--- Write #1 ---
2777
2778write -P0x65 0x0000000 0x10000
2779{"return": ""}
2780write -P0x77 0x00f8000 0x10000
2781{"return": ""}
2782write -P0x72 0x2008000 0x10000
2783{"return": ""}
2784write -P0x69 0x3fe0000 0x10000
2785{"return": ""}
2786{
2787  "bitmaps": {
2788    "device0": [
2789      {
2790        "busy": false,
2791        "count": 393216,
2792        "granularity": 65536,
2793        "name": "bitmap0",
2794        "persistent": false,
2795        "recording": true,
2796        "status": "active"
2797      }
2798    ]
2799  }
2800}
2801
2802= Checking Bitmap bitmap0 =
2803expecting 6 dirty sectors; have 6. OK!
2804
2805--- Reference Backup #1 ---
2806
2807{}
2808{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2809{"return": {}}
2810{}
2811{}
2812{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2813{"return": {}}
2814{}
2815{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
2816{"return": {}}
2817{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2818
2819--- Test Backup #1 ---
2820
2821{}
2822{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2823{"return": {}}
2824{}
2825{}
2826{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2827{"return": {}}
2828{}
2829{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "full", "target": "backup_target_1"}}
2830{"return": {}}
2831
2832--- Write #2 ---
2833
2834write -P0x74 0x0010000 0x10000
2835{"return": ""}
2836write -P0x69 0x00e8000 0x10000
2837{"return": ""}
2838write -P0x6e 0x2018000 0x10000
2839{"return": ""}
2840write -P0x67 0x3fe0000 0x20000
2841{"return": ""}
2842{
2843  "bitmaps": {
2844    "device0": [
2845      {
2846        "busy": false,
2847        "count": 0,
2848        "granularity": 65536,
2849        "persistent": false,
2850        "recording": false,
2851        "status": "disabled"
2852      },
2853      {
2854        "busy": false,
2855        "count": 458752,
2856        "granularity": 65536,
2857        "persistent": false,
2858        "recording": true,
2859        "status": "active"
2860      },
2861      {
2862        "busy": true,
2863        "count": 393216,
2864        "granularity": 65536,
2865        "name": "bitmap0",
2866        "persistent": false,
2867        "recording": true,
2868        "status": "frozen"
2869      }
2870    ]
2871  }
2872}
2873
2874= Checking Bitmap bitmap0 =
2875expecting 6 dirty sectors; have 6. OK!
2876
2877= Checking Bitmap (anonymous) =
2878expecting 7 dirty sectors; have 7. OK!
2879
2880{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
2881{"return": {}}
2882{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2883{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2884{
2885  "bitmaps": {
2886    "device0": [
2887      {
2888        "busy": false,
2889        "count": 458752,
2890        "granularity": 65536,
2891        "name": "bitmap0",
2892        "persistent": false,
2893        "recording": true,
2894        "status": "active"
2895      }
2896    ]
2897  }
2898}
2899
2900= Checking Bitmap bitmap0 =
2901expecting 7 dirty sectors; have 7. OK!
2902
2903--- Write #3 ---
2904
2905write -P0xaa 0x0010000 0x30000
2906{"return": ""}
2907write -P0xbb 0x00d8000 0x10000
2908{"return": ""}
2909write -P0xcc 0x2028000 0x10000
2910{"return": ""}
2911write -P0xdd 0x3fc0000 0x10000
2912{"return": ""}
2913{
2914  "bitmaps": {
2915    "device0": [
2916      {
2917        "busy": false,
2918        "count": 786432,
2919        "granularity": 65536,
2920        "name": "bitmap0",
2921        "persistent": false,
2922        "recording": true,
2923        "status": "active"
2924      }
2925    ]
2926  }
2927}
2928
2929= Checking Bitmap bitmap0 =
2930expecting 12 dirty sectors; have 12. OK!
2931
2932--- Reference Backup #2 ---
2933
2934{}
2935{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2936{"return": {}}
2937{}
2938{}
2939{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2940{"return": {}}
2941{}
2942{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
2943{"return": {}}
2944{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2945
2946--- Test Backup #2 ---
2947
2948{}
2949{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
2950{"return": {}}
2951{}
2952{}
2953{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
2954{"return": {}}
2955{}
2956{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
2957{"return": {}}
2958{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
2959{"return": {}}
2960{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2961{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
2962{
2963  "bitmaps": {
2964    "device0": [
2965      {
2966        "busy": false,
2967        "count": 0,
2968        "granularity": 65536,
2969        "name": "bitmap0",
2970        "persistent": false,
2971        "recording": true,
2972        "status": "active"
2973      }
2974    ]
2975  }
2976}
2977
2978= Checking Bitmap bitmap0 =
2979expecting 0 dirty sectors; have 0. OK!
2980
2981--- Cleanup ---
2982
2983{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
2984{"return": {}}
2985{
2986  "bitmaps": {
2987    "device0": []
2988  }
2989}
2990
2991--- Verification ---
2992
2993qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
2994qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2995qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
2996
2997
2998=== Mode full; Bitmap Sync always with simulated failure ===
2999
3000--- Preparing image & VM ---
3001
3002{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
3003{"return": {}}
3004{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
3005{"return": {}}
3006
3007--- Write #0 ---
3008
3009write -P0x49 0x0000000 0x10000
3010{"return": ""}
3011write -P0x6c 0x0100000 0x10000
3012{"return": ""}
3013write -P0x6f 0x2000000 0x10000
3014{"return": ""}
3015write -P0x76 0x3ff0000 0x10000
3016{"return": ""}
3017{
3018  "bitmaps": {
3019    "device0": []
3020  }
3021}
3022
3023--- Reference Backup #0 ---
3024
3025{}
3026{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3027{"return": {}}
3028{}
3029{}
3030{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3031{"return": {}}
3032{}
3033{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
3034{"return": {}}
3035{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3036
3037--- Add Bitmap ---
3038
3039{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
3040{"return": {}}
3041
3042--- Write #1 ---
3043
3044write -P0x65 0x0000000 0x10000
3045{"return": ""}
3046write -P0x77 0x00f8000 0x10000
3047{"return": ""}
3048write -P0x72 0x2008000 0x10000
3049{"return": ""}
3050write -P0x69 0x3fe0000 0x10000
3051{"return": ""}
3052{
3053  "bitmaps": {
3054    "device0": [
3055      {
3056        "busy": false,
3057        "count": 393216,
3058        "granularity": 65536,
3059        "name": "bitmap0",
3060        "persistent": false,
3061        "recording": true,
3062        "status": "active"
3063      }
3064    ]
3065  }
3066}
3067
3068= Checking Bitmap bitmap0 =
3069expecting 6 dirty sectors; have 6. OK!
3070
3071--- Reference Backup #1 ---
3072
3073{}
3074{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3075{"return": {}}
3076{}
3077{}
3078{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3079{"return": {}}
3080{}
3081{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
3082{"return": {}}
3083{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3084
3085--- Test Backup #1 ---
3086
3087{}
3088{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3089{"return": {}}
3090{}
3091{}
3092{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3093{"return": {}}
3094{}
3095{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "full", "target": "backup_target_1"}}
3096{"return": {}}
3097
3098--- Write #2 ---
3099
3100write -P0x74 0x0010000 0x10000
3101{"return": ""}
3102write -P0x69 0x00e8000 0x10000
3103{"return": ""}
3104write -P0x6e 0x2018000 0x10000
3105{"return": ""}
3106write -P0x67 0x3fe0000 0x20000
3107{"return": ""}
3108{
3109  "bitmaps": {
3110    "device0": [
3111      {
3112        "busy": false,
3113        "count": 0,
3114        "granularity": 65536,
3115        "persistent": false,
3116        "recording": false,
3117        "status": "disabled"
3118      },
3119      {
3120        "busy": false,
3121        "count": 458752,
3122        "granularity": 65536,
3123        "persistent": false,
3124        "recording": true,
3125        "status": "active"
3126      },
3127      {
3128        "busy": true,
3129        "count": 393216,
3130        "granularity": 65536,
3131        "name": "bitmap0",
3132        "persistent": false,
3133        "recording": true,
3134        "status": "frozen"
3135      }
3136    ]
3137  }
3138}
3139
3140= Checking Bitmap bitmap0 =
3141expecting 6 dirty sectors; have 6. OK!
3142
3143= Checking Bitmap (anonymous) =
3144expecting 7 dirty sectors; have 7. OK!
3145
3146{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
3147{"return": {}}
3148{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3149{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3150{
3151  "bitmaps": {
3152    "device0": [
3153      {
3154        "busy": false,
3155        "count": 458752,
3156        "granularity": 65536,
3157        "name": "bitmap0",
3158        "persistent": false,
3159        "recording": true,
3160        "status": "active"
3161      }
3162    ]
3163  }
3164}
3165
3166= Checking Bitmap bitmap0 =
3167expecting 7 dirty sectors; have 7. OK!
3168
3169--- Write #3 ---
3170
3171write -P0xaa 0x0010000 0x30000
3172{"return": ""}
3173write -P0xbb 0x00d8000 0x10000
3174{"return": ""}
3175write -P0xcc 0x2028000 0x10000
3176{"return": ""}
3177write -P0xdd 0x3fc0000 0x10000
3178{"return": ""}
3179{
3180  "bitmaps": {
3181    "device0": [
3182      {
3183        "busy": false,
3184        "count": 786432,
3185        "granularity": 65536,
3186        "name": "bitmap0",
3187        "persistent": false,
3188        "recording": true,
3189        "status": "active"
3190      }
3191    ]
3192  }
3193}
3194
3195= Checking Bitmap bitmap0 =
3196expecting 12 dirty sectors; have 12. OK!
3197
3198--- Reference Backup #2 ---
3199
3200{}
3201{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3202{"return": {}}
3203{}
3204{}
3205{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3206{"return": {}}
3207{}
3208{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
3209{"return": {}}
3210{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3211
3212--- Test Backup #2 ---
3213
3214{}
3215{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3216{"return": {}}
3217{}
3218{}
3219{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3220{"return": {}}
3221{}
3222{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
3223{"return": {}}
3224{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
3225{"return": {}}
3226{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3227{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3228{
3229  "bitmaps": {
3230    "device0": [
3231      {
3232        "busy": false,
3233        "count": 0,
3234        "granularity": 65536,
3235        "name": "bitmap0",
3236        "persistent": false,
3237        "recording": true,
3238        "status": "active"
3239      }
3240    ]
3241  }
3242}
3243
3244= Checking Bitmap bitmap0 =
3245expecting 0 dirty sectors; have 0. OK!
3246
3247--- Cleanup ---
3248
3249{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
3250{"return": {}}
3251{
3252  "bitmaps": {
3253    "device0": []
3254  }
3255}
3256
3257--- Verification ---
3258
3259qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
3260qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
3261qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
3262
3263
3264=== Mode full; Bitmap Sync always with intermediate failure ===
3265
3266--- Preparing image & VM ---
3267
3268{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
3269{"return": {}}
3270{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
3271{"return": {}}
3272
3273--- Write #0 ---
3274
3275write -P0x49 0x0000000 0x10000
3276{"return": ""}
3277write -P0x6c 0x0100000 0x10000
3278{"return": ""}
3279write -P0x6f 0x2000000 0x10000
3280{"return": ""}
3281write -P0x76 0x3ff0000 0x10000
3282{"return": ""}
3283{
3284  "bitmaps": {
3285    "device0": []
3286  }
3287}
3288
3289--- Reference Backup #0 ---
3290
3291{}
3292{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3293{"return": {}}
3294{}
3295{}
3296{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3297{"return": {}}
3298{}
3299{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
3300{"return": {}}
3301{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3302
3303--- Add Bitmap ---
3304
3305{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
3306{"return": {}}
3307
3308--- Write #1 ---
3309
3310write -P0x65 0x0000000 0x10000
3311{"return": ""}
3312write -P0x77 0x00f8000 0x10000
3313{"return": ""}
3314write -P0x72 0x2008000 0x10000
3315{"return": ""}
3316write -P0x69 0x3fe0000 0x10000
3317{"return": ""}
3318{
3319  "bitmaps": {
3320    "device0": [
3321      {
3322        "busy": false,
3323        "count": 393216,
3324        "granularity": 65536,
3325        "name": "bitmap0",
3326        "persistent": false,
3327        "recording": true,
3328        "status": "active"
3329      }
3330    ]
3331  }
3332}
3333
3334= Checking Bitmap bitmap0 =
3335expecting 6 dirty sectors; have 6. OK!
3336
3337--- Reference Backup #1 ---
3338
3339{}
3340{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3341{"return": {}}
3342{}
3343{}
3344{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3345{"return": {}}
3346{}
3347{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
3348{"return": {}}
3349{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3350
3351{"return": ""}
3352
3353--- Test Backup #1 ---
3354
3355{}
3356{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3357{"return": {}}
3358{}
3359{}
3360{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3361{"return": {}}
3362{}
3363{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "full", "target": "backup_target_1"}}
3364{"return": {}}
3365{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3366{"data": {"device": "backup_1", "error": "Input/output error", "len": 67108864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3367{
3368  "bitmaps": {
3369    "device0": [
3370      {
3371        "busy": false,
3372        "count": 66125824,
3373        "granularity": 65536,
3374        "name": "bitmap0",
3375        "persistent": false,
3376        "recording": true,
3377        "status": "active"
3378      }
3379    ]
3380  }
3381}
3382
3383= Checking Bitmap bitmap0 =
3384expecting 1009 dirty sectors; have 1009. OK!
3385
3386--- Write #3 ---
3387
3388write -P0xaa 0x0010000 0x30000
3389{"return": ""}
3390write -P0xbb 0x00d8000 0x10000
3391{"return": ""}
3392write -P0xcc 0x2028000 0x10000
3393{"return": ""}
3394write -P0xdd 0x3fc0000 0x10000
3395{"return": ""}
3396{
3397  "bitmaps": {
3398    "device0": [
3399      {
3400        "busy": false,
3401        "count": 66453504,
3402        "granularity": 65536,
3403        "name": "bitmap0",
3404        "persistent": false,
3405        "recording": true,
3406        "status": "active"
3407      }
3408    ]
3409  }
3410}
3411
3412= Checking Bitmap bitmap0 =
3413expecting 1014 dirty sectors; have 1014. OK!
3414
3415--- Reference Backup #2 ---
3416
3417{}
3418{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3419{"return": {}}
3420{}
3421{}
3422{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3423{"return": {}}
3424{}
3425{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
3426{"return": {}}
3427{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3428
3429--- Test Backup #2 ---
3430
3431{}
3432{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3433{"return": {}}
3434{}
3435{}
3436{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3437{"return": {}}
3438{}
3439{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
3440{"return": {}}
3441{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
3442{"return": {}}
3443{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3444{"data": {"device": "backup_2", "len": 66453504, "offset": 66453504, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3445{
3446  "bitmaps": {
3447    "device0": [
3448      {
3449        "busy": false,
3450        "count": 0,
3451        "granularity": 65536,
3452        "name": "bitmap0",
3453        "persistent": false,
3454        "recording": true,
3455        "status": "active"
3456      }
3457    ]
3458  }
3459}
3460
3461= Checking Bitmap bitmap0 =
3462expecting 0 dirty sectors; have 0. OK!
3463
3464--- Cleanup ---
3465
3466{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
3467{"return": {}}
3468{
3469  "bitmaps": {
3470    "device0": []
3471  }
3472}
3473
3474--- Verification ---
3475
3476qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
3477qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
3478qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
3479
3480
3481=== Mode full; Bitmap Sync always without failure ===
3482
3483--- Preparing image & VM ---
3484
3485{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
3486{"return": {}}
3487{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
3488{"return": {}}
3489
3490--- Write #0 ---
3491
3492write -P0x49 0x0000000 0x10000
3493{"return": ""}
3494write -P0x6c 0x0100000 0x10000
3495{"return": ""}
3496write -P0x6f 0x2000000 0x10000
3497{"return": ""}
3498write -P0x76 0x3ff0000 0x10000
3499{"return": ""}
3500{
3501  "bitmaps": {
3502    "device0": []
3503  }
3504}
3505
3506--- Reference Backup #0 ---
3507
3508{}
3509{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3510{"return": {}}
3511{}
3512{}
3513{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3514{"return": {}}
3515{}
3516{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
3517{"return": {}}
3518{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3519
3520--- Add Bitmap ---
3521
3522{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
3523{"return": {}}
3524
3525--- Write #1 ---
3526
3527write -P0x65 0x0000000 0x10000
3528{"return": ""}
3529write -P0x77 0x00f8000 0x10000
3530{"return": ""}
3531write -P0x72 0x2008000 0x10000
3532{"return": ""}
3533write -P0x69 0x3fe0000 0x10000
3534{"return": ""}
3535{
3536  "bitmaps": {
3537    "device0": [
3538      {
3539        "busy": false,
3540        "count": 393216,
3541        "granularity": 65536,
3542        "name": "bitmap0",
3543        "persistent": false,
3544        "recording": true,
3545        "status": "active"
3546      }
3547    ]
3548  }
3549}
3550
3551= Checking Bitmap bitmap0 =
3552expecting 6 dirty sectors; have 6. OK!
3553
3554--- Reference Backup #1 ---
3555
3556{}
3557{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3558{"return": {}}
3559{}
3560{}
3561{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3562{"return": {}}
3563{}
3564{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
3565{"return": {}}
3566{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3567
3568--- Test Backup #1 ---
3569
3570{}
3571{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3572{"return": {}}
3573{}
3574{}
3575{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3576{"return": {}}
3577{}
3578{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "full", "target": "backup_target_1"}}
3579{"return": {}}
3580
3581--- Write #2 ---
3582
3583write -P0x74 0x0010000 0x10000
3584{"return": ""}
3585write -P0x69 0x00e8000 0x10000
3586{"return": ""}
3587write -P0x6e 0x2018000 0x10000
3588{"return": ""}
3589write -P0x67 0x3fe0000 0x20000
3590{"return": ""}
3591{
3592  "bitmaps": {
3593    "device0": [
3594      {
3595        "busy": false,
3596        "count": 0,
3597        "granularity": 65536,
3598        "persistent": false,
3599        "recording": false,
3600        "status": "disabled"
3601      },
3602      {
3603        "busy": false,
3604        "count": 458752,
3605        "granularity": 65536,
3606        "persistent": false,
3607        "recording": true,
3608        "status": "active"
3609      },
3610      {
3611        "busy": true,
3612        "count": 393216,
3613        "granularity": 65536,
3614        "name": "bitmap0",
3615        "persistent": false,
3616        "recording": true,
3617        "status": "frozen"
3618      }
3619    ]
3620  }
3621}
3622
3623= Checking Bitmap bitmap0 =
3624expecting 6 dirty sectors; have 6. OK!
3625
3626= Checking Bitmap (anonymous) =
3627expecting 7 dirty sectors; have 7. OK!
3628
3629{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
3630{"return": {}}
3631{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3632{"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3633{
3634  "bitmaps": {
3635    "device0": [
3636      {
3637        "busy": false,
3638        "count": 458752,
3639        "granularity": 65536,
3640        "name": "bitmap0",
3641        "persistent": false,
3642        "recording": true,
3643        "status": "active"
3644      }
3645    ]
3646  }
3647}
3648
3649= Checking Bitmap bitmap0 =
3650expecting 7 dirty sectors; have 7. OK!
3651
3652--- Write #3 ---
3653
3654write -P0xaa 0x0010000 0x30000
3655{"return": ""}
3656write -P0xbb 0x00d8000 0x10000
3657{"return": ""}
3658write -P0xcc 0x2028000 0x10000
3659{"return": ""}
3660write -P0xdd 0x3fc0000 0x10000
3661{"return": ""}
3662{
3663  "bitmaps": {
3664    "device0": [
3665      {
3666        "busy": false,
3667        "count": 786432,
3668        "granularity": 65536,
3669        "name": "bitmap0",
3670        "persistent": false,
3671        "recording": true,
3672        "status": "active"
3673      }
3674    ]
3675  }
3676}
3677
3678= Checking Bitmap bitmap0 =
3679expecting 12 dirty sectors; have 12. OK!
3680
3681--- Reference Backup #2 ---
3682
3683{}
3684{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3685{"return": {}}
3686{}
3687{}
3688{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3689{"return": {}}
3690{}
3691{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
3692{"return": {}}
3693{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3694
3695--- Test Backup #2 ---
3696
3697{}
3698{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3699{"return": {}}
3700{}
3701{}
3702{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3703{"return": {}}
3704{}
3705{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
3706{"return": {}}
3707{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
3708{"return": {}}
3709{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3710{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3711{
3712  "bitmaps": {
3713    "device0": [
3714      {
3715        "busy": false,
3716        "count": 0,
3717        "granularity": 65536,
3718        "name": "bitmap0",
3719        "persistent": false,
3720        "recording": true,
3721        "status": "active"
3722      }
3723    ]
3724  }
3725}
3726
3727= Checking Bitmap bitmap0 =
3728expecting 0 dirty sectors; have 0. OK!
3729
3730--- Cleanup ---
3731
3732{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
3733{"return": {}}
3734{
3735  "bitmaps": {
3736    "device0": []
3737  }
3738}
3739
3740--- Verification ---
3741
3742qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
3743qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
3744qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
3745
3746
3747=== Mode top; Bitmap Sync on-success with simulated failure ===
3748
3749--- Preparing image & VM ---
3750
3751{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
3752{"return": {}}
3753{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
3754{"return": {}}
3755
3756--- Write #0 ---
3757
3758write -P0x49 0x0000000 0x10000
3759{"return": ""}
3760write -P0x6c 0x0100000 0x10000
3761{"return": ""}
3762write -P0x6f 0x2000000 0x10000
3763{"return": ""}
3764write -P0x76 0x3ff0000 0x10000
3765{"return": ""}
3766{
3767  "bitmaps": {
3768    "device0": []
3769  }
3770}
3771
3772--- Reference Backup #0 ---
3773
3774{}
3775{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3776{"return": {}}
3777{}
3778{}
3779{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3780{"return": {}}
3781{}
3782{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
3783{"return": {}}
3784{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3785
3786--- Add Bitmap ---
3787
3788{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
3789{"return": {}}
3790
3791--- Write #1 ---
3792
3793write -P0x65 0x0000000 0x10000
3794{"return": ""}
3795write -P0x77 0x00f8000 0x10000
3796{"return": ""}
3797write -P0x72 0x2008000 0x10000
3798{"return": ""}
3799write -P0x69 0x3fe0000 0x10000
3800{"return": ""}
3801{
3802  "bitmaps": {
3803    "device0": [
3804      {
3805        "busy": false,
3806        "count": 393216,
3807        "granularity": 65536,
3808        "name": "bitmap0",
3809        "persistent": false,
3810        "recording": true,
3811        "status": "active"
3812      }
3813    ]
3814  }
3815}
3816
3817= Checking Bitmap bitmap0 =
3818expecting 6 dirty sectors; have 6. OK!
3819
3820--- Reference Backup #1 ---
3821
3822{}
3823{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3824{"return": {}}
3825{}
3826{}
3827{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3828{"return": {}}
3829{}
3830{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
3831{"return": {}}
3832{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3833
3834--- Test Backup #1 ---
3835
3836{}
3837{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3838{"return": {}}
3839{}
3840{}
3841{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3842{"return": {}}
3843{}
3844{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "top", "target": "backup_target_1"}}
3845{"return": {}}
3846
3847--- Write #2 ---
3848
3849write -P0x74 0x0010000 0x10000
3850{"return": ""}
3851write -P0x69 0x00e8000 0x10000
3852{"return": ""}
3853write -P0x6e 0x2018000 0x10000
3854{"return": ""}
3855write -P0x67 0x3fe0000 0x20000
3856{"return": ""}
3857{
3858  "bitmaps": {
3859    "device0": [
3860      {
3861        "busy": false,
3862        "count": 0,
3863        "granularity": 65536,
3864        "persistent": false,
3865        "recording": false,
3866        "status": "disabled"
3867      },
3868      {
3869        "busy": false,
3870        "count": 458752,
3871        "granularity": 65536,
3872        "persistent": false,
3873        "recording": true,
3874        "status": "active"
3875      },
3876      {
3877        "busy": true,
3878        "count": 393216,
3879        "granularity": 65536,
3880        "name": "bitmap0",
3881        "persistent": false,
3882        "recording": true,
3883        "status": "frozen"
3884      }
3885    ]
3886  }
3887}
3888
3889= Checking Bitmap bitmap0 =
3890expecting 6 dirty sectors; have 6. OK!
3891
3892= Checking Bitmap (anonymous) =
3893expecting 7 dirty sectors; have 7. OK!
3894
3895{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
3896{"return": {}}
3897{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3898{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3899{
3900  "bitmaps": {
3901    "device0": [
3902      {
3903        "busy": false,
3904        "count": 655360,
3905        "granularity": 65536,
3906        "name": "bitmap0",
3907        "persistent": false,
3908        "recording": true,
3909        "status": "active"
3910      }
3911    ]
3912  }
3913}
3914
3915= Checking Bitmap bitmap0 =
3916expecting 10 dirty sectors; have 10. OK!
3917
3918--- Write #3 ---
3919
3920write -P0xaa 0x0010000 0x30000
3921{"return": ""}
3922write -P0xbb 0x00d8000 0x10000
3923{"return": ""}
3924write -P0xcc 0x2028000 0x10000
3925{"return": ""}
3926write -P0xdd 0x3fc0000 0x10000
3927{"return": ""}
3928{
3929  "bitmaps": {
3930    "device0": [
3931      {
3932        "busy": false,
3933        "count": 983040,
3934        "granularity": 65536,
3935        "name": "bitmap0",
3936        "persistent": false,
3937        "recording": true,
3938        "status": "active"
3939      }
3940    ]
3941  }
3942}
3943
3944= Checking Bitmap bitmap0 =
3945expecting 15 dirty sectors; have 15. OK!
3946
3947--- Reference Backup #2 ---
3948
3949{}
3950{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3951{"return": {}}
3952{}
3953{}
3954{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3955{"return": {}}
3956{}
3957{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
3958{"return": {}}
3959{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3960
3961--- Test Backup #2 ---
3962
3963{}
3964{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
3965{"return": {}}
3966{}
3967{}
3968{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
3969{"return": {}}
3970{}
3971{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
3972{"return": {}}
3973{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
3974{"return": {}}
3975{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3976{"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
3977{
3978  "bitmaps": {
3979    "device0": [
3980      {
3981        "busy": false,
3982        "count": 0,
3983        "granularity": 65536,
3984        "name": "bitmap0",
3985        "persistent": false,
3986        "recording": true,
3987        "status": "active"
3988      }
3989    ]
3990  }
3991}
3992
3993= Checking Bitmap bitmap0 =
3994expecting 0 dirty sectors; have 0. OK!
3995
3996--- Cleanup ---
3997
3998{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
3999{"return": {}}
4000{
4001  "bitmaps": {
4002    "device0": []
4003  }
4004}
4005
4006--- Verification ---
4007
4008qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
4009qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4010qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4011
4012
4013=== Mode top; Bitmap Sync on-success with intermediate failure ===
4014
4015--- Preparing image & VM ---
4016
4017{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
4018{"return": {}}
4019{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
4020{"return": {}}
4021
4022--- Write #0 ---
4023
4024write -P0x49 0x0000000 0x10000
4025{"return": ""}
4026write -P0x6c 0x0100000 0x10000
4027{"return": ""}
4028write -P0x6f 0x2000000 0x10000
4029{"return": ""}
4030write -P0x76 0x3ff0000 0x10000
4031{"return": ""}
4032{
4033  "bitmaps": {
4034    "device0": []
4035  }
4036}
4037
4038--- Reference Backup #0 ---
4039
4040{}
4041{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4042{"return": {}}
4043{}
4044{}
4045{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4046{"return": {}}
4047{}
4048{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
4049{"return": {}}
4050{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4051
4052--- Add Bitmap ---
4053
4054{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
4055{"return": {}}
4056
4057--- Write #1 ---
4058
4059write -P0x65 0x0000000 0x10000
4060{"return": ""}
4061write -P0x77 0x00f8000 0x10000
4062{"return": ""}
4063write -P0x72 0x2008000 0x10000
4064{"return": ""}
4065write -P0x69 0x3fe0000 0x10000
4066{"return": ""}
4067{
4068  "bitmaps": {
4069    "device0": [
4070      {
4071        "busy": false,
4072        "count": 393216,
4073        "granularity": 65536,
4074        "name": "bitmap0",
4075        "persistent": false,
4076        "recording": true,
4077        "status": "active"
4078      }
4079    ]
4080  }
4081}
4082
4083= Checking Bitmap bitmap0 =
4084expecting 6 dirty sectors; have 6. OK!
4085
4086--- Reference Backup #1 ---
4087
4088{}
4089{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4090{"return": {}}
4091{}
4092{}
4093{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4094{"return": {}}
4095{}
4096{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
4097{"return": {}}
4098{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4099
4100{"return": ""}
4101
4102--- Test Backup #1 ---
4103
4104{}
4105{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4106{"return": {}}
4107{}
4108{}
4109{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4110{"return": {}}
4111{}
4112{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "top", "target": "backup_target_1"}}
4113{"return": {}}
4114{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4115{"data": {"device": "backup_1", "error": "Input/output error", "len": 458752, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4116{
4117  "bitmaps": {
4118    "device0": [
4119      {
4120        "busy": false,
4121        "count": 393216,
4122        "granularity": 65536,
4123        "name": "bitmap0",
4124        "persistent": false,
4125        "recording": true,
4126        "status": "active"
4127      }
4128    ]
4129  }
4130}
4131
4132= Checking Bitmap bitmap0 =
4133expecting 6 dirty sectors; have 6. OK!
4134
4135--- Write #3 ---
4136
4137write -P0xaa 0x0010000 0x30000
4138{"return": ""}
4139write -P0xbb 0x00d8000 0x10000
4140{"return": ""}
4141write -P0xcc 0x2028000 0x10000
4142{"return": ""}
4143write -P0xdd 0x3fc0000 0x10000
4144{"return": ""}
4145{
4146  "bitmaps": {
4147    "device0": [
4148      {
4149        "busy": false,
4150        "count": 917504,
4151        "granularity": 65536,
4152        "name": "bitmap0",
4153        "persistent": false,
4154        "recording": true,
4155        "status": "active"
4156      }
4157    ]
4158  }
4159}
4160
4161= Checking Bitmap bitmap0 =
4162expecting 14 dirty sectors; have 14. OK!
4163
4164--- Reference Backup #2 ---
4165
4166{}
4167{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4168{"return": {}}
4169{}
4170{}
4171{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4172{"return": {}}
4173{}
4174{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
4175{"return": {}}
4176{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4177
4178--- Test Backup #2 ---
4179
4180{}
4181{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4182{"return": {}}
4183{}
4184{}
4185{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4186{"return": {}}
4187{}
4188{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
4189{"return": {}}
4190{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
4191{"return": {}}
4192{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4193{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4194{
4195  "bitmaps": {
4196    "device0": [
4197      {
4198        "busy": false,
4199        "count": 0,
4200        "granularity": 65536,
4201        "name": "bitmap0",
4202        "persistent": false,
4203        "recording": true,
4204        "status": "active"
4205      }
4206    ]
4207  }
4208}
4209
4210= Checking Bitmap bitmap0 =
4211expecting 0 dirty sectors; have 0. OK!
4212
4213--- Cleanup ---
4214
4215{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
4216{"return": {}}
4217{
4218  "bitmaps": {
4219    "device0": []
4220  }
4221}
4222
4223--- Verification ---
4224
4225qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
4226qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4227qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4228
4229
4230=== Mode top; Bitmap Sync on-success without failure ===
4231
4232--- Preparing image & VM ---
4233
4234{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
4235{"return": {}}
4236{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
4237{"return": {}}
4238
4239--- Write #0 ---
4240
4241write -P0x49 0x0000000 0x10000
4242{"return": ""}
4243write -P0x6c 0x0100000 0x10000
4244{"return": ""}
4245write -P0x6f 0x2000000 0x10000
4246{"return": ""}
4247write -P0x76 0x3ff0000 0x10000
4248{"return": ""}
4249{
4250  "bitmaps": {
4251    "device0": []
4252  }
4253}
4254
4255--- Reference Backup #0 ---
4256
4257{}
4258{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4259{"return": {}}
4260{}
4261{}
4262{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4263{"return": {}}
4264{}
4265{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
4266{"return": {}}
4267{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4268
4269--- Add Bitmap ---
4270
4271{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
4272{"return": {}}
4273
4274--- Write #1 ---
4275
4276write -P0x65 0x0000000 0x10000
4277{"return": ""}
4278write -P0x77 0x00f8000 0x10000
4279{"return": ""}
4280write -P0x72 0x2008000 0x10000
4281{"return": ""}
4282write -P0x69 0x3fe0000 0x10000
4283{"return": ""}
4284{
4285  "bitmaps": {
4286    "device0": [
4287      {
4288        "busy": false,
4289        "count": 393216,
4290        "granularity": 65536,
4291        "name": "bitmap0",
4292        "persistent": false,
4293        "recording": true,
4294        "status": "active"
4295      }
4296    ]
4297  }
4298}
4299
4300= Checking Bitmap bitmap0 =
4301expecting 6 dirty sectors; have 6. OK!
4302
4303--- Reference Backup #1 ---
4304
4305{}
4306{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4307{"return": {}}
4308{}
4309{}
4310{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4311{"return": {}}
4312{}
4313{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
4314{"return": {}}
4315{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4316
4317--- Test Backup #1 ---
4318
4319{}
4320{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4321{"return": {}}
4322{}
4323{}
4324{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4325{"return": {}}
4326{}
4327{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_1", "sync": "top", "target": "backup_target_1"}}
4328{"return": {}}
4329
4330--- Write #2 ---
4331
4332write -P0x74 0x0010000 0x10000
4333{"return": ""}
4334write -P0x69 0x00e8000 0x10000
4335{"return": ""}
4336write -P0x6e 0x2018000 0x10000
4337{"return": ""}
4338write -P0x67 0x3fe0000 0x20000
4339{"return": ""}
4340{
4341  "bitmaps": {
4342    "device0": [
4343      {
4344        "busy": false,
4345        "count": 0,
4346        "granularity": 65536,
4347        "persistent": false,
4348        "recording": false,
4349        "status": "disabled"
4350      },
4351      {
4352        "busy": false,
4353        "count": 458752,
4354        "granularity": 65536,
4355        "persistent": false,
4356        "recording": true,
4357        "status": "active"
4358      },
4359      {
4360        "busy": true,
4361        "count": 393216,
4362        "granularity": 65536,
4363        "name": "bitmap0",
4364        "persistent": false,
4365        "recording": true,
4366        "status": "frozen"
4367      }
4368    ]
4369  }
4370}
4371
4372= Checking Bitmap bitmap0 =
4373expecting 6 dirty sectors; have 6. OK!
4374
4375= Checking Bitmap (anonymous) =
4376expecting 7 dirty sectors; have 7. OK!
4377
4378{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
4379{"return": {}}
4380{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4381{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4382{
4383  "bitmaps": {
4384    "device0": [
4385      {
4386        "busy": false,
4387        "count": 458752,
4388        "granularity": 65536,
4389        "name": "bitmap0",
4390        "persistent": false,
4391        "recording": true,
4392        "status": "active"
4393      }
4394    ]
4395  }
4396}
4397
4398= Checking Bitmap bitmap0 =
4399expecting 7 dirty sectors; have 7. OK!
4400
4401--- Write #3 ---
4402
4403write -P0xaa 0x0010000 0x30000
4404{"return": ""}
4405write -P0xbb 0x00d8000 0x10000
4406{"return": ""}
4407write -P0xcc 0x2028000 0x10000
4408{"return": ""}
4409write -P0xdd 0x3fc0000 0x10000
4410{"return": ""}
4411{
4412  "bitmaps": {
4413    "device0": [
4414      {
4415        "busy": false,
4416        "count": 786432,
4417        "granularity": 65536,
4418        "name": "bitmap0",
4419        "persistent": false,
4420        "recording": true,
4421        "status": "active"
4422      }
4423    ]
4424  }
4425}
4426
4427= Checking Bitmap bitmap0 =
4428expecting 12 dirty sectors; have 12. OK!
4429
4430--- Reference Backup #2 ---
4431
4432{}
4433{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4434{"return": {}}
4435{}
4436{}
4437{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4438{"return": {}}
4439{}
4440{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
4441{"return": {}}
4442{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4443
4444--- Test Backup #2 ---
4445
4446{}
4447{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4448{"return": {}}
4449{}
4450{}
4451{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4452{"return": {}}
4453{}
4454{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
4455{"return": {}}
4456{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
4457{"return": {}}
4458{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4459{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4460{
4461  "bitmaps": {
4462    "device0": [
4463      {
4464        "busy": false,
4465        "count": 0,
4466        "granularity": 65536,
4467        "name": "bitmap0",
4468        "persistent": false,
4469        "recording": true,
4470        "status": "active"
4471      }
4472    ]
4473  }
4474}
4475
4476= Checking Bitmap bitmap0 =
4477expecting 0 dirty sectors; have 0. OK!
4478
4479--- Cleanup ---
4480
4481{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
4482{"return": {}}
4483{
4484  "bitmaps": {
4485    "device0": []
4486  }
4487}
4488
4489--- Verification ---
4490
4491qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
4492qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4493qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4494
4495
4496=== Mode top; Bitmap Sync always with simulated failure ===
4497
4498--- Preparing image & VM ---
4499
4500{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
4501{"return": {}}
4502{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
4503{"return": {}}
4504
4505--- Write #0 ---
4506
4507write -P0x49 0x0000000 0x10000
4508{"return": ""}
4509write -P0x6c 0x0100000 0x10000
4510{"return": ""}
4511write -P0x6f 0x2000000 0x10000
4512{"return": ""}
4513write -P0x76 0x3ff0000 0x10000
4514{"return": ""}
4515{
4516  "bitmaps": {
4517    "device0": []
4518  }
4519}
4520
4521--- Reference Backup #0 ---
4522
4523{}
4524{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4525{"return": {}}
4526{}
4527{}
4528{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4529{"return": {}}
4530{}
4531{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
4532{"return": {}}
4533{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4534
4535--- Add Bitmap ---
4536
4537{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
4538{"return": {}}
4539
4540--- Write #1 ---
4541
4542write -P0x65 0x0000000 0x10000
4543{"return": ""}
4544write -P0x77 0x00f8000 0x10000
4545{"return": ""}
4546write -P0x72 0x2008000 0x10000
4547{"return": ""}
4548write -P0x69 0x3fe0000 0x10000
4549{"return": ""}
4550{
4551  "bitmaps": {
4552    "device0": [
4553      {
4554        "busy": false,
4555        "count": 393216,
4556        "granularity": 65536,
4557        "name": "bitmap0",
4558        "persistent": false,
4559        "recording": true,
4560        "status": "active"
4561      }
4562    ]
4563  }
4564}
4565
4566= Checking Bitmap bitmap0 =
4567expecting 6 dirty sectors; have 6. OK!
4568
4569--- Reference Backup #1 ---
4570
4571{}
4572{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4573{"return": {}}
4574{}
4575{}
4576{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4577{"return": {}}
4578{}
4579{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
4580{"return": {}}
4581{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4582
4583--- Test Backup #1 ---
4584
4585{}
4586{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4587{"return": {}}
4588{}
4589{}
4590{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4591{"return": {}}
4592{}
4593{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "top", "target": "backup_target_1"}}
4594{"return": {}}
4595
4596--- Write #2 ---
4597
4598write -P0x74 0x0010000 0x10000
4599{"return": ""}
4600write -P0x69 0x00e8000 0x10000
4601{"return": ""}
4602write -P0x6e 0x2018000 0x10000
4603{"return": ""}
4604write -P0x67 0x3fe0000 0x20000
4605{"return": ""}
4606{
4607  "bitmaps": {
4608    "device0": [
4609      {
4610        "busy": false,
4611        "count": 0,
4612        "granularity": 65536,
4613        "persistent": false,
4614        "recording": false,
4615        "status": "disabled"
4616      },
4617      {
4618        "busy": false,
4619        "count": 458752,
4620        "granularity": 65536,
4621        "persistent": false,
4622        "recording": true,
4623        "status": "active"
4624      },
4625      {
4626        "busy": true,
4627        "count": 393216,
4628        "granularity": 65536,
4629        "name": "bitmap0",
4630        "persistent": false,
4631        "recording": true,
4632        "status": "frozen"
4633      }
4634    ]
4635  }
4636}
4637
4638= Checking Bitmap bitmap0 =
4639expecting 6 dirty sectors; have 6. OK!
4640
4641= Checking Bitmap (anonymous) =
4642expecting 7 dirty sectors; have 7. OK!
4643
4644{"execute": "job-cancel", "arguments": {"id": "backup_1"}}
4645{"return": {}}
4646{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4647{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4648{
4649  "bitmaps": {
4650    "device0": [
4651      {
4652        "busy": false,
4653        "count": 458752,
4654        "granularity": 65536,
4655        "name": "bitmap0",
4656        "persistent": false,
4657        "recording": true,
4658        "status": "active"
4659      }
4660    ]
4661  }
4662}
4663
4664= Checking Bitmap bitmap0 =
4665expecting 7 dirty sectors; have 7. OK!
4666
4667--- Write #3 ---
4668
4669write -P0xaa 0x0010000 0x30000
4670{"return": ""}
4671write -P0xbb 0x00d8000 0x10000
4672{"return": ""}
4673write -P0xcc 0x2028000 0x10000
4674{"return": ""}
4675write -P0xdd 0x3fc0000 0x10000
4676{"return": ""}
4677{
4678  "bitmaps": {
4679    "device0": [
4680      {
4681        "busy": false,
4682        "count": 786432,
4683        "granularity": 65536,
4684        "name": "bitmap0",
4685        "persistent": false,
4686        "recording": true,
4687        "status": "active"
4688      }
4689    ]
4690  }
4691}
4692
4693= Checking Bitmap bitmap0 =
4694expecting 12 dirty sectors; have 12. OK!
4695
4696--- Reference Backup #2 ---
4697
4698{}
4699{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4700{"return": {}}
4701{}
4702{}
4703{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4704{"return": {}}
4705{}
4706{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
4707{"return": {}}
4708{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4709
4710--- Test Backup #2 ---
4711
4712{}
4713{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4714{"return": {}}
4715{}
4716{}
4717{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4718{"return": {}}
4719{}
4720{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
4721{"return": {}}
4722{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
4723{"return": {}}
4724{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4725{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4726{
4727  "bitmaps": {
4728    "device0": [
4729      {
4730        "busy": false,
4731        "count": 0,
4732        "granularity": 65536,
4733        "name": "bitmap0",
4734        "persistent": false,
4735        "recording": true,
4736        "status": "active"
4737      }
4738    ]
4739  }
4740}
4741
4742= Checking Bitmap bitmap0 =
4743expecting 0 dirty sectors; have 0. OK!
4744
4745--- Cleanup ---
4746
4747{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
4748{"return": {}}
4749{
4750  "bitmaps": {
4751    "device0": []
4752  }
4753}
4754
4755--- Verification ---
4756
4757qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
4758qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4759qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4760
4761
4762=== Mode top; Bitmap Sync always with intermediate failure ===
4763
4764--- Preparing image & VM ---
4765
4766{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false, "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new-state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]}, "node-name": "drive0"}}
4767{"return": {}}
4768{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
4769{"return": {}}
4770
4771--- Write #0 ---
4772
4773write -P0x49 0x0000000 0x10000
4774{"return": ""}
4775write -P0x6c 0x0100000 0x10000
4776{"return": ""}
4777write -P0x6f 0x2000000 0x10000
4778{"return": ""}
4779write -P0x76 0x3ff0000 0x10000
4780{"return": ""}
4781{
4782  "bitmaps": {
4783    "device0": []
4784  }
4785}
4786
4787--- Reference Backup #0 ---
4788
4789{}
4790{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4791{"return": {}}
4792{}
4793{}
4794{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4795{"return": {}}
4796{}
4797{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
4798{"return": {}}
4799{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4800
4801--- Add Bitmap ---
4802
4803{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
4804{"return": {}}
4805
4806--- Write #1 ---
4807
4808write -P0x65 0x0000000 0x10000
4809{"return": ""}
4810write -P0x77 0x00f8000 0x10000
4811{"return": ""}
4812write -P0x72 0x2008000 0x10000
4813{"return": ""}
4814write -P0x69 0x3fe0000 0x10000
4815{"return": ""}
4816{
4817  "bitmaps": {
4818    "device0": [
4819      {
4820        "busy": false,
4821        "count": 393216,
4822        "granularity": 65536,
4823        "name": "bitmap0",
4824        "persistent": false,
4825        "recording": true,
4826        "status": "active"
4827      }
4828    ]
4829  }
4830}
4831
4832= Checking Bitmap bitmap0 =
4833expecting 6 dirty sectors; have 6. OK!
4834
4835--- Reference Backup #1 ---
4836
4837{}
4838{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4839{"return": {}}
4840{}
4841{}
4842{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4843{"return": {}}
4844{}
4845{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
4846{"return": {}}
4847{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4848
4849{"return": ""}
4850
4851--- Test Backup #1 ---
4852
4853{}
4854{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4855{"return": {}}
4856{}
4857{}
4858{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4859{"return": {}}
4860{}
4861{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "top", "target": "backup_target_1"}}
4862{"return": {}}
4863{"data": {"action": "report", "device": "backup_1", "operation": "read"}, "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4864{"data": {"device": "backup_1", "error": "Input/output error", "len": 458752, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4865{
4866  "bitmaps": {
4867    "device0": [
4868      {
4869        "busy": false,
4870        "count": 393216,
4871        "granularity": 65536,
4872        "name": "bitmap0",
4873        "persistent": false,
4874        "recording": true,
4875        "status": "active"
4876      }
4877    ]
4878  }
4879}
4880
4881= Checking Bitmap bitmap0 =
4882expecting 6 dirty sectors; have 6. OK!
4883
4884--- Write #3 ---
4885
4886write -P0xaa 0x0010000 0x30000
4887{"return": ""}
4888write -P0xbb 0x00d8000 0x10000
4889{"return": ""}
4890write -P0xcc 0x2028000 0x10000
4891{"return": ""}
4892write -P0xdd 0x3fc0000 0x10000
4893{"return": ""}
4894{
4895  "bitmaps": {
4896    "device0": [
4897      {
4898        "busy": false,
4899        "count": 917504,
4900        "granularity": 65536,
4901        "name": "bitmap0",
4902        "persistent": false,
4903        "recording": true,
4904        "status": "active"
4905      }
4906    ]
4907  }
4908}
4909
4910= Checking Bitmap bitmap0 =
4911expecting 14 dirty sectors; have 14. OK!
4912
4913--- Reference Backup #2 ---
4914
4915{}
4916{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4917{"return": {}}
4918{}
4919{}
4920{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4921{"return": {}}
4922{}
4923{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
4924{"return": {}}
4925{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4926
4927--- Test Backup #2 ---
4928
4929{}
4930{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
4931{"return": {}}
4932{}
4933{}
4934{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
4935{"return": {}}
4936{}
4937{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
4938{"return": {}}
4939{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
4940{"return": {}}
4941{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4942{"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
4943{
4944  "bitmaps": {
4945    "device0": [
4946      {
4947        "busy": false,
4948        "count": 0,
4949        "granularity": 65536,
4950        "name": "bitmap0",
4951        "persistent": false,
4952        "recording": true,
4953        "status": "active"
4954      }
4955    ]
4956  }
4957}
4958
4959= Checking Bitmap bitmap0 =
4960expecting 0 dirty sectors; have 0. OK!
4961
4962--- Cleanup ---
4963
4964{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
4965{"return": {}}
4966{
4967  "bitmaps": {
4968    "device0": []
4969  }
4970}
4971
4972--- Verification ---
4973
4974qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Mismatch, OK!
4975qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4976qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
4977
4978
4979=== Mode top; Bitmap Sync always without failure ===
4980
4981--- Preparing image & VM ---
4982
4983{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
4984{"return": {}}
4985{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0", "share-rw": true}}
4986{"return": {}}
4987
4988--- Write #0 ---
4989
4990write -P0x49 0x0000000 0x10000
4991{"return": ""}
4992write -P0x6c 0x0100000 0x10000
4993{"return": ""}
4994write -P0x6f 0x2000000 0x10000
4995{"return": ""}
4996write -P0x76 0x3ff0000 0x10000
4997{"return": ""}
4998{
4999  "bitmaps": {
5000    "device0": []
5001  }
5002}
5003
5004--- Reference Backup #0 ---
5005
5006{}
5007{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
5008{"return": {}}
5009{}
5010{}
5011{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
5012{"return": {}}
5013{}
5014{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_0", "sync": "full", "target": "ref_target_0"}}
5015{"return": {}}
5016{"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5017
5018--- Add Bitmap ---
5019
5020{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
5021{"return": {}}
5022
5023--- Write #1 ---
5024
5025write -P0x65 0x0000000 0x10000
5026{"return": ""}
5027write -P0x77 0x00f8000 0x10000
5028{"return": ""}
5029write -P0x72 0x2008000 0x10000
5030{"return": ""}
5031write -P0x69 0x3fe0000 0x10000
5032{"return": ""}
5033{
5034  "bitmaps": {
5035    "device0": [
5036      {
5037        "busy": false,
5038        "count": 393216,
5039        "granularity": 65536,
5040        "name": "bitmap0",
5041        "persistent": false,
5042        "recording": true,
5043        "status": "active"
5044      }
5045    ]
5046  }
5047}
5048
5049= Checking Bitmap bitmap0 =
5050expecting 6 dirty sectors; have 6. OK!
5051
5052--- Reference Backup #1 ---
5053
5054{}
5055{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
5056{"return": {}}
5057{}
5058{}
5059{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
5060{"return": {}}
5061{}
5062{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_1", "sync": "full", "target": "ref_target_1"}}
5063{"return": {}}
5064{"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5065
5066--- Test Backup #1 ---
5067
5068{}
5069{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
5070{"return": {}}
5071{}
5072{}
5073{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
5074{"return": {}}
5075{}
5076{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_1", "sync": "top", "target": "backup_target_1"}}
5077{"return": {}}
5078
5079--- Write #2 ---
5080
5081write -P0x74 0x0010000 0x10000
5082{"return": ""}
5083write -P0x69 0x00e8000 0x10000
5084{"return": ""}
5085write -P0x6e 0x2018000 0x10000
5086{"return": ""}
5087write -P0x67 0x3fe0000 0x20000
5088{"return": ""}
5089{
5090  "bitmaps": {
5091    "device0": [
5092      {
5093        "busy": false,
5094        "count": 0,
5095        "granularity": 65536,
5096        "persistent": false,
5097        "recording": false,
5098        "status": "disabled"
5099      },
5100      {
5101        "busy": false,
5102        "count": 458752,
5103        "granularity": 65536,
5104        "persistent": false,
5105        "recording": true,
5106        "status": "active"
5107      },
5108      {
5109        "busy": true,
5110        "count": 393216,
5111        "granularity": 65536,
5112        "name": "bitmap0",
5113        "persistent": false,
5114        "recording": true,
5115        "status": "frozen"
5116      }
5117    ]
5118  }
5119}
5120
5121= Checking Bitmap bitmap0 =
5122expecting 6 dirty sectors; have 6. OK!
5123
5124= Checking Bitmap (anonymous) =
5125expecting 7 dirty sectors; have 7. OK!
5126
5127{"execute": "job-finalize", "arguments": {"id": "backup_1"}}
5128{"return": {}}
5129{"data": {"id": "backup_1", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5130{"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5131{
5132  "bitmaps": {
5133    "device0": [
5134      {
5135        "busy": false,
5136        "count": 458752,
5137        "granularity": 65536,
5138        "name": "bitmap0",
5139        "persistent": false,
5140        "recording": true,
5141        "status": "active"
5142      }
5143    ]
5144  }
5145}
5146
5147= Checking Bitmap bitmap0 =
5148expecting 7 dirty sectors; have 7. OK!
5149
5150--- Write #3 ---
5151
5152write -P0xaa 0x0010000 0x30000
5153{"return": ""}
5154write -P0xbb 0x00d8000 0x10000
5155{"return": ""}
5156write -P0xcc 0x2028000 0x10000
5157{"return": ""}
5158write -P0xdd 0x3fc0000 0x10000
5159{"return": ""}
5160{
5161  "bitmaps": {
5162    "device0": [
5163      {
5164        "busy": false,
5165        "count": 786432,
5166        "granularity": 65536,
5167        "name": "bitmap0",
5168        "persistent": false,
5169        "recording": true,
5170        "status": "active"
5171      }
5172    ]
5173  }
5174}
5175
5176= Checking Bitmap bitmap0 =
5177expecting 12 dirty sectors; have 12. OK!
5178
5179--- Reference Backup #2 ---
5180
5181{}
5182{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
5183{"return": {}}
5184{}
5185{}
5186{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
5187{"return": {}}
5188{}
5189{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "ref_backup_2", "sync": "full", "target": "ref_target_2"}}
5190{"return": {}}
5191{"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5192
5193--- Test Backup #2 ---
5194
5195{}
5196{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
5197{"return": {}}
5198{}
5199{}
5200{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
5201{"return": {}}
5202{}
5203{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "backup_2", "sync": "bitmap", "target": "backup_target_2"}}
5204{"return": {}}
5205{"execute": "job-finalize", "arguments": {"id": "backup_2"}}
5206{"return": {}}
5207{"data": {"id": "backup_2", "type": "backup"}, "event": "BLOCK_JOB_PENDING", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5208{"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
5209{
5210  "bitmaps": {
5211    "device0": [
5212      {
5213        "busy": false,
5214        "count": 0,
5215        "granularity": 65536,
5216        "name": "bitmap0",
5217        "persistent": false,
5218        "recording": true,
5219        "status": "active"
5220      }
5221    ]
5222  }
5223}
5224
5225= Checking Bitmap bitmap0 =
5226expecting 0 dirty sectors; have 0. OK!
5227
5228--- Cleanup ---
5229
5230{"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", "node": "drive0"}}
5231{"return": {}}
5232{
5233  "bitmaps": {
5234    "device0": []
5235  }
5236}
5237
5238--- Verification ---
5239
5240qemu_img compare "TEST_DIR/PID-bsync1" "TEST_DIR/PID-fbackup1" ==> Identical, OK!
5241qemu_img compare "TEST_DIR/PID-bsync2" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
5242qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbackup2" ==> Identical, OK!
5243
5244
5245=== API failure tests ===
5246
5247--- Preparing image & VM ---
5248
5249{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}}
5250{"return": {}}
5251{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi-hd", "id": "device0"}}
5252{"return": {}}
5253
5254{}
5255{"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}}
5256{"return": {}}
5257{}
5258{}
5259{"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}}
5260{"return": {}}
5261{}
5262
5263{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
5264{"return": {}}
5265
5266-- Testing invalid QMP commands --
5267
5268-- Sync mode incremental tests --
5269
5270{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5271{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'incremental' sync mode"}}
5272
5273{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5274{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'incremental' sync mode"}}
5275
5276{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5277{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'incremental' sync mode"}}
5278
5279{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5280{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'incremental' sync mode"}}
5281
5282{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5283{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5284
5285{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5286{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-success' when using sync mode 'incremental'"}}
5287
5288{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5289{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-success' when using sync mode 'incremental'"}}
5290
5291{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5292{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5293
5294{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5295{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-success' when using sync mode 'incremental'"}}
5296
5297{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup_target"}}
5298{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-success' when using sync mode 'incremental'"}}
5299
5300-- Sync mode bitmap tests --
5301
5302{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5303{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'bitmap' sync mode"}}
5304
5305{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5306{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'bitmap' sync mode"}}
5307
5308{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5309{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'bitmap' sync mode"}}
5310
5311{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5312{"error": {"class": "GenericError", "desc": "must provide a valid bitmap name for 'bitmap' sync mode"}}
5313
5314{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5315{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5316
5317{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5318{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5319
5320{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5321{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5322
5323{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5324{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5325
5326{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}}
5327{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be given when providing a bitmap"}}
5328
5329-- Sync mode full tests --
5330
5331{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5332{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5333
5334{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5335{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5336
5337{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5338{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5339
5340{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5341{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5342
5343{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5344{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5345
5346{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5347{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5348
5349{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5350{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5351
5352{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5353{"error": {"class": "GenericError", "desc": "Bitmap sync mode 'never' has no meaningful effect when combined with sync mode 'full'"}}
5354
5355{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}}
5356{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be given when providing a bitmap"}}
5357
5358-- Sync mode top tests --
5359
5360{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5361{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5362
5363{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5364{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5365
5366{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5367{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5368
5369{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5370{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5371
5372{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5373{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5374
5375{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5376{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5377
5378{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5379{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5380
5381{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5382{"error": {"class": "GenericError", "desc": "Bitmap sync mode 'never' has no meaningful effect when combined with sync mode 'top'"}}
5383
5384{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}}
5385{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be given when providing a bitmap"}}
5386
5387-- Sync mode none tests --
5388
5389{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5390{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5391
5392{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5393{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5394
5395{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5396{"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mode without a bitmap"}}
5397
5398{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5399{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5400
5401{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5402{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5403
5404{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5405{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5406
5407{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5408{"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not be found"}}
5409
5410{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5411{"error": {"class": "GenericError", "desc": "sync mode 'none' does not produce meaningful bitmap outputs"}}
5412
5413{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5414{"error": {"class": "GenericError", "desc": "sync mode 'none' does not produce meaningful bitmap outputs"}}
5415
5416{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5417{"error": {"class": "GenericError", "desc": "sync mode 'none' does not produce meaningful bitmap outputs"}}
5418
5419{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}}
5420{"error": {"class": "GenericError", "desc": "Bitmap sync mode must be given when providing a bitmap"}}
5421
5422