From 73684d0a894599e331e323597c3705453baab4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Fri, 5 Mar 2021 00:05:31 +0100 Subject: [PATCH] Set tags on all OS::Neutron::Port resources Set up tag hints on all OS::Neutron::Port resources. The network-data-v2 work uses tags on neutron resources to find existing resources so that we update instead of create. Also for generating environment files info in the neutron tag field is utilized. Partial-Implements: blueprint network-data-v2-ports Change-Id: I3d43ae22cc45e5528ecfb1a6b2cb8602faa162a0 --- deployed-server/ctlplane-port.yaml | 8 ++++++ deployed-server/deployed-neutron-port.yaml | 3 +++ deployed-server/deployed-server.yaml | 8 ++++++ network/ports/ctlplane_vip.yaml | 16 +++++++++++- network/ports/deployed_port.j2 | 3 +++ network/ports/deployed_vip_port.j2 | 2 +- network/ports/from_service.yaml | 3 +++ network/ports/from_service_v6.yaml | 3 +++ network/ports/noop.yaml | 3 +++ network/ports/ovn_mac_addr_port.yaml | 16 ++++++++++++ network/ports/port.j2 | 29 ++++++++++++++++------ network/ports/port_from_pool.j2 | 3 +++ network/ports/vip.yaml | 15 +++++++++++ network/ports/vip_v6.yaml | 16 +++++++++++- overcloud.j2.yaml | 1 + 15 files changed, 118 insertions(+), 11 deletions(-) diff --git a/deployed-server/ctlplane-port.yaml b/deployed-server/ctlplane-port.yaml index 523a3bf9d3..6cbfd73a3d 100644 --- a/deployed-server/ctlplane-port.yaml +++ b/deployed-server/ctlplane-port.yaml @@ -1,6 +1,9 @@ heat_template_version: wallaby parameters: + RootStackName: + description: The name of the stack/plan. + type: string network: type: string default: ctlplane @@ -33,6 +36,11 @@ resources: - - {get_param: name} - port replacement_policy: AUTO + tags: + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: fixed_ips: diff --git a/deployed-server/deployed-neutron-port.yaml b/deployed-server/deployed-neutron-port.yaml index 9a9032d7d6..9ee87af161 100644 --- a/deployed-server/deployed-neutron-port.yaml +++ b/deployed-server/deployed-neutron-port.yaml @@ -39,6 +39,9 @@ parameters: DeployedServerPortMap: default: {} type: json + IsVirtualIP: # Here for compatibility + default: false + type: boolean outputs: diff --git a/deployed-server/deployed-server.yaml b/deployed-server/deployed-server.yaml index 5e6b3e1a80..87d1b0ee58 100644 --- a/deployed-server/deployed-server.yaml +++ b/deployed-server/deployed-server.yaml @@ -1,5 +1,8 @@ heat_template_version: wallaby parameters: + RootStackName: + description: The name of the stack/plan. + type: string image: type: string default: unused @@ -76,6 +79,11 @@ resources: - - {get_param: name} - ctlplane replacement_policy: AUTO + tags: + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: OS::stack_id: diff --git a/network/ports/ctlplane_vip.yaml b/network/ports/ctlplane_vip.yaml index c17a924f81..62ef2a2d91 100644 --- a/network/ports/ctlplane_vip.yaml +++ b/network/ports/ctlplane_vip.yaml @@ -5,6 +5,9 @@ description: > The IP address will be chosen automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string ServiceName: # Here for compatibility with from_service.yaml description: Name of the service to lookup default: '' @@ -45,6 +48,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false conditions: fixed_ip_not_set: @@ -67,7 +73,15 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO - + tags: + - str_replace: + template: tripleo_vip_net=$NET_NAME + params: + $NET_NAME: {get_param: ControlPlaneNetwork} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: ip_address: description: Virtual IP network IP diff --git a/network/ports/deployed_port.j2 b/network/ports/deployed_port.j2 index 2409d99026..b8be4cbabd 100644 --- a/network/ports/deployed_port.j2 +++ b/network/ports/deployed_port.j2 @@ -51,6 +51,9 @@ parameters: A map of deployed port data default: {} type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false resources: diff --git a/network/ports/deployed_vip_port.j2 b/network/ports/deployed_vip_port.j2 index ad2f5945dc..573d0be887 100644 --- a/network/ports/deployed_vip_port.j2 +++ b/network/ports/deployed_vip_port.j2 @@ -46,7 +46,7 @@ parameters: NodeIndex: # Here for compatibility with from_pool.yaml default: 0 type: number - VipPort: # Here for compatibility + IsVirtualIP: # Here for compatibility type: boolean default: false VipPortMap: diff --git a/network/ports/from_service.yaml b/network/ports/from_service.yaml index 7aab838e69..f207d2ea2a 100644 --- a/network/ports/from_service.yaml +++ b/network/ports/from_service.yaml @@ -44,6 +44,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false ServiceVips: default: {} type: json diff --git a/network/ports/from_service_v6.yaml b/network/ports/from_service_v6.yaml index a3e33ebd50..0aa6fcc043 100644 --- a/network/ports/from_service_v6.yaml +++ b/network/ports/from_service_v6.yaml @@ -40,6 +40,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false ServiceVips: default: {} type: json diff --git a/network/ports/noop.yaml b/network/ports/noop.yaml index 3739027e72..8c72a2edf7 100644 --- a/network/ports/noop.yaml +++ b/network/ports/noop.yaml @@ -57,6 +57,9 @@ parameters: default: 0 description: Index of the IP to get from Pool type: number + IsVirtualIP: # Here for compatibility + type: boolean + default: false outputs: ip_address: diff --git a/network/ports/ovn_mac_addr_port.yaml b/network/ports/ovn_mac_addr_port.yaml index fccdaf5079..b0d3051256 100644 --- a/network/ports/ovn_mac_addr_port.yaml +++ b/network/ports/ovn_mac_addr_port.yaml @@ -4,6 +4,9 @@ description: > Port without IP address, used to allocate MAC addresses for OVN chassis. parameters: + RootStackName: + description: The name of the stack/plan. + type: string PortName: description: Name of the port default: '' @@ -29,6 +32,19 @@ resources: name: {get_param: PortName} network: {get_param: OVNMacAddressNetworkName} fixed_ips: [] + tags: + - str_replace: + template: tripleo_ovn_mac_port_name=$PORT_NAME + params: + $PORT_NAME: {get_param: PortName} + - str_replace: + template: tripleo_ovn_mac_net=$NET_NAME + params: + $NET_NAME: {get_param: OVNMacAddressNetworkName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: mac_address: diff --git a/network/ports/port.j2 b/network/ports/port.j2 index 45e14d4184..8e1a1a07e2 100644 --- a/network/ports/port.j2 +++ b/network/ports/port.j2 @@ -63,6 +63,9 @@ parameters: Whether this interface is used for the default route type: boolean default: false + IsVirtualIP: + type: boolean + default: false conditions: network_is_ctlplane: @@ -99,14 +102,24 @@ resources: - get_param: FixedIPs replacement_policy: AUTO tags: - - str_replace: - template: tripleo_stack_name=$STACK_NAME - params: - $STACK_NAME: {get_param: RootStackName} - - str_replace: - template: tripleo_default_route=$BOOL - params: - $BOOL: {get_param: DefaultRoute} + if: + - {get_param: IsVirtualIP} + - - str_replace: + template: tripleo_vip_net=$NET_NAME + params: + $NET_NAME: {get_param: {{network.name}}NetName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} + - - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} + - str_replace: + template: tripleo_default_route=$BOOL + params: + $BOOL: {get_param: DefaultRoute} outputs: ip_address: diff --git a/network/ports/port_from_pool.j2 b/network/ports/port_from_pool.j2 index d269710ee7..820ab607a4 100644 --- a/network/ports/port_from_pool.j2 +++ b/network/ports/port_from_pool.j2 @@ -65,6 +65,9 @@ parameters: Whether this interface is used for the default route type: boolean default: false + IsVirtualIP: # Here for compatibility + default: false + type: boolean outputs: ip_address: diff --git a/network/ports/vip.yaml b/network/ports/vip.yaml index b6c1c653a9..f63c621c99 100644 --- a/network/ports/vip.yaml +++ b/network/ports/vip.yaml @@ -5,6 +5,9 @@ description: > The IP address will be chosen automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string ServiceName: # Here for compatibility with from_service.yaml description: Name of the service to lookup default: '' @@ -53,6 +56,9 @@ parameters: default: delete constraints: - allowed_values: [delete, retain] + IsVirtualIP: # Here for compatibility + type: boolean + default: false conditions: network_is_ctlplane: @@ -83,6 +89,15 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO + tags: + - str_replace: + template: tripleo_service_vip=$SERVICE_NAME + params: + $SERVICE_NAME: {get_param: ServiceName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: ip_address: diff --git a/network/ports/vip_v6.yaml b/network/ports/vip_v6.yaml index b5c150cd0e..92bf47e804 100644 --- a/network/ports/vip_v6.yaml +++ b/network/ports/vip_v6.yaml @@ -5,6 +5,9 @@ description: > The IP address will be chosen automatically if FixedIPs is empty. parameters: + RootStackName: + description: The name of the stack/plan. + type: string ServiceName: # Here for compatibility with from_service.yaml description: Name of the service to lookup default: '' @@ -45,6 +48,9 @@ parameters: [{'ip_address':'1.2.3.4'}] default: [] type: json + IsVirtualIP: # Here for compatibility + type: boolean + default: false conditions: network_is_ctlplane: @@ -74,7 +80,15 @@ resources: - [{subnet: {get_param: ControlPlaneSubnet}}] - get_param: FixedIPs replacement_policy: AUTO - + tags: + - str_replace: + template: tripleo_service_vip=$SERVICE_NAME + params: + $SERVICE_NAME: {get_param: ServiceName} + - str_replace: + template: tripleo_stack_name=$STACK_NAME + params: + $STACK_NAME: {get_param: RootStackName} outputs: ip_address: description: Virtual IP network IP diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index 6690457ae5..844a14437a 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -1176,6 +1176,7 @@ resources: - {get_param: {{network.name}}VirtualFixedIPs} {%- endif %} - [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}] + IsVirtualIP: true {%- endfor %} VipMap: