Merge "Use IronicObject._from_db_object_list method"

This commit is contained in:
Jenkins 2016-12-07 22:54:36 +00:00 committed by Gerrit Code Review
commit 51c732fd0e
5 changed files with 9 additions and 29 deletions

View File

@ -111,8 +111,7 @@ class Chassis(base.IronicObject, object_base.VersionedObjectDictCompat):
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return [Chassis._from_db_object(cls(context), obj)
for obj in db_chassis]
return cls._from_db_object_list(context, db_chassis)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.

View File

@ -251,7 +251,7 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
db_nodes = cls.dbapi.get_node_list(filters=filters, limit=limit,
marker=marker, sort_key=sort_key,
sort_dir=sort_dir)
return [Node._from_db_object(cls(context), obj) for obj in db_nodes]
return cls._from_db_object_list(context, db_nodes)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.

View File

@ -52,11 +52,6 @@ class Port(base.IronicObject, object_base.VersionedObjectDictCompat):
'internal_info': object_fields.FlexibleDictField(nullable=True),
}
@staticmethod
def _from_db_object_list(db_objects, cls, context):
"""Converts a list of database entities to a list of formal objects."""
return [Port._from_db_object(cls(context), obj) for obj in db_objects]
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
# Implications of calling new remote procedures should be thought through.
@ -157,7 +152,7 @@ class Port(base.IronicObject, object_base.VersionedObjectDictCompat):
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Port._from_db_object_list(db_ports, cls, context)
return cls._from_db_object_list(context, db_ports)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
@ -181,7 +176,7 @@ class Port(base.IronicObject, object_base.VersionedObjectDictCompat):
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Port._from_db_object_list(db_ports, cls, context)
return cls._from_db_object_list(context, db_ports)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
@ -206,7 +201,7 @@ class Port(base.IronicObject, object_base.VersionedObjectDictCompat):
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Port._from_db_object_list(db_ports, cls, context)
return cls._from_db_object_list(context, db_ports)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.

View File

@ -45,12 +45,6 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat):
'standalone_ports_supported': object_fields.BooleanField(),
}
@staticmethod
def _from_db_object_list(db_objects, cls, context):
"""Converts a list of database entities to a list of formal objects."""
return [Portgroup._from_db_object(cls(context), obj) for obj in
db_objects]
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
# Implications of calling new remote procedures should be thought through.
@ -170,7 +164,7 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat):
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Portgroup._from_db_object_list(db_portgroups, cls, context)
return cls._from_db_object_list(context, db_portgroups)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
@ -196,7 +190,7 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat):
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Portgroup._from_db_object_list(db_portgroups, cls, context)
return cls._from_db_object_list(context, db_portgroups)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.

View File

@ -39,12 +39,6 @@ class VolumeConnector(base.IronicObject,
'extra': object_fields.FlexibleDictField(nullable=True),
}
@staticmethod
def _from_db_object_list(db_objects, cls, context):
"""Convert a list of database entities to a list of formal objects."""
return [VolumeConnector._from_db_object(cls(context), obj)
for obj in db_objects]
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
# Implications of calling new remote procedures should be thought through.
@ -126,8 +120,7 @@ class VolumeConnector(base.IronicObject,
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return VolumeConnector._from_db_object_list(db_connectors,
cls, context)
return cls._from_db_object_list(context, db_connectors)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.
@ -153,8 +146,7 @@ class VolumeConnector(base.IronicObject,
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return VolumeConnector._from_db_object_list(db_connectors,
cls, context)
return cls._from_db_object_list(context, db_connectors)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
# methods can be used in the future to replace current explicit RPC calls.