commit 2f675e464bca640eb95a1382296b348196fbd169 Author: Harald Jensås Date: Wed Sep 23 01:56:37 2020 +0200 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 diff --git a/network/network.j2 b/network/network.j2 index d4d7ee7..2a4a80c 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 0000000..f656520 --- /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.