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
This commit is contained in:
Susmitha 2016-09-14 10:13:11 -07:00 committed by Kaustubh Phatak
parent 46c6395372
commit 0ebba1b510
1 changed files with 4 additions and 3 deletions

View File

@ -31,9 +31,7 @@ def get_vm_data(data):
class NovaLeaseHandler:
def __init__(self, conf):
self.conf = conf
def _get_nova_client(self):
return client.Client(self.conf.get("nova", "version"),
self.nova_client = client.Client(self.conf.get("nova", "version"),
username=self.conf.get("nova", "user_name"),
region_name=self.conf.get("nova", "region_name"),
tenant_id=self.conf.get("nova", "tenant_uuid"),
@ -42,6 +40,9 @@ class NovaLeaseHandler:
insecure=True, # Insecure to handle test systems
connection_pool=False)
def _get_nova_client(self):
return self.nova_client
def get_all_vms(self, tenant_uuid):
"""
Get all vms for a given tenant