]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
Changed the name of the standard resource classes
authorEdLeafe <ed@leafe.com>
Wed, 5 Oct 2016 21:34:42 +0000 (21:34 +0000)
committerJay Pipes <jaypipes@gmail.com>
Wed, 12 Oct 2016 21:24:09 +0000 (17:24 -0400)
Originally, the declared names for the resource classes defined in
objects/fields.py were an enum, as the original design assumed that any
future resource classes would be added as a software upgrade release. As
is the convention, this enum was given the name 'ALL'. With the
introduction of custom resource classes that can be added by admins, the
defined classes are no longer an enum, so the name 'ALL' is misleading.
This patch renames it to the more accurate 'STANDARD'.

Change-Id: I251a6faa8c284eb91d190b47108664e67d824425
Blueprint: custom-resource-classes

nova/db/sqlalchemy/resource_class_cache.py
nova/objects/fields.py
nova/tests/unit/objects/test_resource_provider.py

index b10efccc704179661da3fe41e52029fb39543b4c..9188958c8abc3b2aa73303d919315699062942f3 100644 (file)
@@ -83,8 +83,8 @@ class ResourceClassCache(object):
             return self.id_cache[rc_str]
 
         # First check the standard resource classes
-        if rc_str in fields.ResourceClass.ALL:
-            return fields.ResourceClass.ALL.index(rc_str)
+        if rc_str in fields.ResourceClass.STANDARD:
+            return fields.ResourceClass.STANDARD.index(rc_str)
         else:
             # Otherwise, check the database table
             _refresh_from_db(self.ctx, self)
@@ -106,9 +106,9 @@ class ResourceClassCache(object):
         if rc_id in self.str_cache:
             return self.str_cache[rc_id]
 
-        # First check the fields.ResourceClass.ALL enum
+        # First check the fields.ResourceClass.STANDARD values
         try:
-            return fields.ResourceClass.ALL[rc_id]
+            return fields.ResourceClass.STANDARD[rc_id]
         except IndexError:
             # Otherwise, check the database table
             _refresh_from_db(self.ctx, self)
index 1ee157f168da44a919670632ab07ea91270229b8..73d0e4ce97037a1bf6761a8ecda3030889125969 100644 (file)
@@ -271,8 +271,9 @@ class ResourceClass(StringField):
 
     # The ordering here is relevant. If you must add a value, only
     # append.
-    ALL = (VCPU, MEMORY_MB, DISK_GB, PCI_DEVICE, SRIOV_NET_VF, NUMA_SOCKET,
-           NUMA_CORE, NUMA_THREAD, NUMA_MEMORY_MB, IPV4_ADDRESS)
+    STANDARD = (VCPU, MEMORY_MB, DISK_GB, PCI_DEVICE, SRIOV_NET_VF,
+                NUMA_SOCKET, NUMA_CORE, NUMA_THREAD, NUMA_MEMORY_MB,
+                IPV4_ADDRESS)
 
     # This is the set of standard resource classes that existed before
     # we opened up for custom resource classes in version 1.1 of various
index 48cbcbb19bf91d83777c08a3cab296aa141c2f34..bd0ba3ccc46b4ce54cb3034a9fa06a98a64be5d7 100644 (file)
@@ -23,9 +23,9 @@ from nova.tests import uuidsentinel as uuids
 
 _RESOURCE_CLASS_NAME = 'DISK_GB'
 _RESOURCE_CLASS_ID = 2
-IPV4_ADDRESS_ID = objects.fields.ResourceClass.ALL.index(
+IPV4_ADDRESS_ID = objects.fields.ResourceClass.STANDARD.index(
     fields.ResourceClass.IPV4_ADDRESS)
-VCPU_ID = objects.fields.ResourceClass.ALL.index(
+VCPU_ID = objects.fields.ResourceClass.STANDARD.index(
     fields.ResourceClass.VCPU)
 
 _RESOURCE_PROVIDER_ID = 1