diff --git a/etc/templates/error.jinja b/etc/templates/error.jinja index f969c4a..6adb789 100644 --- a/etc/templates/error.jinja +++ b/etc/templates/error.jinja @@ -65,4 +65,4 @@ - \ No newline at end of file + diff --git a/etc/templates/original.jinja b/etc/templates/original.jinja new file mode 100644 index 0000000..dd6e7e5 --- /dev/null +++ b/etc/templates/original.jinja @@ -0,0 +1,46 @@ + + + + + + {{ title }} + + + + +
+

Dear {{ name }},
+ 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.
+ Instances:
+ + + + + + {% for instance in instances%} + + + + + {% endfor %} +
+ Instance Name + + IP +
{{ instance.get('name') }} + {% for key, value in instance.get('addresses').iteritems() %} + {{ key }} : + {{ value[0].get('addr', 'No IP') }} + {% endfor %} +
+ TimeStamp: {{ evacuation_time }}
+

+
+

+ Thanks for using Freezer-DR ! +

+
+ + + diff --git a/etc/templates/success.jinja b/etc/templates/success.jinja index a6091a6..248bb21 100644 --- a/etc/templates/success.jinja +++ b/etc/templates/success.jinja @@ -10,8 +10,8 @@

Dear Administrators,
- 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:
Host: {{ host }}

@@ -66,4 +66,4 @@

- \ No newline at end of file + diff --git a/freezer_dr/main.py b/freezer_dr/main.py index b43e1e9..cc73db9 100644 --- a/freezer_dr/main.py +++ b/freezer_dr/main.py @@ -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: diff --git a/freezer_dr/notifiers/drivers/default/default_email.py b/freezer_dr/notifiers/drivers/default/default_email.py index 4352bd0..aa397ed 100644 --- a/freezer_dr/notifiers/drivers/default/default_email.py +++ b/freezer_dr/notifiers/drivers/default/default_email.py @@ -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':