summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2013-01-10 08:58:21 +0000
committerChris Behrens <cbehrens@codestud.com>2013-01-10 17:21:59 +0000
commit6cd0cdfbc03adf0cc633dd964f7cfbaaa5dee567 (patch)
tree099a02e088fe1d6686204ba4ae7a5b0ffd959bbd
parent1db4b13d86d748d9619ea9ce37bb4663285468b5 (diff)
downloadnova-6cd0cdfbc03adf0cc633dd964f7cfbaaa5dee567.tar.gz
Update instance's cell_name in API cell.
It was accidentally being removed before updating the DB due to code being moved and not updated. The test for the method was broken, too, allowing this bug to sneak in. Fixes bug 1098093 Change-Id: I05c00b8b100568b39afb8ee0ca7ee94d4dd97c0a (cherry picked from commit abc9a0d5df70ee00ba38e655a4d88ae18417f0e3)
-rw-r--r--nova/cells/messaging.py11
-rw-r--r--nova/tests/cells/test_cells_messaging.py2
2 files changed, 7 insertions, 6 deletions
diff --git a/nova/cells/messaging.py b/nova/cells/messaging.py
index e5617e7427..56d5218922 100644
--- a/nova/cells/messaging.py
+++ b/nova/cells/messaging.py
@@ -690,17 +690,16 @@ class _BroadcastMessageMethods(_BaseMessageMethods):
if not self._at_the_top():
return
instance_uuid = instance['uuid']
- routing_path = message.routing_path
- instance['cell_name'] = _reverse_path(routing_path)
+
# Remove things that we can't update in the top level cells.
- # 'cell_name' is included in this list.. because we'll set it
- # ourselves based on the reverse of the routing path. metadata
- # is only updated in the API cell, so we don't listen to what
- # the child cell tells us.
+ # 'metadata' is only updated in the API cell, so don't overwrite
+ # it based on what child cells say. Make sure to update
+ # 'cell_name' based on the routing path.
items_to_remove = ['id', 'security_groups', 'instance_type',
'volumes', 'cell_name', 'name', 'metadata']
for key in items_to_remove:
instance.pop(key, None)
+ instance['cell_name'] = _reverse_path(message.routing_path)
# Fixup info_cache. We'll have to update this separately if
# it exists.
diff --git a/nova/tests/cells/test_cells_messaging.py b/nova/tests/cells/test_cells_messaging.py
index d728c9474c..a0920c3681 100644
--- a/nova/tests/cells/test_cells_messaging.py
+++ b/nova/tests/cells/test_cells_messaging.py
@@ -795,7 +795,9 @@ class CellsBroadcastMethodsTestCase(test.TestCase):
expected_sys_metadata = {'key1': 'value1',
'key2': 'value2'}
expected_info_cache = {'other': 'moo'}
+ expected_cell_name = 'api-cell!child-cell2!grandchild-cell1'
expected_instance = {'system_metadata': expected_sys_metadata,
+ 'cell_name': expected_cell_name,
'other': 'meow',
'uuid': 'fake_uuid'}