summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-08-10 23:12:37 +0000
committerGerrit Code Review <review@openstack.org>2012-08-10 23:12:37 +0000
commit13c23fd68e7d82a0b09d91f20c7d57d2e7c16350 (patch)
treefb12ec5226f002146cf7bf9ec9a050574d678c91
parent7e944c0e8dfd31c9adb05c1a1887898669e27ab6 (diff)
parenta811692056fa2919028ebd18d268fc7325a7481f (diff)
Merge "Make sure reservations is initialized"
-rw-r--r--nova/compute/api.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 4c02dcd5a..1e1c82a8f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -887,21 +887,20 @@ class API(base.Base):
def _delete(self, context, instance):
host = instance['host']
+ reservations = None
try:
old, updated = self._update(context,
instance,
task_state=task_states.DELETING,
progress=0)
+ # Avoid double-counting the quota usage reduction
+ # where delete is already in progress
if old['task_state'] != task_states.DELETING:
reservations = QUOTAS.reserve(context,
instances=-1,
cores=-instance['vcpus'],
ram=-instance['memory_mb'])
- else:
- # Avoid double-counting the quota usage reduction
- # where delete is already in progress
- reservations = None
if not instance['host']:
# Just update database, nothing else we can do