RBD create volume from encrypted snapshot can not be used
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Fix Released
|
Medium
|
Sofia Enriquez | ||
Victoria |
New
|
Low
|
Sofia Enriquez | ||
Wallaby |
Fix Committed
|
Medium
|
Sofia Enriquez | ||
Xena |
Fix Committed
|
Medium
|
Sofia Enriquez |
Bug Description
Steps:
1. Create en encrypted Ceph RBD volume(Vol-A).
2. Create a snapshot for this volume.
3. Create a volume(Vol-B) form this snapshot.
4. Attach this volume(Vol-B) to a VM.
Attach successfully, but in the VM, we can not use this volume, the msg in the dmesg:
bad geometry: block count xxx exceeds size of device.
Obviously, the size of the volume is out of order.
Ceph RBD encrypted volume is created by:
qemu-img create -f luks -o cipher-
Then I do it myself:
# echo 'bae3516cc1c0eb
# qemu-img create -f luks -o cipher-
Formatting 'secret-file', fmt=luks size=1073741824 key-secret=luks_sec cipher-alg=aes-256 cipher-mode=xts ivgen-alg=plain64
# qemu-img info secret-file
image: secret-file
file format: luks
virtual size: 1.0G (1073741824 bytes)
disk size: 256K
encrypted: yes
Format specific information:
ivgen alg: plain64
hash alg: sha256
cipher alg: aes-256
uuid: 0666ed63-
cipher mode: xts
slots:
......
# ls -lh secret-file
-rw-r--r--. 1 root root 1.1G Sep 14 18:09 secret-file
# ls -lh secret-file --block-size=M
-rw-r--r--. 1 root root 1026M Sep 14 18:09 secret-file
The encrypted Ceph RBD volume info on Ceph is:
# rbd info volumes/
rbd image 'volume-
size 1025 MB in 257 objects
order 22 (4096 kB objects)
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:
When do [3. Create a volume(Vol-B) form this snapshot.], what we do in Ceph RBD Volume Driver is:
def _resize(self, volume, **kwargs):
size = kwargs.get('size', None)
if not size:
size = int(volume.size) * units.Gi
with RBDVolumeProxy(
def create_
"""Creates a volume from a snapshot."""
if self.configurat
if int(volume.size):
return volume_update
So we can get the following conclusions:
1. The actuall size is larger than what we specify(volume size) by qemu-img create!
2. create_
Some thoughts on the above conclusions:
Conclusion 1: What we specify in qemu-img create is not the final file size. qemu-img info's virtual size is not equal with the actual file size. This may be a bug in qemu-img which I can not fix it easily.
Conclusion 2: Why clone volume is JUST OK. I find the difference:
def _extend_
"""Extends a volume if required
In case src_vref size is smaller than the size if the requested
new volume call _resize().
"""
if volume.size != src_vref.size: ★★★★★
So in this case, I will fix it by this.
Changed in cinder: | |
assignee: | nobody → yenai (yenai2008) |
tags: | added: rbd |
tags: | added: encryption snapshot |
Changed in cinder: | |
status: | Fix Committed → Fix Released |
Fix proposed to branch: master /review. opendev. org/693772
Review: https:/