the test result for this patch: the migration command : virsh migrate --live 165cf436-312f-47e7-90f2-f8aa63f34893 --copy-storage-all qemu+ssh://10.59.163.38/system
the qemu-img info on source host: qemu-img info /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2 image: /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2 file format: qcow2 virtual size: 1.0T (1095216660480 bytes) disk size: 1.5G (1638989824 bytes) cluster_size: 65536 backing file: /baseimage/img2016042213665396/img2016042213665396.qcow2 the qemu-img info on dest host(before apply patch): qemu-img info /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2 image: /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2 file format: qcow2 virtual size: 40G (42949672960 bytes) disk size: 4.1G (4423286784 bytes) cluster_size: 65536 backing file: /baseimage/img2016042213665396/img2016042213665396.qcow2 the qemu-img info on dest host(after apply patch): qemu-img info /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2 image: /instanceimage/165cf436-312f-47e7-90f2-f8aa63f34893/165cf436-312f-47e7-90f2-f8aa63f34893_vda.qcow2 file format: qcow2 virtual size: 40G (42949672960 bytes) disk size: 2.3G (2496200704 bytes) cluster_size: 65536 backing file: /baseimage/img2016042213665396/img2016042213665396.qcow2 the disk size reduce from 4.1G to 2.3G. On Thu, Apr 6, 2017 at 9:15 PM, <[email protected]> wrote: > From: Lidong Chen <[email protected]> > > BLOCK_SIZE is (1 << 20), qcow2 cluster size is 65536 by default, > this maybe cause the qcow2 file size is bigger after migration. > This patch check each cluster, use blk_pwrite_zeroes for each > zero cluster. > > Lidong Chen (2): > block: make bdrv_get_cluster_size public > migration/block: use blk_pwrite_zeroes for each zero cluster > > block/io.c | 2 +- > include/block/block.h | 1 + > migration/block.c | 34 ++++++++++++++++++++++++++++++++-- > 3 files changed, 34 insertions(+), 3 deletions(-) > > -- > 1.8.3.1 >
