Incomplete support for multiple Volume Types with Cinder storage backend
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Glance Charm |
Fix Committed
|
High
|
Jorge Merlino |
Bug Description
With Cinder backing Glance and multiple Volume Types present in Cinder, it is not possible to decide which Volume Type should be used when creating new image.
The expectation is that the following image creation commands end up with two images created, backed by two different volume types, `volume-type-1` and `volume-type-2`:
```
glance image-create --store volume-type-1 ...
glance image-create --store volume-type-2 ...
```
Instead, both images are backed by Cinder volumes of type `volume-type-1`.
Glance's `cinder-
[{"id": "local", "description": "Local filesystem store"}, {"id": "volume-type-1", "default": "true"}, {"id": "volume-type-2"}]
When examining Glance config file rendered by the Glance charm, I can see both stanzas for two storage backends but each stanza is missing `cinder_
```
[DEFAULT]
...
enabled_backends = local:file, volume-
[glance_store]
default_backend = volume-type-1
...
[volume-type-1]
cinder_catalog_info = volumev3:
volume-type-2]
cinder_catalog_info = volumev3:
```
It looks like there's a code populating cinder_volume_type: https:/
Glance channel: yoga/stable
Cinder channel: yoga/stable
Ubuntu Jammy 22.04
Changed in charm-glance: | |
assignee: | nobody → Jorge Merlino (jorge-merlino) |
After some oob conversation with Przemyslaw, we worked out the bug is at:
https:/ /opendev. org/openstack/ charm-glance/ src/commit/ 3fadd2374f99bb7 d4e212cbe6cdb81 16d5eecfbd/ hooks/glance_ contexts. py#L389
Essentially, this code reads as:
for volume_type in volume_types:
if 'volume_type' not in ctxt['enabled_ backend_ configs' ]:
ctxt[ 'enabled_ backend_ configs' ][volume_ type] = {}
ctxt[ 'enabled_ backend_ configs' ][volume_ type].update(
{'cinder_ catalog_ info': volume_ catalog_ info})
And the bug is the string 'volume_type' rather than the bare volume_type in the "if 'volume_type' not in ...". It will always blank the ctxt[.. ][volume_ type] as 'volume_type' (as a string key) doesn't exist in the ctxt[..] dictionary.
A relatively simple fix, but just waiting on Przemyslaw to do some live testing to see if the simple fix actually resolves the whole problem.