Merge "Add objects.ServiceList.get_all_computes_by_hv_type"
This commit is contained in:
commit
2ce1d4b5ad
2 files changed
+24
No files matched your search
@@ -146,6 +146,16 @@ def service_get_all_by_binary(context, binary, include_disabled=False):
|
||||
include_disabled=include_disabled)
|
||||
|
||||
|
||||
def service_get_all_computes_by_hv_type(context, hv_type,
|
||||
include_disabled=False):
|
||||
"""Get all compute services for a given hypervisor type.
|
||||
|
||||
Includes disabled services if 'include_disabled' parameter is True.
|
||||
"""
|
||||
return IMPL.service_get_all_computes_by_hv_type(context, hv_type,
|
||||
include_disabled=include_disabled)
|
||||
|
||||
|
||||
def service_get_all_by_host(context, host):
|
||||
"""Get all services for a given host."""
|
||||
return IMPL.service_get_all_by_host(context, host)
|
||||
|
||||
@@ -494,6 +494,20 @@ def service_get_all_by_binary(context, binary, include_disabled=False):
|
||||
return query.all()
|
||||
|
||||
|
||||
@pick_context_manager_reader
|
||||
def service_get_all_computes_by_hv_type(context, hv_type,
|
||||
include_disabled=False):
|
||||
query = model_query(context, models.Service, read_deleted="no").\
|
||||
filter_by(binary='nova-compute')
|
||||
if not include_disabled:
|
||||
query = query.filter_by(disabled=False)
|
||||
query = query.join(models.ComputeNode,
|
||||
models.Service.host == models.ComputeNode.host).\
|
||||
filter(models.ComputeNode.hypervisor_type == hv_type).\
|
||||
distinct('host')
|
||||
return query.all()
|
||||
|
||||
|
||||
@pick_context_manager_reader
|
||||
def service_get_by_host_and_binary(context, host, binary):
|
||||
result = model_query(context, models.Service, read_deleted="no").\
|
||||
|
||||
Reference in new issue
Block a user