Expose instance_get_all_uuids_by_host() from DB API and use it

We've had a long-standing optimization point in the
InstanceList.get_uuids_by_host() method, where we pull the entire
list of instance objects only to strip and return the uuids. We
already had a query method for generating just the uuids in the
DB API, but it was not exposed as it was just a helper for another
method. This exposes it publicly and uses it in that InstanceList
method.

Change-Id: I35c05e78d59ec9b95c2a443979b8d66cd42ea043
This commit is contained in:
Dan Smith 2018-05-17 14:25:21 -07:00
parent e71c6ddf05
commit 16f60f5a5f
2 changed files with 10 additions and 0 deletions

View File

@ -769,6 +769,11 @@ def instance_get_all(context, columns_to_join=None):
return IMPL.instance_get_all(context, columns_to_join=columns_to_join)
def instance_get_all_uuids_by_host(context, host):
"""Get a list of instance uuids on host."""
return IMPL.instance_get_all_uuids_by_host(context, host)
def instance_get_all_by_filters(context, filters, sort_key='created_at',
sort_dir='desc', limit=None, marker=None,
columns_to_join=None):

View File

@ -2607,6 +2607,11 @@ def _instance_get_all_uuids_by_host(context, host):
return uuids
@pick_context_manager_reader
def instance_get_all_uuids_by_host(context, host):
return _instance_get_all_uuids_by_host(context, host)
@pick_context_manager_reader
def instance_get_all_by_host_and_node(context, host, node,
columns_to_join=None):