Aggregate availability_zone access throws NotImplementedError when metadata is null
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Ryan Rossiter |
Bug Description
The Aggregate object has an availability_zone property that, when accessed, gets the availability zone as a key/value stored in the metadata field. The problem is, the metadata field is nullable, so if an Aggregate object is created with no metadata, calling the availability_zone property will explode because it is trying to get the 'availability_zone' key on the metadata field.
Here is a simple test that fails to show the problem (put in nova/tests/
def test_get_
agg = aggregate.
Here's the result of the test:
nova.tests.
-------
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "nova/tests/
File "nova/objects/
return self.metadata.
File "/opt/stack/
File "/opt/stack/
_("Cannot load '%s' in the base class") % attrname)
NotImplemen
Changed in nova: | |
assignee: | nobody → Ryan Rossiter (rlrossit) |
We assume by design that the AZ information is only a specific key/value pair of the metadata dict (where the key is 'availability_ zone').
Trying to access the AZ info if the metadata field is unset goes against that design decision because it makes no sense to persist it differently at the object layer. Having a level of indirection for accessing it doesn't mean we should have a defensive approach for accessing that information.