From 4ecfcc3b17494845e3845d89246112743483f8cf Mon Sep 17 00:00:00 2001
From: Morgan Fainberg <m@metacloud.com>
Date: Fri, 7 Jun 2013 17:18:59 -0700
Subject: [PATCH] Minor Logic bug in NFS Driver.

When checking oversubscription rate, we need to ensure that we
check the _allocated_ (apparant size) not the _available_ (actual
usage) on the NFS share.  This fix ensures we are now checking the
correct values.  This bug allowed (effectively) a one-time
volume allocation that would push the "apparant" size over the
oversubscription rate.

Change-Id: I189b689cb76ac2a243aa6e255ce0c80d86e247ce
Fixes: bug #1188877
---
 cinder/volume/drivers/nfs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py
index c486b8abd..b83e3727e 100644
--- a/cinder/volume/drivers/nfs.py
+++ b/cinder/volume/drivers/nfs.py
@@ -346,10 +346,10 @@ class NfsDriver(RemoteFsDriver):
                 # 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_available * oversub_ratio) < requested_volume_size:
+                if (total_allocated * oversub_ratio) < requested_volume_size:
                     LOG.debug(_('%s is above nfs_oversub_ratio'), nfs_share)
                     continue
-            elif total_available <= requested_volume_size:
+            elif total_allocated <= requested_volume_size:
                 LOG.debug(_('%s is above nfs_oversub_ratio'), nfs_share)
                 continue
 
-- 
2.45.2