Browse code

Set the base set of services

Use the test-matrix role from devstack-gate to define a base set of
services to be enabled for the controller and compute nodes.

Extend the local conf module to handle the base set of services.

Since the test-matrix defines services for primary and subnode nodes, we
need a multinode job to test that this works. Add a new host group
called subnode that includes the non-controller hosts. Add a new job
that runs devstack on a two nodes environment.

Using service from the test matrix enables swift in the gate, so we need
to set SWIFT_HASH for devstack to work.

Depends-on: Ie36ba0cd7cfcd450b75000a76a64d856f2a83eba
Depends-on: Id9ad3be4be25e699f77d6b5a252f046ce8234f45
Change-Id: I379abf482c89122533324e64fefbff3d5a618a89

Andrea Frittoli (andreaf) authored on 2017/12/02 02:36:38
Showing 6 changed files
... ...
@@ -23,6 +23,9 @@
23 23
         nodes:
24 24
           - controller
25 25
           - compute1
26
+      - name: subnode
27
+        nodes:
28
+          - compute1
26 29
 
27 30
 - job:
28 31
     name: devstack
... ...
@@ -39,9 +42,11 @@
39 39
       - openstack/requirements
40 40
       - openstack/swift
41 41
     roles:
42
+      - zuul: openstack-infra/devstack-gate
42 43
       - zuul: openstack-infra/openstack-zuul-jobs
43 44
     timeout: 7200
44 45
     vars:
46
+      test_matrix_configs: ['neutron', 'tlsproxy']
45 47
       devstack_localrc:
46 48
         DATABASE_PASSWORD: secretdatabase
47 49
         RABBIT_PASSWORD: secretrabbit
... ...
@@ -57,6 +62,7 @@
57 57
         FLOATING_HOST_MASK: 23
58 58
         SWIFT_REPLICAS: 1
59 59
         SWIFT_START_ALL_SERVICES: false
60
+        SWIFT_HASH: 1234123412341234
60 61
         LOGFILE: /opt/stack/logs/devstacklog.txt
61 62
         LOG_COLOR: false
62 63
         VERBOSE: true
... ...
@@ -75,9 +81,19 @@
75 75
     run: playbooks/devstack.yaml
76 76
     post-run: playbooks/post.yaml
77 77
 
78
+- job:
79
+    name: devstack-multinode
80
+    parent: devstack
81
+    description: Base devstack multinode job
82
+    nodeset: openstack-two-node
83
+    # NOTE(andreaf) The multinode job is useful to see the setup of different
84
+    # services on different nodes, however the subnode configuration is not
85
+    # ready yet. Until then this job should stay non-voting.
86
+    voting: false
78 87
 
79 88
 - project:
80 89
     name: openstack-dev/devstack
81 90
     check:
82 91
       jobs:
83 92
         - devstack
93
+        - devstack-multinode
... ...
@@ -1,3 +1,13 @@
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
+
1 11
 - hosts: all
2 12
   roles:
3 13
     - configure-swap
... ...
@@ -8,7 +18,7 @@
8 8
     - setup-devstack-cache
9 9
     - start-fresh-logging
10 10
     - write-devstack-local-conf
11
-  # TODO(jeblair): remove when configure-mirrors is fixed  
11
+  # TODO(jeblair): remove when configure-mirrors is fixed
12 12
   tasks:
13 13
     - name: Hack mirror_info
14 14
       shell:
... ...
@@ -47,6 +47,14 @@ Write the local.conf file for use by devstack
47 47
             This is a dictionary of key-value pairs which comprise
48 48
             this section of the INI file.
49 49
 
50
+.. zuul:rolevar:: devstack_base_services
51
+   :type: list
52
+   :default: {{ base_services | default(omit) }}
53
+
54
+   A list of base services which are enabled. Services can be added or removed
55
+   from this list via the ``devstack_services`` variable. This is ignored if
56
+   ``base`` is set to ``False`` in ``devstack_services``.
57
+
50 58
 .. zuul:rolevar:: devstack_services
51 59
    :type: dict
52 60
 
... ...
@@ -54,11 +62,12 @@ Write the local.conf file for use by devstack
54 54
    boolean value is ``false``, a ``disable_service`` line will be
55 55
    emitted for the service name.  If it is ``true``, then
56 56
    ``enable_service`` will be emitted. All other values are ignored.
57
+
57 58
    The special key ``base`` can be used to enable or disable the base set of
58 59
    services enabled by default. If ``base`` is found, it will processed before
59 60
    all other keys. If its value is ``False`` a ``disable_all_services`` will be
60
-   emitted; if its value is ``True`` nothing will be emitted since base
61
-   services are enabled by default.
61
+   emitted; if its value is ``True`` services from ``devstack_base_services``
62
+   will be emitted via ``ENABLED_SERVICES``.
62 63
 
63 64
 .. zuul:rolevar:: devstack_plugins
64 65
    :type: dict
... ...
@@ -1,2 +1,3 @@
1 1
 devstack_base_dir: /opt/stack
2 2
 devstack_local_conf_path: "{{ devstack_base_dir }}/devstack/local.conf"
3
+devstack_base_services: "{{ enabled_services | default(omit) }}"
... ...
@@ -106,13 +106,13 @@ class VarGraph(object):
106 106
 
107 107
 class LocalConf(object):
108 108
 
109
-    def __init__(self, localrc, localconf, services, plugins):
109
+    def __init__(self, localrc, localconf, base_services, services, plugins):
110 110
         self.localrc = []
111 111
         self.meta_sections = {}
112 112
         if plugins:
113 113
             self.handle_plugins(plugins)
114
-        if services:
115
-            self.handle_services(services)
114
+        if services or base_services:
115
+            self.handle_services(base_services, services or {})
116 116
         if localrc:
117 117
             self.handle_localrc(localrc)
118 118
         if localconf:
... ...
@@ -123,9 +123,12 @@ class LocalConf(object):
123 123
             if v:
124 124
                 self.localrc.append('enable_plugin {} {}'.format(k, v))
125 125
 
126
-    def handle_services(self, services):
127
-        base_services = services.pop('base', True)
128
-        if not base_services:
126
+    def handle_services(self, base_services, services):
127
+        enable_base_services = services.pop('base', True)
128
+        if enable_base_services and base_services:
129
+            self.localrc.append('ENABLED_SERVICES={}'.format(
130
+                ",".join(base_services)))
131
+        else:
129 132
             self.localrc.append('disable_all_services')
130 133
         for k, v in services.items():
131 134
             if v is False:
... ...
@@ -164,6 +167,7 @@ def main():
164 164
     module = AnsibleModule(
165 165
         argument_spec=dict(
166 166
             plugins=dict(type='dict'),
167
+            base_services=dict(type='list'),
167 168
             services=dict(type='dict'),
168 169
             localrc=dict(type='dict'),
169 170
             local_conf=dict(type='dict'),
... ...
@@ -174,6 +178,7 @@ def main():
174 174
     p = module.params
175 175
     lc = LocalConf(p.get('localrc'),
176 176
                    p.get('local_conf'),
177
+                   p.get('base_services'),
177 178
                    p.get('services'),
178 179
                    p.get('plugins'))
179 180
     lc.write(p['path'])
... ...
@@ -4,6 +4,7 @@
4 4
   devstack_local_conf:
5 5
     path: "{{ devstack_local_conf_path }}"
6 6
     plugins: "{{ devstack_plugins|default(omit) }}"
7
+    base_services: "{{ devstack_base_services|default(omit) }}"
7 8
     services: "{{ devstack_services|default(omit) }}"
8 9
     localrc: "{{ devstack_localrc|default(omit) }}"
9 10
     local_conf: "{{ devstack_local_conf|default(omit) }}"