Fix notifier should only notify successfully evacuated nodes
Currently, Freezer' notifier when notifying about successful evacuated nodes notifies all nodes. ... notify_nodes = evac.get_nodes_details(nodes) ... notifier.notify(notify_nodes, 'success') Change-Id: I1f301b458a6407e5d98445707c00775ca730781f
This commit is contained in:
parent
0ae9cb9b9a
commit
e13dec53f9
|
@ -65,4 +65,4 @@
|
|||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="content">
|
||||
<p>Dear {{ name }}, <br />
|
||||
One of our compute nodes failed due to some technical problem. Your
|
||||
instances (listed below) running in tenant {{ tenant }} is being evacuated to another compute host.<br />
|
||||
Instances: <br />
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Instance Name
|
||||
</td>
|
||||
<td>
|
||||
IP
|
||||
</td>
|
||||
</tr>
|
||||
{% for instance in instances%}
|
||||
<tr>
|
||||
<td> {{ instance.get('name') }} </td>
|
||||
<td>
|
||||
{% for key, value in instance.get('addresses').iteritems() %}
|
||||
<b>{{ key }}</b> :
|
||||
{{ value[0].get('addr', 'No IP') }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
TimeStamp: {{ evacuation_time }} <br />
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
Thanks for using <b>Freezer-DR !</b>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
<div id="content">
|
||||
<p>Dear Administrators, <br />
|
||||
A compute node failed and freezer-dr successfully evacuated all instances running
|
||||
on this compute node another computes. Please, find the following details
|
||||
A compute node failed and freezer-dr successfully evacuated these instances running
|
||||
on this compute node to another node. Please, find the following details
|
||||
about the evacuated host: <br />
|
||||
Host: {{ host }} <br />
|
||||
<p>
|
||||
|
@ -66,4 +66,4 @@
|
|||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -44,10 +44,12 @@ def main():
|
|||
# Shutdown the node
|
||||
evac = EvacuationManager()
|
||||
notify_nodes = evac.get_nodes_details(nodes)
|
||||
notifier.notify(notify_nodes, 'original')
|
||||
evacuated_nodes, failed_nodes = evac.evacuate(nodes)
|
||||
LOG.debug("Successfully evacuated nodes {0}".format(evacuated_nodes))
|
||||
LOG.debug("Failed to evacuate nodes {0}".format(failed_nodes))
|
||||
notifier.notify(notify_nodes, 'success')
|
||||
evacuated_nodes = evac.get_nodes_details(evacuated_nodes)
|
||||
notifier.notify(evacuated_nodes, 'success')
|
||||
failed_nodes = evac.get_nodes_details(failed_nodes)
|
||||
notifier.notify(failed_nodes, 'error')
|
||||
else:
|
||||
|
|
|
@ -46,6 +46,8 @@ class StandardEmail(NotifierBaseDriver):
|
|||
|
||||
def notify_status(self, node, status):
|
||||
_template = 'info.jinja'
|
||||
if status == 'original':
|
||||
_template = 'original.jinja'
|
||||
if status == 'success':
|
||||
_template = 'user_success.jinja'
|
||||
elif status == 'error':
|
||||
|
|
Loading…
Reference in New Issue