From: mahaocong <mahaoc...@didichuxing.com> This patch adds possibility to start mirroring with user-created-bitmap. The use-case is, for live migration with ceph rbd image. I think the new function may be used to reduce the initial dirty block number on drive-mirror by using user-created-bitmap instead of created from block-backing-chain, comparing with full mode and top mode, and thus accelerate the live-migration speed.
This function should be used with backup. My test steps is as follows: 1.create rbd image in ceph cluster, and map nbd device with rbd image. 2.create a new bitmap attached to drive. 3.create a full backup on nbd device and sync it to the rbd image. 4.create new image in destination host and set it's backingfile as rbd image. 5.start incremental mirroring to destination with dirty-bitmap from step 2. 6.live migrate VM to destination, bitmap should be migrated too. 7.unmap nbd in source host and map in destination. Then I can use incremental backup to sync data and renew bitmap. If live migrate VM again, repeat step 4 to step 7. The first live-migration depend on full backup, but in the next live-migration, we can reuse backup data and bitmap to reduce the initial dirty block number on mirror. User-created-bitmap should be migrated, which record dirty block starting in backup and in live-migration. mahaocong (1): mirror: add incremental mode support. when use incremental in drive-mirror by qmp-command, drive-mirror create unnamed-bitmap with the same granularity of user-bitmap setting on qmp-command. Next, copy It's hbitmap to unnamed-bitmap. Then, start mirror with this unnamed-bitmap. dirty-bitmap: add new API to copy dirty-bitmap. hbitmap: add new function to copy hbitmap. block/dirty-bitmap.c | 14 ++++++++++ block/mirror.c | 63 +++++++++++++++++++++++++++++++++++--------- blockdev.c | 36 +++++++++++++++++++++++-- include/block/block_int.h | 3 ++- include/block/dirty-bitmap.h | 3 +++ include/qemu/hbitmap.h | 2 ++ qapi/block-core.json | 9 ++++++- util/hbitmap.c | 28 ++++++++++++++++++++ 8 files changed, 141 insertions(+), 17 deletions(-) -- 2.14.1