Openstack Queens\Rocky – Glance: Create an image from an existing RBD volume

Seems like something that should be simple!

Step1 – Create the empty image

glance image-create --container-format=bare --disk-format=raw  --min-ram 2048 --name="Windows Server test"

+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2018-04-26T04:08:37Z |
| disk_format | raw |
| id | 763a2ca2-e8f8-4bf9-974f-98d7020e200b |
| locations | [] |
| min_disk | 0 |
| min_ram | 0 |
| name | Windows Server test |
| owner | 40c2b46fb47c4ee7ac076b259c4e0814 |
| protected | False |
| size | None |
| status | queued |
| tags | [] |
| updated_at | 2018-04-26T04:08:37Z |
| virtual_size | None |
| visibility | shared |
+------------------+--------------------------------------+

Step 2 – Update the ‘location’ attribute

glance location-add --url "rbd://b42a82f3-f493-49f4-98e0-2d355bbe8ee3/saspool/image-Windows2016v1/snap" 763a2ca2-e8f8-4bf9-974f-98d7020e200b

OR if using the Openstack cli

openstack image set --property direct_url='rbd://cbb8d45d-79ee-4cf5-9ace-eeb145c89fd2/pool/image-pfsense235/snap' ee52d217-d2c8-4be4-b576-7766373de9e7

You’ll obviously need to ensure you have a protected snapshow of your image like so

:~# rbd snap create saspool/image-Windows2016v1@snap

:~# rbd snap protect saspool/image-Windows2016v1@snap

:~# rbd snap ls saspool/image-Windows2016v1

SNAPID NAME   SIZE TIMESTAMP

18 snap 150 GB Thu Apr 26 13:24:30 2018

You’ll also need to ensure that show_multiple_locations = true is set in glance-api.conf