Use limit -1 for nova servers list

By default nova has a limit for returned items in a single response [1].
We should pass limit=-1 to get all items.

[1] https://docs.openstack.org/nova/rocky/configuration/config.html

Change-Id: I1fabd909c4c0356ef5fcb7c51718fb4513e6befa
This commit is contained in:
Tatiana Kholkina 2018-10-16 11:13:49 +03:00 committed by Alexander Chadin
parent d99e8f33da
commit f517cc662a
1 changed files with 4 additions and 2 deletions

View File

@ -74,7 +74,8 @@ class NovaHelper(object):
raise exception.ComputeNodeNotFound(name=node_hostname)
def get_instance_list(self):
return self.nova.servers.list(search_opts={'all_tenants': True})
return self.nova.servers.list(search_opts={'all_tenants': True},
limit=-1)
def get_flavor_list(self):
return self.nova.flavors.list(**{'is_public': None})
@ -704,7 +705,8 @@ class NovaHelper(object):
def get_instances_by_node(self, host):
return [instance for instance in
self.nova.servers.list(search_opts={"all_tenants": True})
self.nova.servers.list(search_opts={"all_tenants": True},
limit=-1)
if self.get_hostname(instance) == host]
def get_hostname(self, instance):