From cc0f331e5f001adca6d1ad1be0e502ee26f47c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulko?= Date: Thu, 23 Feb 2017 14:35:44 -0500 Subject: [PATCH] Remove reserving quotas in c-vol's retype method Code removed by this commit was there to keep backward compatibility between Liberty and Mitaka. As we're in Pike and we're only constrained to keep compatibility with X-1 release, it's safe to get rid of it. Right now we can assume that quota reservation will always be done in c-api and passed down to c-vol. Change-Id: I67b45662a52a55e88b920c2d0cbe9c20247a8d83 --- cinder/volume/manager.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 10957a9d806..9e937d1bbb4 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -2281,32 +2281,6 @@ class VolumeManager(manager.CleanableManager, volume.update(status_update) volume.save() - # If old_reservations has been passed in from the API, we should - # skip quotas. - # TODO(ntpttr): These reservation checks are left in to be backwards - # compatible with Liberty and can be removed in N. - if not old_reservations: - # Get old reservations - try: - reserve_opts = {'volumes': -1, 'gigabytes': -volume.size} - QUOTAS.add_volume_type_opts(context, - reserve_opts, - volume.volume_type_id) - # NOTE(wanghao): We don't need to reserve volumes and gigabytes - # quota for retyping operation since they didn't changed, just - # reserve volume_type and type gigabytes is fine. - reserve_opts.pop('volumes') - reserve_opts.pop('gigabytes') - old_reservations = QUOTAS.reserve(context, - project_id=project_id, - **reserve_opts) - except Exception: - volume.update(status_update) - volume.save() - msg = _("Failed to update quota usage while retyping volume.") - LOG.exception(msg, resource=volume) - raise exception.CinderException(msg) - # We already got the new reservations new_reservations = reservations