summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonelle Landy <rlandy@redhat.com>2018-12-06 14:25:15 -0500
committerQuique Llorente <ellorent@redhat.com>2019-01-23 10:30:20 +0100
commit9853d3608f89cec205dd46ec0197fbad09c18ae8 (patch)
tree77eefc557456b521282fbe7029ec442f5b5babc6
parent0d50b773bd4f578d96977921acd31ca577e9f56b (diff)
Default private_ipv4 to use public_ipv4 address when null
The static zuul driver returns only a public_ipv4 address for nodes in use. The multinode bridge role accesses the node private_ipv4 address. As such, when the private address is empty/null the role fails. This review defaults that private address so that the role uses the public address when the private address is null. Change-Id: I32fb17bae98f13f735da4d5b9a6a01e948f21678
Notes
Notes (review): Code-Review+2: Monty Taylor <mordred@inaugust.com> Code-Review+1: Tristan Cacqueray <tdecacqu@redhat.com> Code-Review+2: Ian Wienand <iwienand@redhat.com> Workflow+1: Ian Wienand <iwienand@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 24 Jan 2019 12:16:11 +0000 Reviewed-on: https://review.openstack.org/623294 Project: openstack-infra/zuul-jobs Branch: refs/heads/master
-rw-r--r--roles/multi-node-bridge/tasks/peer.yaml31
1 files changed, 21 insertions, 10 deletions
diff --git a/roles/multi-node-bridge/tasks/peer.yaml b/roles/multi-node-bridge/tasks/peer.yaml
index 65f8f9a..8eeba12 100644
--- a/roles/multi-node-bridge/tasks/peer.yaml
+++ b/roles/multi-node-bridge/tasks/peer.yaml
@@ -9,19 +9,30 @@
9 vni: "{{ offset | int + bridge_vni_offset | int }}" 9 vni: "{{ offset | int + bridge_vni_offset | int }}"
10 10
11# To make things more readable in the following tasks 11# To make things more readable in the following tasks
12- name: Set ip address when the node private IP is not set
13 set_fact:
14 nodepool_ip: |
15 {{ nodepool.private_ipv4 | default(nodepool.public_ipv4) }}
16
17- name: Select the switch from group
18 set_fact:
19 switch: "{{ groups['switch'][0] }}"
20
12- name: Alias the primary node private IP 21- name: Alias the primary node private IP
13 set_fact: 22 set_fact:
14 switch_private_ip: "{{ hostvars[groups['switch'][0]]['nodepool']['private_ipv4'] }}" 23 switch_ip: |
24 {{ hostvars[switch].nodepool.private_ipv4 |
25 default(hostvars[switch].nodepool.public_ipv4) }}
15 26
16- name: Add port to bridge on switch node 27- name: Add port to bridge on switch node
17 become: yes 28 become: yes
18 command: >- 29 command: >-
19 ovs-vsctl --may-exist add-port {{ bridge_name }} 30 ovs-vsctl --may-exist add-port {{ bridge_name }}
20 {{ bridge_name }}_{{ nodepool['private_ipv4'] }} 31 {{ bridge_name }}_{{ nodepool_ip }}
21 -- set interface {{ bridge_name }}_{{ nodepool['private_ipv4'] }} 32 -- set interface {{ bridge_name }}_{{ nodepool_ip}}
22 type=vxlan options:remote_ip={{ nodepool['private_ipv4'] }} options:key={{ vni }} 33 type=vxlan options:remote_ip={{ nodepool_ip }} options:key={{ vni }}
23 options:local_ip={{ switch_private_ip }} 34 options:local_ip={{ switch_ip }}
24 delegate_to: "{{ groups['switch'][0] }}" 35 delegate_to: "{{ switch }}"
25 36
26- name: Create bridge on peer node 37- name: Create bridge on peer node
27 become: yes 38 become: yes
@@ -36,10 +47,10 @@
36 become: yes 47 become: yes
37 command: >- 48 command: >-
38 ovs-vsctl --may-exist add-port {{ bridge_name }} 49 ovs-vsctl --may-exist add-port {{ bridge_name }}
39 {{ bridge_name }}_{{ switch_private_ip }} 50 {{ bridge_name }}_{{ switch_ip }}
40 -- set interface {{ bridge_name }}_{{ switch_private_ip }} 51 -- set interface {{ bridge_name }}_{{ switch_ip }}
41 type=vxlan options:remote_ip={{ switch_private_ip }} options:key={{ vni }} 52 type=vxlan options:remote_ip={{ switch_ip }} options:key={{ vni }}
42 options:local_ip={{ nodepool['private_ipv4'] }} 53 options:local_ip={{ nodepool_ip }}
43 54
44- when: bridge_configure_address 55- when: bridge_configure_address
45 block: 56 block: