diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-13 23:26:58 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-13 23:26:58 -0700 |
| commit | b26531c2b9c90f8d69b24821876979e9b6ff1184 (patch) | |
| tree | 262555ca9cd5a9d0817527c6b997d40c9c35a52d /nova/api | |
| parent | 8b329b5d1d79676f9d2d0d91426c882c0cea784a (diff) | |
| parent | 7403ece82902e633fbd3f2e6f0303ad08c269541 (diff) | |
merged concurrency
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index e96838f99..6d4f58499 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -898,14 +898,20 @@ class CloudController(object): instance_ref = db.instance_get_by_internal_id(context, internal_id) except exception.NotFound: - logging.warning("Instance %s was not found during terminate" - % id_str) + logging.warning("Instance %s was not found during terminate", + id_str) continue + if (instance_ref['state_description'] == 'terminating'): + logging.warning("Instance %s is already being terminated", + id_str) + continue now = datetime.datetime.utcnow() db.instance_update(context, instance_ref['id'], - {'terminated_at': now}) + {'state_description': 'terminating', + 'state': 0, + 'terminated_at': now}) # FIXME(ja): where should network deallocate occur? address = db.instance_get_floating_address(context, instance_ref['id']) @@ -964,7 +970,8 @@ class CloudController(object): if volume_ref['status'] != "available": raise exception.ApiError("Volume status must be available") now = datetime.datetime.utcnow() - db.volume_update(context, volume_ref['id'], {'terminated_at': now}) + db.volume_update(context, volume_ref['id'], {'status': 'deleting', + 'terminated_at': now}) host = volume_ref['host'] rpc.cast(context, db.queue_get_for(context, FLAGS.volume_topic, host), |
