Beispiel #1
0
 def _get_by_service(cls, context, service_id, use_slave=False):
     try:
         db_computes = db.compute_nodes_get_by_service_id(
             context, service_id)
     except exception.ServiceNotFound:
         # NOTE(sbauza): Previous behaviour was returning an empty list
         # if the service was created with no computes, we need to keep it.
         db_computes = []
     return base.obj_make_list(context, cls(context), objects.ComputeNode,
                               db_computes)
Beispiel #2
0
 def get_by_service_id(cls, context, service_id):
     db_computes = db.compute_nodes_get_by_service_id(context, service_id)
     # NOTE(sbauza): Old version was returning an item, we need to keep this
     # behaviour for backwards compatibility
     db_compute = db_computes[0]
     return cls._from_db_object(context, cls(), db_compute)