Provider is being get for each checkpoint

In checkpoints/views.py, IndexView class, get_data() method, we list
the checkpoints for a provider.
After that, we iterate the checkpoints for that provider and get the
provider using karbor client. This is not necessary: all the checkpoints
are from the same provider, and even if they weren't, we could use karbor
client to get each provider only once.

Change-Id: I790116137a321570c6d386e435f24a5efde2e607
Closes-Bug: #1643331
This commit is contained in:
zhangshuai 2017-01-12 04:57:24 +08:00
parent 5b48b1acea
commit f3eec93b83
1 changed files with 2 additions and 5 deletions

View File

@ -160,13 +160,10 @@ class IndexView(horizon_tables.DataTableView):
sort_dir='asc',
sort_key='name',
reversed_order=reversed_order)
provider = karborclient.provider_get(self.request, provider_id)
for checkpoint in checkpoints:
provider = karborclient.provider_get(
self.request,
checkpoint.protection_plan['provider_id']
)
setattr(checkpoint, "provider_name", provider.name)
setattr(checkpoint, "provider_id", provider.id)
setattr(checkpoint, "provider_id", provider_id)
except Exception:
self._prev = False
self._more = False