From 2f675e464bca640eb95a1382296b348196fbd169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Wed, 23 Sep 2020 01:56:37 +0200 Subject: [PATCH] Add deleton_policy to network resources In preparation for trainsition from composable networks managed by heat, to composable networks managed with other tooling. The upgrade prepare step need to set this to 'retain', so that networks are not deleted when running converge. Change-Id: Ib65d74a2005fbc13cbc7916e646da65d99410adb --- network/network.j2 | 12 ++++++++++++ ...k-resources-deletion-policy-a1aee566e650468c.yaml | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 releasenotes/notes/network-resources-deletion-policy-a1aee566e650468c.yaml diff --git a/network/network.j2 b/network/network.j2 index d4d7ee764d..2a4a80cfab 100644 --- a/network/network.j2 +++ b/network/network.j2 @@ -139,6 +139,14 @@ parameters: description: > The DNS domain used for the hosts. This must match the overcloud_domain_name configured on the undercloud. + NetworkDeletionPolicy: + description: > + Whether to retain or delete network resource on deletion of the stack + type: string + default: delete + constraints: + - allowed_values: [delete, retain] + conditions: manage_networks: {get_param: ManageNetworks} @@ -150,6 +158,7 @@ conditions: resources: {{network.name}}Network: type: OS::Neutron::Net + deletion_policy: {get_param: NetworkDeletionPolicy} condition: manage_networks {%- if network.external_resource_network_id|default('') %} external_id: {{ network.external_resource_network_id }} @@ -179,6 +188,7 @@ resources: {{network.name}}Subnet: type: OS::Neutron::Subnet + deletion_policy: {get_param: NetworkDeletionPolicy} condition: manage_networks {%- if network.external_resource_subnet_id|default('') %} external_id: {{ network.external_resource_subnet_id }} @@ -209,6 +219,7 @@ resources: {% for subnet in network.subnets|default({}) if network.subnets[subnet].enabled|default(true) %} {{network.name}}Segment_{{subnet}}: type: OS::Neutron::Segment + deletion_policy: {get_param: NetworkDeletionPolicy} condition: manage_networks # NOTE(hjensas): Depends-On here to ensure we always create the base subnet # first. We can only set the segment for existing subnet if there is only @@ -226,6 +237,7 @@ resources: {{network.name}}Subnet_{{subnet}}: type: OS::Neutron::Subnet + deletion_policy: {get_param: NetworkDeletionPolicy} condition: manage_networks {%- if network.subnets[subnet].external_resource_subnet_id|default('') %} external_id: {{ network.subnets[subnet].external_resource_subnet_id }} diff --git a/releasenotes/notes/network-resources-deletion-policy-a1aee566e650468c.yaml b/releasenotes/notes/network-resources-deletion-policy-a1aee566e650468c.yaml new file mode 100644 index 0000000000..f656520bf9 --- /dev/null +++ b/releasenotes/notes/network-resources-deletion-policy-a1aee566e650468c.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The parameter ``NetworkDeletionPolicy`` (defaults to: ``delete``) was added + to enable control of the ``deletion_policy`` for overcloud network + resources (networks, segments and subnets). By setting the parameter to + ``retain`` the physical resources will not be deleted if removed from the + heat templates, or the stack is deleted.