Browse Source

Merge "Add neutron metering role into kolla-ansible"

Zuul 5 months ago
parent
commit
c6e1ae982d

+ 1
- 0
ansible/group_vars/all.yml View File

@@ -517,6 +517,7 @@ enable_neutron_bgp_dragent: "no"
517 517
 enable_neutron_provider_networks: "no"
518 518
 enable_neutron_segments: "no"
519 519
 enable_neutron_sfc: "no"
520
+enable_neutron_metering: "no"
520 521
 enable_neutron_infoblox_ipam_agent: "no"
521 522
 enable_nova_serialconsole_proxy: "no"
522 523
 enable_nova_ssh: "yes"

+ 3
- 0
ansible/inventory/all-in-one View File

@@ -306,6 +306,9 @@ neutron
306 306
 [neutron-infoblox-ipam-agent:children]
307 307
 neutron
308 308
 
309
+[neutron-metering-agent:children]
310
+neutron
311
+
309 312
 [ironic-neutron-agent:children]
310 313
 neutron
311 314
 

+ 3
- 0
ansible/inventory/multinode View File

@@ -325,6 +325,9 @@ neutron
325 325
 [neutron-infoblox-ipam-agent:children]
326 326
 neutron
327 327
 
328
+[neutron-metering-agent:children]
329
+neutron
330
+
328 331
 [ironic-neutron-agent:children]
329 332
 neutron
330 333
 

+ 20
- 0
ansible/roles/neutron/defaults/main.yml View File

@@ -193,6 +193,19 @@ neutron_services:
193 193
       - "/run:/run:shared"
194 194
       - "kolla_logs:/var/log/kolla/"
195 195
     dimensions: "{{ neutron_infoblox_ipam_agent_dimensions }}"
196
+  neutron-metering-agent:
197
+    container_name: "neutron_metering_agent"
198
+    image: "{{ neutron_metering_agent_image_full }}"
199
+    privileged: True
200
+    enabled: "{{ enable_neutron_metering | bool }}"
201
+    group: "neutron-metering-agent"
202
+    host_in_groups: "{{ inventory_hostname in groups['neutron-metering-agent'] }}"
203
+    volumes:
204
+      - "{{ node_config_directory }}/neutron-metering-agent/:{{ container_config_directory }}/:ro"
205
+      - "/etc/localtime:/etc/localtime:ro"
206
+      - "/run:/run:shared"
207
+      - "kolla_logs:/var/log/kolla/"
208
+    dimensions: "{{ neutron_metering_agent_dimensions }}"
196 209
   ironic-neutron-agent:
197 210
     container_name: "ironic_neutron_agent"
198 211
     image: "{{ ironic_neutron_agent_image_full }}"
@@ -260,6 +273,10 @@ neutron_infoblox_ipam_agent_image: "{{ docker_registry ~ '/' if docker_registry
260 273
 neutron_infoblox_ipam_agent_tag: "{{ neutron_tag }}"
261 274
 neutron_infoblox_ipam_agent_image_full: "{{ neutron_infoblox_ipam_agent_image }}:{{ neutron_infoblox_ipam_agent_tag }}"
262 275
 
276
+neutron_metering_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ neutron_install_type }}-neutron-metering-agent"
277
+neutron_metering_agent_tag: "{{ neutron_tag }}"
278
+neutron_metering_agent_image_full: "{{ neutron_metering_agent_image }}:{{ neutron_metering_agent_tag }}"
279
+
263 280
 ironic_neutron_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ neutron_install_type }}-ironic-neutron-agent"
264 281
 ironic_neutron_agent_tag: "{{ neutron_tag }}"
265 282
 ironic_neutron_agent_image_full: "{{ ironic_neutron_agent_image }}:{{ ironic_neutron_agent_tag }}"
@@ -275,6 +292,7 @@ neutron_server_dimensions: "{{ default_container_dimensions }}"
275 292
 neutron_bgp_dragent_dimensions: "{{ default_container_dimensions }}"
276 293
 neutron_infoblox_ipam_agent_dimensions: "{{ default_container_dimensions }}"
277 294
 neutron_openvswitch_agent_xenapi_dimensions: "{{ default_container_dimensions }}"
295
+neutron_metering_agent_dimensions: "{{ default_container_dimensions }}"
278 296
 ironic_neutron_agent_dimensions: "{{ default_container_dimensions }}"
279 297
 
280 298
 
@@ -332,6 +350,8 @@ service_plugins:
332 350
     enabled: "{{ enable_neutron_lbaas | bool and not enable_octavia | bool }}"
333 351
   - name: "lbaasv2-proxy"
334 352
     enabled: "{{ enable_neutron_lbaas | bool and enable_octavia | bool }}"
353
+  - name: "metering"
354
+    enabled: "{{ enable_neutron_metering | bool }}"
335 355
   - name: "neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin"
336 356
     enabled: "{{ enable_neutron_bgp_dragent | bool }}"
337 357
   - name: "qos"

+ 25
- 0
ansible/roles/neutron/handlers/main.yml View File

@@ -344,6 +344,31 @@
344 344
       or neutron_ml2_conf | changed
345 345
       or neutron_infoblox_ipam_agent_container | changed
346 346
 
