OpenStack: import existing Ceph volumes in Cinder
This method can be useful while migrating from one OpenStack to another.
Imagine you have operating system instances configured with a legacy application that can only run once. Imagine that you want to run them in Ceph using Cinder booting from volumes. Then this is probably how you will import them.
- If you only need a single instance of that virtual machine then you should not bother to convert it in this first place. No matter the original format, keep it like this. For Ceph RAW is recommended while doing COW clone but not mandatory.
- Evaluate the size of your image (
- Create a Cinder volume with the corresponding size
- Get the uuid of the volume
- Remove the volume since RBD won’t allow overwrite:
rbd -p volumes rm <volume-uuid>
- Import the volume with
rbd -p volumes --image-format 2 import <your-image-file> <volume-uuid>
- Flag the volume as bootable:
cinder set-bootable <volume> True
- Boot from volume