Commit 106e3707 by Őry Máté

vm: make destroyed/suspended notifications more accurate

parent d9deb891
...@@ -31,21 +31,23 @@ def garbage_collector(timeout=15): ...@@ -31,21 +31,23 @@ def garbage_collector(timeout=15):
logger.info("Expired instance %d destroyed.", i.pk) logger.info("Expired instance %d destroyed.", i.pk)
try: try:
i.owner.profile.notify( i.owner.profile.notify(
_('Machine destroyed'), _('%s destroyed') % unicode(i),
'dashboard/notifications/vm-destroyed.html', 'dashboard/notifications/vm-destroyed.html',
{'instance': i}) {'instance': i})
except: except Exception as e:
logger.debug('Could not notify owner of instance %d.', i.pk) logger.debug('Could not notify owner of instance %d .%s',
i.pk, unicode(e))
elif (i.time_of_suspend and now < i.time_of_suspend and elif (i.time_of_suspend and now < i.time_of_suspend and
i.state == 'RUNNING'): i.state == 'RUNNING'):
i.sleep_async() i.sleep_async()
logger.info("Expired instance %d suspended." % i.pk) logger.info("Expired instance %d suspended." % i.pk)
try: try:
i.owner.profile.notify( i.owner.profile.notify(
_('Machine suspended'), _('%s suspended') % unicode(i),
'dashboard/notifications/vm-suspended.html', 'dashboard/notifications/vm-suspended.html',
{'instance': i}) {'instance': i})
except: except Exception as e:
logger.debug('Could not notify owner of instance %d.', i.pk) logger.debug('Could not notify owner of instance %d .%s',
i.pk, unicode(e))
else: else:
logger.debug("Instance %d didn't expire." % i.pk) logger.debug("Instance %d didn't expire." % i.pk)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment