summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-03-13 16:32:38 +0000
committerGerrit Code Review <review@openstack.org>2013-03-13 16:32:38 +0000
commit2326188d0e907c1e5854a0df00b5df15237e0dac (patch)
tree9b7b1df8bce23010c7b96f0402de8bebbe384171
parent4ac711d88803661699b9e05ee08ed79aef38a7d7 (diff)
parent57e13de015307981bc6e34c970ad589d5671088f (diff)
downloadnova-2326188d0e907c1e5854a0df00b5df15237e0dac.tar.gz
nova-2326188d0e907c1e5854a0df00b5df15237e0dac.tar.xz
nova-2326188d0e907c1e5854a0df00b5df15237e0dac.zip
Merge "Lazy load CONF.quota_driver."
-rw-r--r--nova/quota.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/nova/quota.py b/nova/quota.py
index 2bd36b2a6..d8353bbc2 100644
--- a/nova/quota.py
+++ b/nova/quota.py
@@ -789,15 +789,20 @@ class QuotaEngine(object):
def __init__(self, quota_driver_class=None):
"""Initialize a Quota object."""
-
- if not quota_driver_class:
- quota_driver_class = CONF.quota_driver
-
- if isinstance(quota_driver_class, basestring):
- quota_driver_class = importutils.import_object(quota_driver_class)
-
self._resources = {}
- self._driver = quota_driver_class
+ self._driver_cls = quota_driver_class
+ self.__driver = None
+
+ @property
+ def _driver(self):
+ if self.__driver:
+ return self.__driver
+ if not self._driver_cls:
+ self._driver_cls = CONF.quota_driver
+ if isinstance(self._driver_cls, basestring):
+ self._driver_cls = importutils.import_object(self._driver_cls)
+ self.__driver = self._driver_cls
+ return self.__driver
def __contains__(self, resource):
return resource in self._resources