Add deleton_policy to network resources

In preparation for trainsition from composable networks
managed by heat, to composable networks managed with other

The upgrade prepare step need to set this to 'retain', so
that networks are not deleted when running converge.

Change-Id: Ib65d74a2005fbc13cbc7916e646da65d99410adb
This commit is contained in:
Harald Jensås 2020-09-23 01:56:37 +02:00
parent ce7f42aad6
commit 2f675e464b
2 changed files with 20 additions and 0 deletions

View File

@ -139,6 +139,14 @@ parameters:
description: >
The DNS domain used for the hosts. This must match the
overcloud_domain_name configured on the undercloud.
description: >
Whether to retain or delete network resource on deletion of the stack
type: string
default: delete
- allowed_values: [delete, retain]
manage_networks: {get_param: ManageNetworks}
@ -150,6 +158,7 @@ conditions:
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:
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) %}
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:
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 }}

View File

@ -0,0 +1,8 @@
- |
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.