Fix restore index page

Query restore related checkpoint may fail, because the checkpoint may
be deleted.

Change-Id: I6179c4179cca2ddbd85b1b12c5ff2ff9433006e6
This commit is contained in:
zhangshuai 2017-03-02 08:28:04 +08:00
parent f98b2ad496
commit 4037c0954a
1 changed files with 9 additions and 5 deletions

View File

@ -55,13 +55,17 @@ class IndexView(horizon_tables.DataTableView):
reversed_order=reversed_order)
for restore in restores:
checkpoint = karborclient.checkpoint_get(
self.request,
restore.provider_id,
restore.checkpoint_id)
try:
checkpoint = karborclient.checkpoint_get(
self.request,
restore.provider_id,
restore.checkpoint_id)
plan_name = checkpoint.protection_plan["name"]
except Exception:
plan_name = "Not Found"
provider = karborclient.provider_get(self.request,
restore.provider_id)
setattr(restore, "name", checkpoint.protection_plan["name"])
setattr(restore, "name", plan_name)
setattr(restore, "provider_name", provider.name)
except Exception: