commit 68b991bc39d9e1d19e31efa5621ddb7e2ae9c227
Author: Giorgos Korfiatis <gkorf@grnet.gr>
Date:   Mon Apr 29 12:12:21 2013 +0300

    quotaholder: Rename counters to usage_min, usage_max

diff --git a/snf-astakos-app/astakos/im/quotas.py b/snf-astakos-app/astakos/im/quotas.py
index 909fe85..29b0a32 100644
--- a/snf-astakos-app/astakos/im/quotas.py
+++ b/snf-astakos-app/astakos/im/quotas.py
@@ -39,16 +39,16 @@ from django.db.models import Q
 
 
 def from_holding(holding):
-    limit, imported_min, imported_max = holding
+    limit, usage_min, usage_max = holding
     body = {'limit':       limit,
-            'usage':       imported_max,
-            'pending':     imported_max-imported_min,
+            'usage':       usage_max,
+            'pending':     usage_max-usage_min,
             }
     return body
 
 
 def limits_only(holding):
-    limit, imported_min, imported_max = holding
+    limit, usage_min, usage_max = holding
     return limit
 
 
diff --git a/snf-astakos-app/astakos/quotaholder/callpoint.py b/snf-astakos-app/astakos/quotaholder/callpoint.py
index 8f75d35..5d2af40 100644
--- a/snf-astakos-app/astakos/quotaholder/callpoint.py
+++ b/snf-astakos-app/astakos/quotaholder/callpoint.py
@@ -62,7 +62,7 @@ def get_quota(holders=None, sources=None, resources=None):
     quotas = {}
     for holding in holdings:
         key = (holding.holder, holding.source, holding.resource)
-        value = (holding.limit, holding.imported_min, holding.imported_max)
+        value = (holding.limit, holding.usage_min, holding.usage_max)
         quotas[key] = value
 
     return quotas
@@ -186,8 +186,8 @@ def _log_provision(commission, provision, holding, log_time, reason):
         'source':              holding.source,
         'resource':            holding.resource,
         'limit':               holding.limit,
-        'imported_min':        holding.imported_min,
-        'imported_max':        holding.imported_max,
+        'usage_min':           holding.usage_min,
+        'usage_max':           holding.usage_max,
         'delta_quantity':      provision.quantity,
         'issue_time':          commission.issue_time,
         'log_time':            log_time,
diff --git a/snf-astakos-app/astakos/quotaholder/commission.py b/snf-astakos-app/astakos/quotaholder/commission.py
index 4849bf9..f1932c8 100644
--- a/snf-astakos-app/astakos/quotaholder/commission.py
+++ b/snf-astakos-app/astakos/quotaholder/commission.py
@@ -38,7 +38,7 @@ class Operation(object):
 
     @staticmethod
     def assertions(holding):
-        assert(holding.imported_min <= holding.imported_max)
+        assert(holding.usage_min <= holding.usage_max)
 
     @classmethod
     def _prepare(cls, holding, quantity, check=True):
@@ -80,11 +80,11 @@ class Import(Operation):
 
     @classmethod
     def _prepare(cls, holding, quantity, check=True):
-        imported_max = holding.imported_max
-        new_imported_max = imported_max + quantity
+        usage_max = holding.usage_max
+        new_usage_max = usage_max + quantity
 
         limit = holding.limit
-        if check and new_imported_max > limit:
+        if check and new_usage_max > limit:
             holder = holding.holder
             resource = holding.resource
             m = ("%s has not enough capacity of %s." % (holder, resource))
@@ -92,14 +92,14 @@ class Import(Operation):
             raise NoCapacityError(m,
                                   provision=provision,
                                   limit=limit,
-                                  usage=imported_max)
+                                  usage=usage_max)
 
-        holding.imported_max = new_imported_max
+        holding.usage_max = new_usage_max
         holding.save()
 
     @classmethod
     def _finalize(cls, holding, quantity):
-        holding.imported_min += quantity
+        holding.usage_min += quantity
         holding.save()
 
 
@@ -107,10 +107,10 @@ class Release(Operation):
 
     @classmethod
     def _prepare(cls, holding, quantity, check=True):
-        imported_min = holding.imported_min
-        new_imported_min = imported_min - quantity
+        usage_min = holding.usage_min
+        new_usage_min = usage_min - quantity
 
-        if check and new_imported_min < 0:
+        if check and new_usage_min < 0:
             holder = holding.holder
             resource = holding.resource
             m = ("%s attempts to release more %s than it contains." %
@@ -118,14 +118,14 @@ class Release(Operation):
             provision = cls.provision(holding, quantity, importing=False)
             raise NoQuantityError(m,
                                   provision=provision,
-                                  available=imported_min)
+                                  available=usage_min)
 
-        holding.imported_min = new_imported_min
+        holding.usage_min = new_usage_min
         holding.save()
 
     @classmethod
     def _finalize(cls, holding, quantity):
-        holding.imported_max -= quantity
+        holding.usage_max -= quantity
         holding.save()
 
 
diff --git a/snf-astakos-app/astakos/quotaholder/models.py b/snf-astakos-app/astakos/quotaholder/models.py
index 15dffee..bd4f026 100644
--- a/snf-astakos-app/astakos/quotaholder/models.py
+++ b/snf-astakos-app/astakos/quotaholder/models.py
@@ -47,8 +47,8 @@ class Holding(Model):
     resource = CharField(max_length=4096, null=False)
 
     limit = intDecimalField()
-    imported_min = intDecimalField(default=0)
-    imported_max = intDecimalField(default=0)
+    usage_min = intDecimalField(default=0)
+    usage_max = intDecimalField(default=0)
 
     objects = ForUpdateManager()
 
@@ -104,8 +104,8 @@ class ProvisionLog(Model):
     source = CharField(max_length=4096, null=True)
     resource = CharField(max_length=4096)
     limit = intDecimalField()
-    imported_min = intDecimalField()
-    imported_max = intDecimalField()
+    usage_min = intDecimalField()
+    usage_max = intDecimalField()
     delta_quantity = intDecimalField()
     reason = CharField(max_length=4096)
 
