Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/nova/objects/resource_class_cache.py b/nova/objects/resource_class_cache.py
- index 244b743..dcbd50c 100644
- --- a/nova/objects/resource_class_cache.py
- +++ b/nova/objects/resource_class_cache.py
- @@ -12,6 +12,7 @@
- import sqlalchemy as sa
- +from nova.db.sqlalchemy import api as db_api
- from nova.db.sqlalchemy import api_models as models
- from nova.objects import fields
- @@ -31,7 +32,9 @@ class ResourceClassCache(object):
- self.id_cache = {}
- self.str_cache = {}
- - def id_from_string(self, rc_str):
- + @db_api.api_context_manager.reader
- + @staticmethod
- + def _id_from_string(ctx, rc_str):
- """Given a string representation of a resource class -- e.g. "DISK_GB"
- or "IRON_SILVER" -- return the integer code for the resource class. For
- standard resource classes, this integer code will match the list of
- @@ -65,6 +68,9 @@ class ResourceClassCache(object):
- self.id_cache[rc_str] = rc_id
- return rc_id
- + def id_from_string(self, rc_str):
- + return self._id_from_string(self.ctx, rc_str)
- +
- def string_from_id(self, rc_id):
- """The reverse of the id_from_string() method. Given a supplied numeric
- identifier for a resource class, we look up the corresponding string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement