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 | 2020-07-14T03:37:29Z |
| disk_format | raw |
| id | ca9bf831-df20-4c7c-884e-08e355e5a012 |
| locations | [] |
| min_disk | 0 |
| min_ram | 2048 |
| name | 3CX - July 2020 |
| os_hash_algo | None |
| os_hash_value | None |
| os_hidden | False |
| owner | ccd547784c804de99a63dd17dfb7ff15 |
| protected | False |
| size | None |
| status | queued |
| tags | [] |
| updated_at | 2020-07-14T03:37:29Z |
| virtual_size | None |
| visibility | shared |
+------------------+--------------------------------------+
Step 2 – If you haven’t already done so, upload the image into ceph – Note the image must be in RAW format. Use qemu-img convert to convert the image from QCOW2 to RAW if required
To convert and import in one pass
qemu-img convert -f qcow2 -O raw inputfile.cqow2 rbd:images/outputfile.raw
To import an existing RAW image file
rbp import -p images myimg.raw
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
You’ll obviously need to ensure you have a protected snapshot 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 or you’ll see something like this
403 Forbidden: It's not allowed to add locations if locations are invisible. (HTTP 403)