Skip to content

Commit 899ab44

Browse files
Scott Shambargermarkgoddard
authored andcommitted
monasca-thresh: Fix topology submission to storm
monasca-thresh currently runs a local copy of the storm to handle the threshold topology. However, it doesn't setup the environment correctly, and the executable fails, causing the container to continually restart. This patch updates the container command to correctly submit the topology to the running Apache storm. The container will exit after it finishes the submission, so the restart_policy is updated to on-failure, this way if the storm is temporarily unavailable, the submission will be retried. (NOTE: further deploys will see the container as "changed" as it won't be running) Patch uses KOLLA_BOOTSTRAP to trigger the container to check if the topology is already submitted, and if so skips the submission command so the container doesn't fail. The config task now triggers a new reconfigure handler that spawns a one-shot container to replace any existing topology if the configuration has changed. Also, all the storm.* variables in storm.yml.j2 are removed as they were only needed for local mode and make submitted topologies fail to load when the storm is restarted (the referenced directories not mounted on nimbus). Depends-On: https://review.opendev.org/c/openstack/kolla/+/804018 Closes-Bug: #1808805 Change-Id: Ib225d76076782d695c9387e1c2693bae9a4521d7 (cherry picked from commit aea9bf3)
1 parent cbda3c3 commit 899ab44

File tree

8 files changed

+61
-14
lines changed

8 files changed

+61
-14
lines changed

ansible/roles/monasca/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ monasca_services:
5050
image: "{{ monasca_thresh_image_full }}"
5151
volumes: "{{ monasca_thresh_default_volumes + monasca_thresh_extra_volumes }}"
5252
dimensions: "{{ monasca_thresh_dimensions }}"
53+
state: "exited"
5354
monasca-notification:
5455
container_name: monasca_notification
5556
group: monasca-notification

ansible/roles/monasca/handlers/main.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,43 @@
4646

4747
- name: Restart monasca-thresh container
4848
vars:
49-
service_name: "monasca-thresh"
50-
service: "{{ monasca_services[service_name] }}"
49+
service: "{{ monasca_services['monasca-thresh'] }}"
5150
become: true
5251
kolla_docker:
53-
action: "recreate_or_restart_container"
52+
action: "start_container"
5453
common_options: "{{ docker_common_options }}"
5554
name: "{{ service.container_name }}"
5655
image: "{{ service.image }}"
5756
volumes: "{{ service.volumes }}"
5857
dimensions: "{{ service.dimensions }}"
58+
detach: False
59+
remove_on_exit: false
60+
restart_policy: no
61+
environment:
62+
KOLLA_BOOTSTRAP:
63+
run_once: True
64+
delegate_to: "{{ groups[service.group]|first }}"
65+
when:
66+
- kolla_action != "config"
67+
68+
- name: Resubmitting monasca-thresh topology
69+
vars:
70+
service: "{{ monasca_services['monasca-thresh'] }}"
71+
become: true
72+
kolla_docker:
73+
action: "start_container"
74+
common_options: "{{ docker_common_options }}"
75+
name: "resubmit_{{ service.container_name }}"
76+
image: "{{ service.image }}"
77+
volumes: "{{ service.volumes }}"
78+
dimensions: "{{ service.dimensions }}"
79+
detach: False
80+
restart_policy: no
81+
environment:
82+
KOLLA_BOOTSTRAP:
83+
TOPOLOGY_REPLACE:
84+
run_once: True
85+
delegate_to: "{{ groups[service.group]|first }}"
5986
when:
6087
- kolla_action != "config"
6188

ansible/roles/monasca/tasks/check-containers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
pid_mode: "{{ item.value.pid_mode|default('') }}"
1010
volumes: "{{ item.value.volumes }}"
1111
dimensions: "{{ item.value.dimensions }}"
12+
state: "{{ item.value.state | default('running') }}"
1213
when:
1314
- inventory_hostname in groups[item.value.group]
1415
- item.value.enabled | bool

ansible/roles/monasca/tasks/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
- inventory_hostname in groups[service['group']]
269269
- service.enabled | bool
270270
notify:
271-
- Restart monasca-thresh container
271+
- Resubmitting monasca-thresh topology
272272

273273
- name: Copying over monasca-thresh storm config
274274
vars:
@@ -286,7 +286,7 @@
286286
- inventory_hostname in groups[service['group']]
287287
- service.enabled | bool
288288
notify:
289-
- Restart monasca-thresh container
289+
- Resubmitting monasca-thresh topology
290290

291291
- name: Copying over monasca-notification config
292292
vars:

ansible/roles/monasca/tasks/upgrade.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,18 @@
99

1010
- import_tasks: bootstrap_service.yml
1111

12+
# NOTE(sshambar): We don't want pre-upgrade monasca-thresh instances
13+
# running in local mode after an upgrade, so stop them.
14+
# The first node will be replaced with the submission container in the
15+
# handlers below.
16+
- name: Stopping all monasca-thresh instances but the first node
17+
become: true
18+
kolla_docker:
19+
action: "stop_container"
20+
common_options: "{{ docker_common_options }}"
21+
name: "{{ monasca_services['monasca-thresh']['container_name'] }}"
22+
when:
23+
- inventory_hostname != groups['monasca-thresh']|first
24+
1225
- name: Flush handlers
1326
meta: flush_handlers

ansible/roles/monasca/templates/monasca-thresh/monasca-thresh.json.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"command": "/opt/storm/bin/storm jar /monasca-thresh-source/monasca-thresh-*/thresh/target/monasca-thresh-*-SNAPSHOT-shaded.jar -Djava.io.tmpdir=/var/lib/monasca-thresh/data monasca.thresh.ThresholdingEngine /etc/monasca/thresh-config.yml monasca-thresh local",
2+
"command": "/opt/storm/bin/storm jar /monasca-thresh-source/monasca-thresh-*/thresh/target/monasca-thresh-*-SNAPSHOT-shaded.jar -Djava.io.tmpdir=/var/lib/monasca-thresh/data monasca.thresh.ThresholdingEngine /etc/monasca/thresh-config.yml monasca-thresh",
33
"config_files": [
44
{
55
"source": "{{ container_config_directory }}/thresh-config.yml",
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
storm.local.dir: "/var/lib/monasca-thresh/data"
2-
storm.log.dir: "/var/log/kolla/storm"
3-
storm.workers.artifacts.dir: "/var/lib/monasca-thresh/worker-artifacts"
41
nimbus.seeds: [{{ monasca_storm_nimbus_servers }}]
5-
storm.zookeeper.port: {{ zookeeper_client_port }}
6-
storm.zookeeper.servers:
7-
{% for host in groups['zookeeper'] %}
8-
- "{{ 'api' | kolla_address(host) }}"
9-
{% endfor %}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes monasca-thresh to correctly submit the topology to Storm.
5+
The previous container ran the topology in local mode (within the
6+
container), and didn't use the Storm cloud. The new container
7+
handles submitting the topology to Storm and also handles killing
8+
and replaces the topology when it's configuration has changed.
9+
As a result, the monasca-thresh container is only used for
10+
submission, and exits after that's completed.
11+
The logs for the topology will now be available in the storm
12+
worker-artifact logs.
13+
`LP#1808805 <https://launchpad.net/bugs/1808805>`__

0 commit comments

Comments
 (0)