qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

257.out (164657B)


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