diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-10-14 08:38:37 +0000 |
|---|---|---|
| committer | Tarmac <> | 2010-10-14 08:38:37 +0000 |
| commit | 7120249b21ae56c070cd2e3d32a9502c320ebb07 (patch) | |
| tree | 7372b04b62216a2d73e4c10dbc8eec8799ea4925 /nova/api | |
| parent | 134b846d23be923f7453e945e92f32dffbc54f50 (diff) | |
| parent | 7403ece82902e633fbd3f2e6f0303ad08c269541 (diff) | |
Fixes a few concurrency issues with creating volumes and instances. Most importantly it adds retries to a number of the volume shell commands and it adds a unique constraint on export_devices and a safe create so that there aren't multiple copies of export devices in the database.
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 a7693cadd..56bf2db03 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -893,14 +893,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']) @@ -959,7 +965,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(db.queue_get_for(context, FLAGS.volume_topic, host), {"method": "delete_volume", |
