summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusmitha <susmitha@platform9.com>2016-09-14 10:13:11 -0700
committerKaustubh Phatak <kphatak@platform9.com>2017-06-09 16:24:48 -0700
commit0ebba1b5100ed707ecc39007315f122f69179ed3 (patch)
treedfac08fef1ca94de304d2da62c26d9e82007b992
parent46c639537237f8d7fea5c17872dd73baa80556a2 (diff)
Changes for reusing nova client in mors
Issue seen on dogfood that mors creates one keystone token for every nova list vms in tenants. Change-Id: If7f584b8539b87e38066937d0bd1ab40824ba3bc
Notes
Notes (review): Code-Review+2: Kaustubh Phatak <kphatak@platform9.com> Workflow+1: Kaustubh Phatak <kphatak@platform9.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 09 Jun 2017 23:25:30 +0000 Reviewed-on: https://review.openstack.org/472863 Project: openstack/mors Branch: refs/heads/master
-rw-r--r--mors/leasehandler/nova_lease_handler.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mors/leasehandler/nova_lease_handler.py b/mors/leasehandler/nova_lease_handler.py
index 04324a8..1786677 100644
--- a/mors/leasehandler/nova_lease_handler.py
+++ b/mors/leasehandler/nova_lease_handler.py
@@ -31,9 +31,7 @@ def get_vm_data(data):
31class NovaLeaseHandler: 31class NovaLeaseHandler:
32 def __init__(self, conf): 32 def __init__(self, conf):
33 self.conf = conf 33 self.conf = conf
34 34 self.nova_client = client.Client(self.conf.get("nova", "version"),
35 def _get_nova_client(self):
36 return client.Client(self.conf.get("nova", "version"),
37 username=self.conf.get("nova", "user_name"), 35 username=self.conf.get("nova", "user_name"),
38 region_name=self.conf.get("nova", "region_name"), 36 region_name=self.conf.get("nova", "region_name"),
39 tenant_id=self.conf.get("nova", "tenant_uuid"), 37 tenant_id=self.conf.get("nova", "tenant_uuid"),
@@ -42,6 +40,9 @@ class NovaLeaseHandler:
42 insecure=True, # Insecure to handle test systems 40 insecure=True, # Insecure to handle test systems
43 connection_pool=False) 41 connection_pool=False)
44 42
43 def _get_nova_client(self):
44 return self.nova_client
45
45 def get_all_vms(self, tenant_uuid): 46 def get_all_vms(self, tenant_uuid):
46 """ 47 """
47 Get all vms for a given tenant 48 Get all vms for a given tenant