Remove partial clean-up in Instance.destroy

Instance class implementation is based on OS::Nova::Server
resource in Heat and related networking resources. When deploy
called on Instance number of resources are allocated in Heat.

Some classes (e.g. descendants of Instance) can allocate other
resources that depends on presence of resources allocated by Instance,
for example HeatSWConfigInstance allocate OS::Heat::SoftwareDeployment
that depends on underlying OS::Nova::Server.

When Instance is destroyed and clean-up stage is finished underlying
resources are removed from stack. But since some resources still depend
on removed ones whole stack becomes invalid and deployment fails.

This change implements quick workaround by removing resource clean-up
in Instance class. Warning, this change introduce resource leak, cause
resoures are allocated during Instance deployment now will be deleted
only when whole Environment (and therefor stack) will be deleted.

Change-Id: I772f0b35918cd554fcbe1e830766ec23d5641176
Closes-Bug: #1359998
This commit is contained in:
Serg Melikyan 2014-09-01 18:38:21 +04:00
parent 864df5b69d
commit 7a6f6c1c18
6 changed files with 14 additions and 21 deletions

View File

@ -235,28 +235,15 @@ Methods:
- $.setAttr(fipAssigned, true)
destroy:
# Fixme(smelikyan): We need to remove all associated resources on destroy
# FIXME(smelikyan): All allocated resources should be cleaned-up on destroy
# Now no clean-up happens here cause we don't track all native resources
# that are allocated at the moment in descendants of Instance or other
# classes that may allocate resource dependent on OS::Nova:Server used
# as underlying implementation for Instance. This can cause
# resource leak when environment is updated. Resources are cleaned-up only
# when whole Environment is deleted (alongside with Heat stack deletion).
# https://bugs.launchpad.net/murano/+bug/1359998
Body:
- $template: $.environment.stack.current()
# Remove OS::Nova::Server resource
- $patchBlock:
op: remove
path: format('/resources/{0}', $.name)
- $template: patch($template, $patchBlock)
# Remove Ip Addresses Outputs assigned to this Instance
- $assignedIpBlock:
op: remove
path: format('/outputs/{0}-assigned-ip', $.name)
- $template: patch($template, $assignedIpBlock)
# Remove Floatting IP Addresses Outputs
- If: $.getAttr(fipAssigned, false)
Then:
- $assignedFloatingIpBlock:
op: remove
path: format('/outputs/{0}-FloatingIPaddress', $.name)
- $template: patch($template, $assignedFloatingIpBlock)
- $.environment.stack.setTemplate($template)
- $.environment.stack.push()
- $.environment.instanceNotifier.untrackCloudInstance($this)
createDefaultInstanceSecurityGroupRules:

View File

@ -402,6 +402,9 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
return stack
def test_instance_refs_are_removed_after_application_is_removed(self):
# FIXME(sergmelikyan): Revise this as part of proper fix for #1359998
self.skipTest('Skipped until proper fix for #1359998 is proposed')
name = 'e' + uuid.uuid4().hex
# create environment with telnet application

View File

@ -40,6 +40,9 @@ TEMPLATE = {
class TestDestroy(test_case.DslTestCase):
def test_destroy_removes_ip_address_from_outputs(self):
# FIXME(sergmelikyan): Revise this as part of proper fix for #1359998
self.skipTest('skipped until proper fix for #1359998 is proposed')
heat_stack_obj = om.Object('io.murano.system.HeatStack')
instance_obj = om.Object(
'io.murano.resources.Instance',