diff options
author | Mark McLoughlin <markmc@redhat.com> | 2012-11-04 21:32:45 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2012-11-04 21:46:35 +0000 |
commit | 637e805634b5179ffacad57ee26d4175449537f5 (patch) | |
tree | c0ff2f32d3f2957ae7b96a2eedc35b0029917048 /nova/quota.py | |
parent | 8ce58defbe560b1da34d991b38ac64a9b4c8d654 (diff) | |
download | nova-637e805634b5179ffacad57ee26d4175449537f5.tar.gz nova-637e805634b5179ffacad57ee26d4175449537f5.tar.xz nova-637e805634b5179ffacad57ee26d4175449537f5.zip |
Switch from FLAGS to CONF in misc modules
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.
We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.
Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
Diffstat (limited to 'nova/quota.py')
-rw-r--r-- | nova/quota.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/nova/quota.py b/nova/quota.py index fa0b813de..e4c6f1d49 100644 --- a/nova/quota.py +++ b/nova/quota.py @@ -20,6 +20,7 @@ import datetime +from nova import config from nova import db from nova import exception from nova import flags @@ -85,8 +86,8 @@ quota_opts = [ help='default driver to use for quota checks'), ] -FLAGS = flags.FLAGS -FLAGS.register_opts(quota_opts) +CONF = config.CONF +CONF.register_opts(quota_opts) class DbQuotaDriver(object): @@ -314,7 +315,7 @@ class DbQuotaDriver(object): # Set up the reservation expiration if expire is None: - expire = FLAGS.reservation_expire + expire = CONF.reservation_expire if isinstance(expire, (int, long)): expire = datetime.timedelta(seconds=expire) if isinstance(expire, datetime.timedelta): @@ -335,7 +336,7 @@ class DbQuotaDriver(object): # session isn't available outside the DBAPI, we # have to do the work there. return db.quota_reserve(context, resources, quotas, deltas, expire, - FLAGS.until_refresh, FLAGS.max_age) + CONF.until_refresh, CONF.max_age) def commit(self, context, reservations): """Commit reservations. @@ -476,7 +477,7 @@ class BaseResource(object): def default(self): """Return the default value of the quota.""" - return FLAGS[self.flag] if self.flag else -1 + return CONF[self.flag] if self.flag else -1 class ReservableResource(BaseResource): @@ -568,7 +569,7 @@ class QuotaEngine(object): """Initialize a Quota object.""" if not quota_driver_class: - quota_driver_class = FLAGS.quota_driver + quota_driver_class = CONF.quota_driver if isinstance(quota_driver_class, basestring): quota_driver_class = importutils.import_object(quota_driver_class) |