From e5386aa745bd310e41607b18ff1386f9e92a3608 Mon Sep 17 00:00:00 2001 From: Tatiana Kholkina Date: Tue, 16 Oct 2018 11:13:49 +0300 Subject: [PATCH] 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 --- watcher/common/nova_helper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/watcher/common/nova_helper.py b/watcher/common/nova_helper.py index 638ca7e0b..ca6408b92 100644 --- a/watcher/common/nova_helper.py +++ b/watcher/common/nova_helper.py @@ -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):