Merge "Reduce the number of RPC calls to traits API"
This commit is contained in:
@@ -1651,8 +1651,11 @@ def node_convert_with_links(rpc_node, fields=None, sanitize=True):
|
|||||||
fields=_get_fields_for_node_query(fields))
|
fields=_get_fields_for_node_query(fields))
|
||||||
|
|
||||||
if node.get('traits') is not None:
|
if node.get('traits') is not None:
|
||||||
traits = objects.TraitList.get_by_node_id(api.request.context,
|
if isinstance(node['traits'], objects.TraitList):
|
||||||
rpc_node.id)
|
traits = node['traits']
|
||||||
|
else:
|
||||||
|
traits = objects.TraitList.get_by_node_id(api.request.context,
|
||||||
|
rpc_node.id)
|
||||||
node['traits'] = traits.get_trait_names()
|
node['traits'] = traits.get_trait_names()
|
||||||
|
|
||||||
if (api_utils.allow_expose_conductors()
|
if (api_utils.allow_expose_conductors()
|
||||||
|
@@ -911,7 +911,7 @@ RELEASE_MAPPING = {
|
|||||||
'Port': ['1.15', '1.14', '1.13', '1.12'],
|
'Port': ['1.15', '1.14', '1.13', '1.12'],
|
||||||
'Portgroup': ['1.6', '1.5'],
|
'Portgroup': ['1.6', '1.5'],
|
||||||
'Trait': ['1.1', '1.0'],
|
'Trait': ['1.1', '1.0'],
|
||||||
'TraitList': ['1.1', '1.0'],
|
'TraitList': ['1.2', '1.1', '1.0'],
|
||||||
'VolumeConnector': ['1.1', '1.0'],
|
'VolumeConnector': ['1.1', '1.0'],
|
||||||
'VolumeTarget': ['1.1', '1.0'],
|
'VolumeTarget': ['1.1', '1.0'],
|
||||||
'FirmwareComponent': ['1.1', '1.0'],
|
'FirmwareComponent': ['1.1', '1.0'],
|
||||||
|
@@ -88,7 +88,8 @@ class Trait(base.IronicObject):
|
|||||||
class TraitList(base.IronicObjectListBase, base.IronicObject):
|
class TraitList(base.IronicObjectListBase, base.IronicObject):
|
||||||
# Version 1.0: Initial version
|
# Version 1.0: Initial version
|
||||||
# Version 1.1: Relevant methods changed to be remotable methods.
|
# Version 1.1: Relevant methods changed to be remotable methods.
|
||||||
VERSION = '1.1'
|
# Version 1.2: Revert get_trait_names to a normal method.
|
||||||
|
VERSION = '1.2'
|
||||||
|
|
||||||
dbapi = db_api.get_instance()
|
dbapi = db_api.get_instance()
|
||||||
|
|
||||||
@@ -147,7 +148,6 @@ class TraitList(base.IronicObjectListBase, base.IronicObject):
|
|||||||
"""
|
"""
|
||||||
cls.dbapi.unset_node_traits(node_id)
|
cls.dbapi.unset_node_traits(node_id)
|
||||||
|
|
||||||
@object_base.remotable
|
def get_trait_names(self):
|
||||||
def get_trait_names(self, context=None):
|
|
||||||
"""Return a list of names of the traits in this list."""
|
"""Return a list of names of the traits in this list."""
|
||||||
return [t.trait for t in self.objects]
|
return [t.trait for t in self.objects]
|
||||||
|
@@ -709,7 +709,7 @@ expected_object_fingerprints = {
|
|||||||
'VolumeTargetCRUDNotification': '1.0-59acc533c11d306f149846f922739c15',
|
'VolumeTargetCRUDNotification': '1.0-59acc533c11d306f149846f922739c15',
|
||||||
'VolumeTargetCRUDPayload': '1.0-30dcc4735512c104a3a36a2ae1e2aeb2',
|
'VolumeTargetCRUDPayload': '1.0-30dcc4735512c104a3a36a2ae1e2aeb2',
|
||||||
'Trait': '1.1-ae534208fc5ade27700db7202b5b6b82',
|
'Trait': '1.1-ae534208fc5ade27700db7202b5b6b82',
|
||||||
'TraitList': '1.1-1e938b9a94cba59f5ac35a5db0a6dc0f',
|
'TraitList': '1.2-120fedaa212ddbcf9f6148a64c550946',
|
||||||
'BIOSSetting': '1.2-a0c2924d8ffef7ed872e48435a569a83',
|
'BIOSSetting': '1.2-a0c2924d8ffef7ed872e48435a569a83',
|
||||||
'BIOSSettingList': '1.1-6e606655643a9a5fa116ce771cbebe59',
|
'BIOSSettingList': '1.1-6e606655643a9a5fa116ce771cbebe59',
|
||||||
'Allocation': '1.3-91102bce67725a4ee924c6b2f213bcde',
|
'Allocation': '1.3-91102bce67725a4ee924c6b2f213bcde',
|
||||||
|
Reference in New Issue
Block a user