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