Retyping volume got error under max vol limit

After reaching the max volume limit and
retyping one of volumes, cinder will raise
error: "VolumeLimitExceeded".

This error shouldn't be occurring since the
volume type limit is -1 and retyping doesn't
change the volume quota, it changes the volume
type quota.

Change-Id: I5f25c47158ac24bef94078457a84248daa67e80f
Closes-Bug: #1504719
This commit is contained in:
wanghao
2015-10-10 11:18:02 +08:00
parent ac7ae7eed6
commit c68bc2eb2b
5 changed files with 68 additions and 4 deletions

View File

@@ -24,13 +24,19 @@ LOG = logging.getLogger(__name__)
QUOTAS = quota.QUOTAS
def get_volume_type_reservation(ctxt, volume, type_id):
def get_volume_type_reservation(ctxt, volume, type_id,
reserve_vol_type_only=False):
# Reserve quotas for the given volume type
try:
reserve_opts = {'volumes': 1, 'gigabytes': volume['size']}
QUOTAS.add_volume_type_opts(ctxt,
reserve_opts,
type_id)
# If reserve_vol_type_only is True, just reserve volume_type quota,
# not volume quota.
if reserve_vol_type_only:
reserve_opts.pop('volumes')
reserve_opts.pop('gigabytes')
# Note that usually the project_id on the volume will be the same as
# the project_id in the context. But, if they are different then the
# reservations must be recorded against the project_id that owns the