From a00daf9f26a214d9abcf62d1ee3abf74586590c7 Mon Sep 17 00:00:00 2001 From: Dantali0n Date: Fri, 24 May 2019 15:54:34 +0200 Subject: [PATCH] Group instance methods together in nova_helper Some of the methods for retrieving data about instances was placed at the bottom of nova_helper instead of being close to the other instance based methods. Change-Id: I68475883529610e514aa82f1881105ab0cf24ec3 --- watcher/common/nova_helper.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/watcher/common/nova_helper.py b/watcher/common/nova_helper.py index 2f30fd441..5600b7192 100644 --- a/watcher/common/nova_helper.py +++ b/watcher/common/nova_helper.py @@ -90,6 +90,22 @@ class NovaHelper(object): return self.nova.servers.list(search_opts=search_opts, limit=-1) + def get_instance_by_uuid(self, instance_uuid): + return [instance for instance in + self.nova.servers.list(search_opts={"all_tenants": True, + "uuid": instance_uuid})] + + def get_instance_by_name(self, instance_name): + return [instance for instance in + self.nova.servers.list(search_opts={"all_tenants": True, + "name": instance_name})] + + def get_instances_by_node(self, host): + return [instance for instance in + self.nova.servers.list(search_opts={"all_tenants": True, + "host": host}, + limit=-1)] + def get_flavor_list(self): return self.nova.flavors.list(**{'is_public': None}) @@ -667,22 +683,6 @@ class NovaHelper(object): return network_id - def get_instance_by_uuid(self, instance_uuid): - return [instance for instance in - self.nova.servers.list(search_opts={"all_tenants": True, - "uuid": instance_uuid})] - - def get_instance_by_name(self, instance_name): - return [instance for instance in - self.nova.servers.list(search_opts={"all_tenants": True, - "name": instance_name})] - - def get_instances_by_node(self, host): - return [instance for instance in - self.nova.servers.list(search_opts={"all_tenants": True, - "host": host}, - limit=-1)] - def get_hostname(self, instance): return str(getattr(instance, 'OS-EXT-SRV-ATTR:host'))