OpenStack Block Storage (Cinder)
Go to file
whoami-rajat 1a8ea0eac4 Skip sparse copy during volume reimage
When rebuilding a volume backed instance, while copying the new
image to the existing volume, we preserve sparseness.
This could be problematic since we don't write the zero blocks of
the new image and the data in the old image can still persist
leading to a data leak scenario.

To prevent this, we are using `-S 0`[1][2] option with the `qemu-img convert`
command to write all the zero bytes into the volume.

In the testing done, this doesn't seem to be a problem with known 'raw'
images but good to handle the case anyway.

Following is the testing performed with 3 images:

1. CIRROS QCOW2 to RAW
======================

Volume size: 1 GiB
Image size (raw): 112 MiB

CREATE VOLUME FROM IMAGE (without -S 0)

LVS (10.94% allocated)
  volume-91ea43ef-684c-402f-896e-63e45e5f4fff stack-volumes-lvmdriver-1 Vwi-a-tz-- 1.00g stack-volumes-lvmdriver-1-pool 10.94

REBUILD (with -S 0)

LVS (10.94% allocated)
  volume-91ea43ef-684c-402f-896e-63e45e5f4fff stack-volumes-lvmdriver-1 Vwi-aotz-- 1.00g stack-volumes-lvmdriver-1-pool 10.94

Conclusion:
Same space is consumed on the disk with and without preserving sparseness.

2. DEBIAN QCOW2 to RAW
======================

Volume size: 3 GiB
Image size (raw): 2 GiB

CREATE VOLUME FROM IMAGE (without -S 0)

LVS (66.67% allocated)
  volume-edc42b6a-df5d-420e-85d3-b3e52bcb735e stack-volumes-lvmdriver-1 Vwi-a-tz-- 3.00g stack-volumes-lvmdriver-1-pool 66.67

REBUILD (with -S 0)

LVS (66.67% allocated)
  volume-edc42b6a-df5d-420e-85d3-b3e52bcb735e stack-volumes-lvmdriver-1 Vwi-aotz-- 3.00g stack-volumes-lvmdriver-1-pool 66.67

Conclusion:
Same space is consumed on the disk with and without preserving sparseness.

3. FEDORA QCOW2 TO RAW
======================

CREATE VOLUME FROM IMAGE (without -S 0)

Volume size: 6 GiB
Image size (raw): 5 GiB

LVS (83.33% allocated)
  volume-efa1a227-a30d-4385-867a-db22a3e80ad7 stack-volumes-lvmdriver-1 Vwi-a-tz-- 6.00g stack-volumes-lvmdriver-1-pool 83.33

REBUILD (with -S 0)

LVS (83.33% allocated)
  volume-efa1a227-a30d-4385-867a-db22a3e80ad7 stack-volumes-lvmdriver-1 Vwi-aotz-- 6.00g stack-volumes-lvmdriver-1-pool 83.33

Conclusion:
Same space is consumed on the disk with and without preserving sparseness.

Another testing was done to check if the `-S 0` option actually
works in OpenStack setup.
Note that we are converting qcow2 to qcow2 image which won't
happen in a real world deployment and only for test purposes.

DEBIAN QCOW2 TO QCOW2
=====================

CREATE VOLUME FROM IMAGE (without -S 0)

LVS (52.61% allocated)
  volume-de581f84-e722-4f4a-94fb-10f767069f50 stack-volumes-lvmdriver-1 Vwi-a-tz-- 3.00g stack-volumes-lvmdriver-1-pool 52.61

REBUILD (with -S 0)

LVS (66.68% allocated)
  volume-de581f84-e722-4f4a-94fb-10f767069f50 stack-volumes-lvmdriver-1 Vwi-aotz-- 3.00g stack-volumes-lvmdriver-1-pool 66.68

Conclusion:
We can see that the space allocation increased hence we are not preserving sparseness when using the -S 0 option.

[1] https://qemu-project.gitlab.io/qemu/tools/qemu-img.html#cmdoption-qemu-img-common-opts-S
[2] abf635ddfe/qemu-img.c (L182-L186)

Closes-Bug: #2045431

Change-Id: I5be7eaba68a5b8e1c43f0d95486b5c79c14e1b95
2023-12-26 13:08:58 +05:30
api-ref/source api-ref: Improve sort, pagination parameter docs 2023-08-28 15:56:03 +01:00
cinder Skip sparse copy during volume reimage 2023-12-26 13:08:58 +05:30
doc Merge "Reference - Documentation correction" 2023-09-14 15:48:29 +00:00
etc/cinder Add Cinder NFS driver for Dell PowerStore 2022-07-28 01:27:22 -07:00
playbooks Add fips check jobs 2023-04-18 19:45:55 +00:00
rally-jobs Remove Block Storage API v2 2021-06-04 17:21:28 -04:00
releasenotes Skip sparse copy during volume reimage 2023-12-26 13:08:58 +05:30
roles Native multibackend-matrix Zuul v3 job 2021-09-08 01:05:44 +02:00
tools Add fips check jobs 2023-04-18 19:45:55 +00:00
.coveragerc Update .coveragerc after the removal of openstack directory 2016-10-17 19:09:37 +05:30
.gitignore db: Enable auto-generation of database migrations 2022-02-20 19:06:01 +00:00
.gitreview OpenDev Migration Patch 2019-04-19 19:26:48 +00:00
.pylintrc Pylint: add nvmet to ignored-modules 2023-01-20 10:28:08 -05:00
.stestr.conf Add .stestr.conf configuration 2017-10-10 00:46:42 +00:00
.zuul.yaml Merge "Make lvm-lio-barbican a canary job" 2023-09-28 01:30:18 +00:00
bindep.txt Use openstack-tox-py311 job 2023-08-18 18:55:23 -04:00
CONTRIBUTING.rst Ussuri contrib docs community goal 2020-03-05 14:11:48 -05:00
driver-requirements.txt Add install docs for LINSTOR driver dependencies 2022-12-15 09:40:06 +01:00
HACKING.rst Use LOG.warning instead of deprecated LOG.warn 2022-02-09 08:29:02 +09:00
LICENSE Initial fork out of Nova. 2012-05-03 10:48:26 -07:00
mypy-files.txt mypy: Cover cinder/flow_utils.py 2023-06-05 14:31:04 +00:00
README.rst Merge "Refactor README links" 2020-01-22 11:44:36 +00:00
reno.yaml Update release note info 2021-04-16 11:11:41 -04:00
requirements.txt Merge "db: Remove legacy migrations" 2023-05-23 10:50:52 +00:00
setup.cfg Set packages in setup.cfg 2023-03-17 21:02:58 +00:00
setup.py Cleanup py27 support 2020-04-17 14:47:10 +02:00
test-requirements.txt Bump mypy to 1.2.0 2023-04-26 11:32:12 -04:00
tox.ini Bump pylint to 2.17.0 2023-03-09 15:56:50 -05:00

OpenStack Cinder

image

OpenStack Cinder is a storage service for an open cloud computing service.

You can learn more about Cinder at:

Getting Started

If you'd like to run from the master branch, you can clone the git repo:

git clone https://opendev.org/openstack/cinder

If you'd like to contribute, please see the information in CONTRIBUTING.rst

You can raise bugs on Launchpad

Python client

Python Cinderclient