Merge "Nix unused raise_if_custom_resource_class_pre_v1_1"

This commit is contained in:
Zuul
2018-08-01 20:18:14 +00:00
committed by Gerrit Code Review
2 changed files with 0 additions and 24 deletions

View File

@@ -11,7 +11,6 @@
# under the License.
from oslo_concurrency import lockutils
import six
import sqlalchemy as sa
# TODO(cdent): This file and its location is problematic for placement
@@ -26,23 +25,6 @@ _RC_TBL = models.ResourceClass.__table__
_LOCKNAME = 'rc_cache'
def raise_if_custom_resource_class_pre_v1_1(rc):
"""Raises ValueError if the supplied resource class identifier is
*not* in the set of standard resource classes as of Inventory/Allocation
object version 1.1
param rc: Integer or string identifier for a resource class
"""
if isinstance(rc, six.string_types):
if rc not in fields.ResourceClass.V1_0:
raise ValueError
else:
try:
fields.ResourceClass.V1_0[rc]
except IndexError:
raise ValueError
@db_api.placement_context_manager.reader
def _refresh_from_db(ctx, cache):
"""Grabs all custom resource classes from the DB table and populates the

View File

@@ -48,12 +48,6 @@ class ResourceClass(fields.StringField):
NUMA_SOCKET, NUMA_CORE, NUMA_THREAD, NUMA_MEMORY_MB,
IPV4_ADDRESS, VGPU, VGPU_DISPLAY_HEAD)
# This is the set of standard resource classes that existed before
# we opened up for custom resource classes in version 1.1 of various
# objects in nova/objects/resource_provider.py
V1_0 = (VCPU, MEMORY_MB, DISK_GB, PCI_DEVICE, SRIOV_NET_VF, NUMA_SOCKET,
NUMA_CORE, NUMA_THREAD, NUMA_MEMORY_MB, IPV4_ADDRESS)
@classmethod
def normalize_name(cls, rc_name):
if rc_name is None: