Browse code

Merge "Fix multinode mode for devstack"

Zuul authored on 2018/03/11 19:57:01
Showing 9 changed files
... ...
@@ -46,19 +46,24 @@
46 46
       - name: compute1
47 47
         label: ubuntu-xenial
48 48
     groups:
49
+      # Node where tests are executed and test results collected
49 50
       - name: tempest
50 51
         nodes:
51 52
           - controller
53
+      # Nodes running the compute service
52 54
       - name: compute
53 55
         nodes:
54 56
           - controller
55 57
           - compute1
58
+      # Nodes that are not the controller
56 59
       - name: subnode
57 60
         nodes:
58 61
           - compute1
62
+      # Switch node for multinode networking setup
59 63
       - name: switch
60 64
         nodes:
61 65
           - controller
66
+      # Peer nodes for multinode networking setup
62 67
       - name: peers
63 68
         nodes:
64 69
           - compute1
... ...
@@ -75,7 +80,7 @@
75 75
       all single Devstack jobs, single or multinode.
76 76
       Variables are defined in job.vars, which is what is then used by single
77 77
       node jobs and by multi node jobs for the controller, as well as in
78
-      job.group-vars.peers, which is what is used by multi node jobs for peer
78
+      job.group-vars.peers, which is what is used by multi node jobs for subnode
79 79
       nodes (everything but the controller).
80 80
     required-projects:
81 81
       - openstack-dev/devstack
... ...
@@ -106,7 +111,6 @@
106 106
         # from the location below for all the CI jobs.
107 107
         ETCD_DOWNLOAD_URL: http://tarballs.openstack.org/etcd/
108 108
       devstack_services:
109
-        # Ignore base set of services setup by test-matrix.
110 109
         # Ignore any default set by devstack. Emit a "disable_all_services".
111 110
         base: false
112 111
       zuul_copy_output:
... ...
@@ -151,7 +155,7 @@
151 151
         stackenv: True
152 152
         auto: True
153 153
     group-vars:
154
-      peers:
154
+      subnode:
155 155
         devstack_localrc:
156 156
           DATABASE_PASSWORD: secretdatabase
157 157
           RABBIT_PASSWORD: secretrabbit
... ...
@@ -188,7 +192,9 @@
188 188
     name: devstack
189 189
     parent: devstack-base
190 190
     description: |
191
-      Single or multi node devstack job for integration gate.
191
+      Base devstack job for integration gate.
192
+
193
+      This base job can be used for single node and multinode devstack jobs.
192 194
     nodeset: openstack-single-node
193 195
     required-projects:
194 196
       - openstack/cinder
... ...
@@ -210,6 +216,15 @@
210 210
         NOVA_VNC_ENABLED: true
211 211
         VNCSERVER_LISTEN: 0.0.0.0
212 212
         VNCSERVER_PROXYCLIENT_ADDRESS: "{{ hostvars[inventory_hostname]['nodepool']['private_ipv4'] }}"
213
+        # Multinode specific settings
214
+        SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
215
+        HOST_IP: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
216
+        PUBLIC_BRIDGE_MTU: "{{ external_bridge_mtu }}"
217
+      devstack_localconf:
218
+        post-config:
219
+          $NEUTRON_CONF:
220
+            DEFAULT:
221
+              global_physnet_mtu: "{{ external_bridge_mtu }}"
213 222
       devstack_services:
214 223
         # Core services enabled for this branch.
215 224
         # This list replaces the test-matrix.
... ...
@@ -286,16 +301,25 @@
286 286
           # Test matrix emits ceilometer but ceilomenter is not installed in the
287 287
           # integrated gate, so specifying the services has not effect.
288 288
           # ceilometer-*: false
289
+        devstack_localrc:
290
+          # Multinode specific settings
291
+          HOST_IP: "{{ hostvars[inventory_hostname]['nodepool']['private_ipv4'] }}"
292
+          SERVICE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
293
+          PUBLIC_BRIDGE_MTU: "{{ external_bridge_mtu }}"
294
+          # Subnode specific settings
295
+          DATABASE_TYPE: mysql
296
+          GLANCE_HOSTPORT: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}:9292"
297
+          Q_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
298
+          RABBIT_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
299
+          DATABASE_HOST: "{{ hostvars['controller']['nodepool']['private_ipv4'] }}"
289 300
 
290 301
 - job:
291 302
     name: devstack-multinode
292
-    parent: devstack-base
293
-    description: Base devstack multinode job
303
+    parent: devstack
294 304
     nodeset: openstack-two-node
295
-    # NOTE(andreaf) The multinode job is useful to see the setup of different
296
-    # services on different nodes, however the subnode configuration is not
297
-    # ready yet. Until then this job should stay non-voting.
298
-    voting: false
305
+    description: |
306
+      Simple multinode test to verify multinode functionality on devstack side.
307
+      This is not meant to be used as a parent job.
299 308
 
300 309
 # NOTE(ianw) Platform tests have traditionally been non-voting because
301 310
 # we often have to rush things through devstack to stabilise the gate,
... ...
@@ -1,3 +1,3 @@
1 1
 - hosts: all
2 2
   roles:
3
-    - run-devstack
3
+    - orchestrate-devstack
... ...
@@ -1,15 +1,25 @@
1
-- hosts: controller
2
-  roles:
3
-    - role: test-matrix
4
-      test_matrix_role: primary 
5
-
6
-- hosts: subnode
7
-  roles:
8
-    - role: test-matrix
9
-      test_matrix_role: subnode
10
-
11 1
 - hosts: all
2
+  pre_tasks:
3
+    - name: Gather minimum local MTU
4
+      set_fact:
5
+        local_mtu: >
6
+          {% set mtus = [] -%}
7
+          {% for interface in ansible_interfaces -%}
8
+            {% set interface_variable = 'ansible_' + interface -%}
9
+            {% if interface_variable in hostvars[inventory_hostname] -%}
10
+              {% set _ = mtus.append(hostvars[inventory_hostname][interface_variable]['mtu']|int) -%}
11
+            {% endif -%}
12
+          {% endfor -%}
13
+          {{- mtus|min -}}
14
+    - name: Calculate external_bridge_mtu
15
+      # 50 bytes is overhead for vxlan (which is greater than GRE
16
+      # allowing us to use either overlay option with this MTU.
17
+      # TODO(andreaf) This should work, but it may have to be reconcilied with
18
+      # the MTU setting used by the multinode setup roles in multinode pre.yaml
19
+      set_fact:
20
+        external_bridge_mtu: "{{ local_mtu | int - 50 }}"
12 21
   roles:
22
+    - test-matrix
13 23
     - configure-swap
14 24
     - setup-stack-user
15 25
     - setup-tempest-user
