Browse Source

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
Susmitha 2 years ago
parent
commit
0ebba1b510
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      mors/leasehandler/nova_lease_handler.py

+ 4
- 3
mors/leasehandler/nova_lease_handler.py View File

@@ -31,9 +31,7 @@ def get_vm_data(data):
31 31
 class NovaLeaseHandler:
32 32
     def __init__(self, conf):
33 33
         self.conf = conf
34
-
35
-    def _get_nova_client(self):
36
-        return client.Client(self.conf.get("nova", "version"),
34
+        self.nova_client = client.Client(self.conf.get("nova", "version"),
37 35
                              username=self.conf.get("nova", "user_name"),
38 36
                              region_name=self.conf.get("nova", "region_name"),
39 37
                              tenant_id=self.conf.get("nova", "tenant_uuid"),
@@ -42,6 +40,9 @@ class NovaLeaseHandler:
42 40
                              insecure=True, # Insecure to handle test systems
43 41
                              connection_pool=False)
44 42
 
43
+    def _get_nova_client(self):
44
+        return self.nova_client
45
+
45 46
     def get_all_vms(self, tenant_uuid):
46 47
         """
47 48
         Get all vms for a given tenant

Loading…
Cancel
Save