summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-09-12 03:58:03 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-09-12 03:58:03 -0700
commit69c21c3757a75d43e212bcebcfb59f2a4e8b91a6 (patch)
treeeea75cc719cce03267bd05a02428d912a1bee4cb /nova/compute
parentc2c113917d3e354f85d473a6d646688b59abad17 (diff)
parentc7921fd14e680288c5626294105761005684b343 (diff)
merged instance time and added better concurrency
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index ae7099812..2a576e49f 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -85,7 +85,9 @@ class ComputeManager(manager.Manager):
try:
yield self.driver.spawn(instance_ref)
now = datetime.datetime.utcnow()
- self.db.instance_update(None, instance_id, {'launched_at': now})
+ self.db.instance_update(context,
+ instance_id,
+ {'launched_at': now})
except Exception: # pylint: disable-msg=W0702
logging.exception("instance %s: Failed to spawn",
instance_ref['name'])
@@ -100,20 +102,14 @@ class ComputeManager(manager.Manager):
def terminate_instance(self, context, instance_id):
"""Terminate an instance on this machine."""
logging.debug("instance %s: terminating", instance_id)
- instance_ref = self.db.instance_get(context, instance_id)
+ instance_ref = self.db.instance_get(context, instance_id)
if instance_ref['state'] == power_state.SHUTOFF:
self.db.instance_destroy(context, instance_id)
raise exception.Error('trying to destroy already destroyed'
' instance: %s' % instance_id)
- self.db.instance_set_state(context,
- instance_id,
- power_state.NOSTATE,
- 'shutting_down')
yield self.driver.destroy(instance_ref)
- now = datetime.datetime.utcnow()
- 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)