347
+- name: Restart neutron-metering-agent container
348
+  vars:
349
+    service_name: "neutron-metering-agent"
350
+    service: "{{ neutron_services[service_name] }}"
351
+    config_json: "{{ neutron_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
352
+    neutron_conf: "{{ neutron_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
353
+    neutron_metering_agent_container: "{{ check_neutron_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
354
+  become: true
355
+  kolla_docker:
356
+    action: "recreate_or_restart_container"
357
+    common_options: "{{ docker_common_options }}"
358
+    name: "{{ service.container_name }}"
359
+    image: "{{ service.image }}"
360
+    volumes: "{{ service.volumes }}"
361
+    dimensions: "{{ service.dimensions }}"
362
+    privileged: "{{ service.privileged | default(False) }}"
363
+  when:
364
+    - kolla_action != "config"
365
+    - service.enabled | bool
366
+    - service.host_in_groups | bool
367
+    - config_json | changed
368
+      or neutron_conf | changed
369
+      or neutron_metering_agent_ini | changed
370
+      or neutron_metering_agent_container | changed
371
+
347 372
 - name: Restart ironic-neutron-agent container
348 373
   vars:
349 374
     service_name: "ironic-neutron-agent"

+ 20
- 0
ansible/roles/neutron/tasks/config.yml View File

@@ -55,6 +55,7 @@
55 55
       - "neutron-l3-agent"
56 56
       - "neutron-linuxbridge-agent"
57 57
       - "neutron-metadata-agent"
58
+      - "neutron-metering-agent"
58 59
       - "neutron-openvswitch-agent"
59 60
       - "neutron-openvswitch-agent-xenapi"
60 61
       - "neutron-server"
@@ -306,6 +307,24 @@
306 307
   notify:
307 308
     - "Restart {{ service_name }} container"
308 309
 
310
+- name: Copying over metering_agent.ini
311
+  become: true
312
+  vars:
313
+    service_name: "neutron-metering-agent"
314
+    neutron_metering_agent: "{{ neutron_services[service_name] }}"
315
+  merge_configs:
316
+    sources:
317
+      - "{{ role_path }}/templates/metering_agent.ini.j2"
318
+      - "{{ node_custom_config }}/neutron/metering_agent.ini"
319
+    dest: "{{ node_config_directory }}/{{ service_name }}/metering_agent.ini"
320
+    mode: "0660"
321
+  register: neutron_metering_agent_ini
322
+  when:
323
+    - neutron_metering_agent.enabled | bool
324
+    - neutron_metering_agent.host_in_groups | bool
325
+  notify:
326
+    - "Restart {{ service_name }} container"
327
+
309 328
 - name: Copying over ironic_neutron_agent.ini
310 329
   become: true
311 330
   vars:
@@ -373,6 +392,7 @@
373 392
       - "neutron-l3-agent"
374 393
       - "neutron-linuxbridge-agent"
375 394
       - "neutron-metadata-agent"
395
+      - "neutron-metering-agent"
376 396
       - "neutron-openvswitch-agent"
377 397
       - "neutron-openvswitch-agent-xenapi"
378 398
       - "neutron-server"

+ 3
- 0
ansible/roles/neutron/templates/metering_agent.ini.j2 View File

@@ -0,0 +1,3 @@
1
+[DEFAULT]
2
+interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
3
+driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver

+ 36
- 0
ansible/roles/neutron/templates/neutron-metering-agent.json.j2 View File

@@ -0,0 +1,36 @@
1
+{
2
+    "command": "neutron-metering-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metering_agent.ini",
3
+    "config_files": [
4
+        {
5
+            "source": "{{ container_config_directory }}/neutron.conf",
6
+            "dest": "/etc/neutron/neutron.conf",
7
+            "owner": "neutron",
8
+            "perm": "0600"
9
+        },
10
+        {
11
+            "source": "{{ container_config_directory }}/metering_agent.ini",
12
+            "dest": "/etc/neutron/metering_agent.ini",
13
+            "owner": "neutron",
14
+            "perm": "0600"
15
+        },
16
+        {
17
+            "source": "{{ container_config_directory }}/policy.json",
18
+            "dest": "/etc/neutron/policy.json",
19
+            "owner": "neutron",
20
+            "perm": "0600",
21
+            "optional": true
22
+        }
23
+    ],
24
+    "permissions": [
25
+        {
26
+            "path": "/var/log/kolla/neutron",
27
+            "owner": "neutron:neutron",
28
+            "recurse": true
29
+        },
30
+        {
31
+            "path": "/var/lib/neutron/kolla",
32
+            "owner": "neutron:neutron",
33
+            "recurse": true
34
+        }
35
+    ]
36
+}

+ 1
- 0
ansible/site.yml View File

@@ -654,6 +654,7 @@
654 654
     - neutron-lbaas-agent
655 655
     - ironic-neutron-agent
656 656
     - neutron-metadata-agent
657
+    - neutron-metering-agent
657 658
     - compute
658 659
     - manila-share
659 660
   serial: '{{ kolla_serial|default("0") }}'

+ 1
- 0
etc/kolla/globals.yml View File

@@ -255,6 +255,7 @@ kolla_internal_vip_address: "10.10.10.254"
255 255
 #enable_neutron_vpnaas: "no"
256 256
 #enable_neutron_sriov: "no"
257 257
 #enable_neutron_sfc: "no"
258
+#enable_neutron_metering: "no"
258 259
 #enable_nova_fake: "no"
259 260
 #enable_nova_serialconsole_proxy: "no"
260 261
 #enable_nova_ssh: "yes"

+ 3
- 0
releasenotes/notes/add-neutron-metering-support-4266364hudc5l80c.yaml View File

@@ -0,0 +1,3 @@
1
+---
2
+features:
3
+  - Add neutron-metering-agent into kolla-ansible

+ 3
- 0
tests/templates/inventory.j2 View File

@@ -302,6 +302,9 @@ neutron
302 302
 [neutron-infoblox-ipam-agent:children]
303 303
 neutron
304 304
 
305
+[neutron-metering-agent:children]
306
+neutron
307
+
305 308
 [ironic-neutron-agent:children]
306 309
 neutron
307 310
 

Loading…
Cancel
Save