16 26
new file mode 100644
... ...
@@ -0,0 +1,24 @@
0
+Orchestrate a devstack
1
+
2
+Runs devstack in a multinode scenario, with one controller node
3
+and a group of subnodes.
4
+
5
+The reason for this role is so that jobs in other repository may
6
+run devstack in their plays with no need for re-implementing the
7
+orchestration logic.
8
+
9
+The "run-devstack" role is available to run devstack with no
10
+orchestration.
11
+
12
+This role sets up the controller and CA first, it then pushes CA
13
+data to sub-nodes and run devstack there. The only requirement for
14
+this role is for the controller inventory_hostname to be "controller"
15
+and for all sub-nodes to be defined in a group called "subnode".
16
+
17
+
18
+**Role Variables**
19
+
20
+.. zuul:rolevar:: devstack_base_dir
21
+   :default: /opt/stack
22
+
23
+   The devstack base directory.
0 24
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+devstack_base_dir: /opt/stack
0 1
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+- name: Run devstack on the controller
1
+  include_role:
2
+    name: run-devstack
3
+  when: inventory_hostname == 'controller'
4
+
5
+- name: Setup devstack on sub-nodes
6
+  block:
7
+
8
+  - name: Sync CA data to subnodes (when any)
9
+    # Only do this if the tls-proxy service is defined and enabled
10
+    include_role:
11
+      name: sync-devstack-data
12
+    when: devstack_services['tls-proxy']|default(false)
13
+
14
+  - name: Run devstack on the sub-nodes
15
+    include_role:
16
+      name: run-devstack
17
+    when: inventory_hostname in groups['subnode']
18
+
19
+  - name: Discover hosts
20
+    # Discovers compute nodes (subnodes) and maps them to cells. Only run
21
+    # on the controller node.
22
+    # NOTE(mriedem): We want to remove this if/when nova supports
23
+    # auto-registration of computes with cells, but that's not happening in
24
+    # Ocata.
25
+    # NOTE(andreaf) This is taken (NOTE included) from the discover_hosts
26
+    # function in devstack gate. Since this is now in devstack, which is
27
+    # branched, we know that the discover_hosts tool exists.
28
+    become: true
29
+    become_user: stack
30
+    shell: ./tools/discover_hosts.sh
31
+    args:
32
+      chdir: "{{ devstack_base_dir }}/devstack"
33
+    when: inventory_hostname == 'controller'
34
+
35
+  when:
36
+    - '"controller" in hostvars'
37
+    - '"subnode" in groups'
0 38
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+Sync devstack data for multinode configurations
1
+
2
+Sync any data files which include certificates to be used if TLS is enabled.
3
+This role must be executed on the controller and it pushes data to all
4
+subnodes.
5
+
6
+**Role Variables**
7
+
8
+.. zuul:rolevar:: devstack_base_dir
9
+   :default: /opt/stack
10
+
11
+   The devstack base directory.
0 12
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+devstack_base_dir: /opt/stack
0 1
new file mode 100644
... ...
@@ -0,0 +1,48 @@
0
+- name: Ensure the data folder exists
1
+  become: true
2
+  file:
3
+    path: "{{ devstack_base_dir }}/data"
4
+    state: directory
5
+    owner: stack
6
+    group: stack
7
+    mode: 0755
8
+  when: 'inventory_hostname in groups["subnode"]|default([])'
9
+
10
+- name: Ensure the CA folder exists
11
+  become: true
12
+  file:
13
+    path: "{{ devstack_base_dir }}/data/CA"
14
+    state: directory
15
+    owner: stack
16
+    group: stack
17
+    mode: 0755
18
+  when: 'inventory_hostname in groups["subnode"]|default([])'
19
+
20
+- name: Pull the CA certificate and folder
21
+  become: true
22
+  synchronize:
23
+    src: "{{ item }}"
24
+    dest: "{{ zuul.executor.work_root }}/{{ item | basename }}"
25
+    mode: pull
26
+  with_items:
27
+    - "{{ devstack_base_dir }}/data/ca-bundle.pem"
28
+    - "{{ devstack_base_dir }}/data/CA"
29
+  when: inventory_hostname == 'controller'
30
+
31
+- name: Push the CA certificate
32
+  become: true
33
+  become_user: stack
34
+  synchronize:
35
+    src: "{{ zuul.executor.work_root }}/ca-bundle.pem"
36
+    dest: "{{ devstack_base_dir }}/data/ca-bundle.pem"
37
+    mode: push
38
+  when: 'inventory_hostname in groups["subnode"]|default([])'
39
+
40
+- name: Push the CA folder
41
+  become: true
42
+  become_user: stack
43
+  synchronize:
44
+    src: "{{ zuul.executor.work_root }}/CA/"
45
+    dest: "{{ devstack_base_dir }}/data/"
46
+    mode: push
47
+  when: 'inventory_hostname in groups["subnode"]|default([])'