diff options
author | Zane Bitter <zbitter@redhat.com> | 2016-10-10 15:11:42 -0400 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2016-10-11 18:02:19 -0400 |
commit | df889488ede2d3cad30afdc8cd66fb1b92492ede (patch) | |
tree | fc745e7a7b5e1b4de3106711fe0e2335ccd00f50 /heat/tests/test_nested_stack.py | |
parent | 7bf55275931a2006fde37d3018929207596df852 (diff) | |
download | heat-df889488ede2d3cad30afdc8cd66fb1b92492ede.tar.gz |
Avoid loading nested stacks in memory where possible
Prior to changing StackResource to do stack operations over RPC, we made
liberal use of the StackResource.nested() method to access the nested stack
that was likely always loaded in memory. Now that that is no longer
required, it adds additional memory overhead that we need not have. We can
now obtain the stack identifier without loading the stack, and that is
sufficient for performing operations over RPC.
The exceptions are prepare_abandon(), which cannot be done over RPC at
present, and get_output(), which may be addressed in a separate patch. The
gratuitous loading of the nested stack in TemplateResource.get_attribute()
is eliminated, so although it still ends up loading the nested stack in
many cases, it will no longer do so once get_output() stops doing it.
Change-Id: I669d2a077381d7e4e913f6ad1a86fb3f094da6c5
Co-Authored-By: Thomas Herve <therve@redhat.com>
Related-Bug: #1626675
Diffstat (limited to 'heat/tests/test_nested_stack.py')
-rw-r--r-- | heat/tests/test_nested_stack.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/heat/tests/test_nested_stack.py b/heat/tests/test_nested_stack.py index 24c8eaf12..772f34729 100644 --- a/heat/tests/test_nested_stack.py +++ b/heat/tests/test_nested_stack.py @@ -405,12 +405,13 @@ Outputs: def test_handle_delete(self): self.res.rpc_client = mock.MagicMock() self.res.action = self.res.CREATE - self.res.nested = mock.MagicMock() + self.res.nested_identifier = mock.MagicMock() stack_identity = identifier.HeatIdentifier( self.ctx.tenant_id, self.res.physical_resource_name(), self.res.resource_id) - self.res.nested().identifier.return_value = stack_identity + self.res.nested_identifier.return_value = stack_identity + self.res.resource_id = stack_identity.stack_id self.res.handle_delete() self.res.rpc_client.return_value.delete_stack.assert_called_once_with( - self.ctx, self.res.nested().identifier(), cast=False) + self.ctx, stack_identity, cast=False) |