Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix the after subscription size checks.
It seems like the calculation was incorrect previously.

Fixes bug: #1190094

Change-Id: Iaec3c2ece6fc80e6bb87fde0a408608825212b49
  • Loading branch information
Joshua Harlow committed Jun 12, 2013
1 parent ef7635d commit 05f409e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions cinder/volume/drivers/nfs.py
Expand Up @@ -350,6 +350,8 @@ def _find_share(self, volume_size_in_gib):
for nfs_share in self._mounted_shares:
total_size, total_available, total_allocated = \
self._get_capacity_info(nfs_share)
apparent_size = max(0, total_size * oversub_ratio)
apparent_available = max(0, apparent_size - total_allocated)
used = (total_size - total_available) / total_size
if used > used_ratio:
# NOTE(morganfainberg): We check the used_ratio first since
Expand All @@ -359,17 +361,9 @@ def _find_share(self, volume_size_in_gib):
# target.
LOG.debug(_('%s is above nfs_used_ratio'), nfs_share)
continue
if oversub_ratio >= 1.0:
# NOTE(morganfainberg): If we are setup for oversubscription
# we need to calculate the apparent available space instead
# of just using the _actual_ available space.
if (total_allocated * oversub_ratio) < requested_volume_size:
LOG.debug(_('%s is above nfs_oversub_ratio'), nfs_share)
continue
elif total_allocated <= requested_volume_size:
if apparent_available <= requested_volume_size:
LOG.debug(_('%s is above nfs_oversub_ratio'), nfs_share)
continue

if total_allocated / total_size >= oversub_ratio:
LOG.debug(_('%s reserved space is above nfs_oversub_ratio'),
nfs_share)
Expand Down

0 comments on commit 05f409e

Please sign in to comment.