From 77c82f6645233189757e37a06cae5f0aa96e3a72 Mon Sep 17 00:00:00 2001 From: Harald Jensas Date: Tue, 13 Jun 2017 14:34:17 +0200 Subject: [PATCH] Add subnet property to ctlplane network for server resources The subnet property is added to puppet/role.role.j2.yaml as `{{role}}ControlPlaneSubnet`. Roles with a different subnet specified can be used to deploy a routed network architecture by using one role per routed network. When enabling the neutron segments plug-in to support routed-networks the neutron IPAM code will defer ipallocation unless the port create request contain enough details. (Ref: LP Bug: #1695740) By adding the subnet to port create request this change enables tripleo deployment on an undercloud with Neutron segments plug-in and routed networks. This depends on a Heat change that improves network logic in server resource to not replace the current port if new props match what is on the current interface. Without this adding the subnet property on update/upgrades would cause a port replacement, which in turn would cause IPAM info in undercloud neutron to miss-match the deployed overcloud nodes. Depends-On: Iab75ec49b962617943017dcaf1b04b89f91a982e Change-Id: I33804bfd105a13c25d6057e8414e09957939e8af Implements: blueprint tripleo-routed-networks-deployment --- deployed-server/ctlplane-port.yaml | 5 +++++ deployed-server/deployed-server.yaml | 5 +++++ network/ports/ctlplane_vip.yaml | 16 +++++++++++++++- network/ports/from_service.yaml | 4 ++++ network/ports/noop.yaml | 4 ++++ network/ports/port.j2 | 24 +++++++++++++++++++++++- network/ports/port_from_pool.j2 | 4 ++++ network/ports/vip.yaml | 24 +++++++++++++++++++++++- network/ports/vip_v6.yaml | 24 +++++++++++++++++++++++- overcloud.j2.yaml | 11 ++++++++++- puppet/role.role.j2.yaml | 6 ++++++ 11 files changed, 122 insertions(+), 5 deletions(-) diff --git a/deployed-server/ctlplane-port.yaml b/deployed-server/ctlplane-port.yaml index 99fecd6b64..924ff1b496 100644 --- a/deployed-server/ctlplane-port.yaml +++ b/deployed-server/ctlplane-port.yaml @@ -9,6 +9,10 @@ parameters: replacement_policy: type: string default: AUTO + ControlPlaneSubnet: + default: ctlplane-subnet + description: The name of the undercloud Neutron control plane subnet + type: string resources: @@ -16,6 +20,7 @@ resources: type: OS::Neutron::Port properties: network: ctlplane + fixed_ips: [{subnet: {get_param: ControlPlaneSubnet}}] name: list_join: - '-' diff --git a/deployed-server/deployed-server.yaml b/deployed-server/deployed-server.yaml index 92c2b0d06c..7477bb82f8 100644 --- a/deployed-server/deployed-server.yaml +++ b/deployed-server/deployed-server.yaml @@ -48,6 +48,10 @@ parameters: deployment_swift_data: type: json default: {} + ControlPlaneSubnet: + default: ctlplane-subnet + description: The name of the undercloud Neutron control plane subnet + type: string resources: deployed-server: @@ -122,6 +126,7 @@ resources: type: OS::TripleO::DeployedServer::ControlPlanePort properties: network: ctlplane + fixed_ips: [{subnet: {get_param: ControlPlaneSubnet}}] name: list_join: - '-' diff --git a/network/ports/ctlplane_vip.yaml b/network/ports/ctlplane_vip.yaml index 6b43b31d22..82709deda8 100644 --- a/network/ports/ctlplane_vip.yaml +++ b/network/ports/ctlplane_vip.yaml @@ -25,6 +25,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string FixedIPs: description: > Control the IP allocation for the VIP port. E.g. @@ -32,13 +36,23 @@ parameters: default: [] type: json +conditions: + fixed_ip_not_set: + equals: + - get_param: FixedIPs + - [] + resources: VipPort: type: OS::TripleO::Network::Ports::ControlPlaneVipPort properties: network: {get_param: ControlPlaneNetwork} name: {get_param: PortName} - fixed_ips: {get_param: FixedIPs} + fixed_ips: + if: + - fixed_ip_not_set + - [{subnet: {get_param: ControlPlaneSubnet}}] + - get_param: FixedIPs replacement_policy: AUTO outputs: diff --git a/network/ports/from_service.yaml b/network/ports/from_service.yaml index 284bb3f595..4fb813e0b6 100644 --- a/network/ports/from_service.yaml +++ b/network/ports/from_service.yaml @@ -24,6 +24,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: # Here for compatibility with ctlplane_vip.yaml + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string FixedIPs: # Here for compatibility with ctlplane_vip.yaml description: > Control the IP allocation for the VIP port. E.g. diff --git a/network/ports/noop.yaml b/network/ports/noop.yaml index 8e8659c4f0..d31d16255f 100644 --- a/network/ports/noop.yaml +++ b/network/ports/noop.yaml @@ -15,6 +15,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string PortName: description: Name of the port default: '' diff --git a/network/ports/port.j2 b/network/ports/port.j2 index 3b4c59354f..1c032897c7 100644 --- a/network/ports/port.j2 +++ b/network/ports/port.j2 @@ -21,6 +21,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: # Here for compatibility with ctlplane_vip.yaml + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string FixedIPs: description: > Control the IP allocation for the VIP port. E.g. @@ -34,6 +38,20 @@ parameters: default: 0 type: number +conditions: + network_is_ctlplane: + equals: + - get_param: {{network.name}}NetName + - ctlplane + fixed_ip_not_set: + equals: + - get_param: FixedIPs + - [] + net_is_ctlplane_and_fixed_ip_not_set: + and: + - network_is_ctlplane + - fixed_ip_not_set + resources: {{network.name}}Port: @@ -41,7 +59,11 @@ resources: properties: network: {get_param: {{network.name}}NetName} name: {get_param: PortName} - fixed_ips: {get_param: FixedIPs} + fixed_ips: + if: + - net_is_ctlplane_and_fixed_ip_not_set + - [{subnet: {get_param: ControlPlaneSubnet}}] + - get_param: FixedIPs replacement_policy: AUTO outputs: diff --git a/network/ports/port_from_pool.j2 b/network/ports/port_from_pool.j2 index 3448e64516..adb0a07d21 100644 --- a/network/ports/port_from_pool.j2 +++ b/network/ports/port_from_pool.j2 @@ -26,6 +26,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: # Here for compatibility with ctlplane_vip.yaml + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string IPPool: # Set in IPs map, see environments/ips-from-pool-all.yaml default: {} type: json diff --git a/network/ports/vip.yaml b/network/ports/vip.yaml index 89747ccae2..2cf401ec9b 100644 --- a/network/ports/vip.yaml +++ b/network/ports/vip.yaml @@ -25,6 +25,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string FixedIPs: description: > Control the IP allocation for the VIP port. E.g. @@ -32,13 +36,31 @@ parameters: default: [] type: json +conditions: + network_is_ctlplane: + equals: + - get_param: NetworkName + - ctlplane + fixed_ip_not_set: + equals: + - get_param: FixedIPs + - [] + net_is_ctlplane_and_fixed_ip_not_set: + and: + - network_is_ctlplane + - fixed_ip_not_set + resources: VipPort: type: OS::Neutron::Port properties: network: {get_param: NetworkName} name: {get_param: PortName} - fixed_ips: {get_param: FixedIPs} + fixed_ips: + if: + - net_is_ctlplane_and_fixed_ip_not_set + - [{subnet: {get_param: ControlPlaneSubnet}}] + - get_param: FixedIPs replacement_policy: AUTO outputs: diff --git a/network/ports/vip_v6.yaml b/network/ports/vip_v6.yaml index 3b45d7efe4..ae08677678 100644 --- a/network/ports/vip_v6.yaml +++ b/network/ports/vip_v6.yaml @@ -25,6 +25,10 @@ parameters: description: The name of the undercloud Neutron control plane default: ctlplane type: string + ControlPlaneSubnet: + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string FixedIPs: description: > Control the IP allocation for the VIP port. E.g. @@ -32,13 +36,31 @@ parameters: default: [] type: json +conditions: + network_is_ctlplane: + equals: + - get_param: NetworkName + - ctlplane + fixed_ip_not_set: + equals: + - get_param: FixedIPs + - [] + net_is_ctlplane_and_fixed_ip_not_set: + and: + - network_is_ctlplane + - fixed_ip_not_set + resources: VipPort: type: OS::Neutron::Port properties: network: {get_param: NetworkName} name: {get_param: PortName} - fixed_ips: {get_param: FixedIPs} + fixed_ips: + if: + - net_is_ctlplane_and_fixed_ip_not_set + - [{subnet: {get_param: ControlPlaneSubnet}}] + - get_param: FixedIPs replacement_policy: AUTO outputs: diff --git a/overcloud.j2.yaml b/overcloud.j2.yaml index 01a46bf93c..225b59a544 100644 --- a/overcloud.j2.yaml +++ b/overcloud.j2.yaml @@ -94,6 +94,10 @@ parameters: default: nic1 description: Which interface to add to the NeutronPhysicalBridge. type: string + ControlPlaneSubnet: + description: The name of the undercloud Neutron control plane subnet + default: ctlplane-subnet + type: string ControlFixedIPs: default: [] description: > @@ -255,6 +259,7 @@ parameter_groups: conditions: add_vips_to_etc_hosts: {equals : [{get_param: AddVipsToEtcHosts}, True]} + control_fixed_ip_not_set: {equals : [{get_param: ControlFixedIPs}, []]} resources: @@ -749,7 +754,11 @@ resources: properties: name: control_virtual_ip network: {get_param: NeutronControlPlaneID} - fixed_ips: {get_param: ControlFixedIPs} + fixed_ips: + if: + - control_fixed_ip_not_set + - [{subnet: {get_param: ControlPlaneSubnet}}] + - get_param: ControlFixedIPs replacement_policy: AUTO RedisVirtualIP: diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 30ca6e13d3..51d5265859 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -231,6 +231,11 @@ parameters: container: overcloud-compute object: 0 default: {} + {{role.name}}ControlPlaneSubnet: + default: ctlplane-subnet + description: | + Name of the subnet on ctlplane network for this role. + type: string {% if role.uses_deprecated_params is defined %} parameter_groups: @@ -310,6 +315,7 @@ resources: key_name: {get_param: KeyName} networks: - network: ctlplane + subnet: {get_param: {{role.name}}ControlPlaneSubnet} user_data_format: SOFTWARE_CONFIG user_data: {get_resource: UserData} name: