]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
LVM: Support efficient data copy using "dd" for create_cloned_volume
authorMitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Fri, 8 May 2015 19:00:03 +0000 (15:00 -0400)
committerMitsuhiro Tanino <mitsuhiro.tanino@hds.com>
Wed, 13 May 2015 16:52:48 +0000 (12:52 -0400)
commit4e4a54d41ca8801f35d9988d0b8742bf354df049
treeabd58c853f91d5e15be835a8cbb93edff088b7af
parent79df1d730c31568e58bbc35d7abbe947de3db18d
LVM: Support efficient data copy using "dd" for create_cloned_volume

The create_cloned_volume uses dd command for data copy, but the
copy always copy full blocks even if the source data contains
many null or zero blocks. When we use thin provisioned LVM,
blocks are not pre-allocated, so unused region returns zero.
If we copy full block for destination volume, unnecessary blocks
will be allocated and the usage will be 100%.

The dd command has conv=sparse option in order to copy data more
efficiently. This patch enables conv=sparse option as an argument
of dd command for create_cloned_volume when we use thin provisioned
LVM.

[NOTE]
This patch only enables conv=sparse parameter of dd command for
create_cloned_volume() path of LVM driver. There are some places
using dd in Cinder, but we should carefully consider to apply
this parameter for other places because misuse of this parameter
causes security issues or data corruptions. Also we DO NOT use this
parameter for volume wiping case because the volume is not cleared
at all.

Here are some results for this option.

- Without conv=sparse option
  LV            VG    Attr       LSize   Pool     Origin Data%
  vg1-pool      vg1   twi-a-tz--   3.80g                  31.45
  volume-clone  vg1   Vwi-a-tz--   1.00g vg1-pool        100.00
  volume-source vg1   Vwi-a-tz--   1.00g vg1-pool         19.53

- With conv=sparse option
  LV            VG    Attr       LSize   Pool     Origin Data%
  vg1-pool      vg1   twi-a-tz--   3.80g                  10.28
  volume-clone  vg1   Vwi-a-tz--   1.00g vg1-pool         19.53
  volume-source vg1   Vwi-a-tz--   1.00g vg1-pool         19.53

Change-Id: I743f823ca38529b12301a89308d1d406aa3fa45f
Closes-bug: #1224671
cinder/tests/unit/test_volume_utils.py
cinder/volume/drivers/lvm.py
cinder/volume/utils.py