Fix an objects layering violation in compute/api

This patch fixes a case in compute/api that "knows" the magic name for
where we store actual object contents.

I'm not sure about this actual use and why we need it, but in order to
not block subsequent patches, this makes it at least use the proper
API in order to generate the magic attribute name.

Related to blueprint use-oslo-objects

Change-Id: I4fa95f03106130c64b672c32247686d109c760f7
This commit is contained in:
Dan Smith 2015-06-03 10:15:12 -07:00
parent 3fba0829c5
commit 3a037abdb0
1 changed files with 3 additions and 2 deletions

View File

@ -1735,8 +1735,9 @@ class API(base.Base):
orig_host = instance.host
try:
if instance.vm_state == vm_states.SHELVED_OFFLOADED:
instance.host = instance._system_metadata.get(
'shelved_host')
sysmeta = getattr(instance,
obj_base.get_attrname('system_metadata'))
instance.host = sysmeta.get('shelved_host')
self.network_api.deallocate_for_instance(elevated,
instance)
finally: