summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-09-08 01:53:07 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-09-08 01:53:07 -0700
commit607162ffe86d7d2b5bd9eb6f16a6ee4405892fc6 (patch)
tree3ee9e512c8e20b29f1cfb0f14757e0d68a6f0607 /nova/compute
parent9cb96a14ed6328732ee0dbee08ad9fed5bde43d6 (diff)
make timestamps for instances and volumes, includes additions to get deleted objects from db using deleted flag.
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 878205a36..7f6b49f90 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -21,6 +21,7 @@ Handles all code relating to instances (guest vms)
"""
import base64
+import datetime
import logging
import os
@@ -83,6 +84,8 @@ class ComputeManager(manager.Manager):
try:
yield self.driver.spawn(instance_ref)
+ now = datetime.datetime.now()
+ self.db.instance_update(None, instance_id, {'launched_at': now})
except Exception: # pylint: disable-msg=W0702
logging.exception("instance %s: Failed to spawn",
instance_ref['name'])
@@ -107,6 +110,8 @@ class ComputeManager(manager.Manager):
power_state.NOSTATE,
'shutting_down')
yield self.driver.destroy(instance_ref)
+ now = datetime.datetime.now()
+ self.db.instance_update(None, instance_id, {'terminated_at': now})
# TODO(ja): should we keep it in a terminated state for a bit?
self.db.instance_destroy(context, instance_id)