Skip to content

Commit

Permalink
resource: add linstor error messages to exception
Browse files Browse the repository at this point in the history
  • Loading branch information
rp- committed Jun 6, 2019
1 parent d091672 commit 4a9132c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions linstor/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ def restore_from_snapshot(self, snapshot_name, resource_name_to):
with linstor.MultiLinstor(self.client.uri_list, self.client.timeout, self.client.keep_alive) as lin:
rs = lin.resource_dfn_create(resource_name_to)
if not rs[0].is_success():
raise linstor.LinstorError("Could not resource definition '{}' for snapshot restore"
.format(resource_name_to))
raise linstor.LinstorError("Could not resource definition '{r}' for snapshot restore: {err}"
.format(r=resource_name_to, err=rs[0].message))

rs = lin.snapshot_volume_definition_restore(
from_resource=self._linstor_name,
Expand All @@ -568,8 +568,8 @@ def restore_from_snapshot(self, snapshot_name, resource_name_to):

if not rs[0].is_success():
raise linstor.LinstorError(
"Could not restore volume definition '{rd}' from snapshot {sn} to resource definition '{tr}'"
.format(rd=self._linstor_name, sn=snapshot_name, tr=resource_name_to)
"Could not restore volume definition '{rd}' from snapshot {sn} to resource definition '{tr}': {err}"
.format(rd=self._linstor_name, sn=snapshot_name, tr=resource_name_to, err=rs[0].message)
)

rs = lin.snapshot_resource_restore(
Expand All @@ -581,8 +581,8 @@ def restore_from_snapshot(self, snapshot_name, resource_name_to):

if not rs[0].is_success():
raise linstor.LinstorError(
"Could not restore resource '{rd}' from snapshot {sn} to resource definition '{tr}'"
.format(rd=self.name, sn=snapshot_name, tr=resource_name_to)
"Could not restore resource '{rd}' from snapshot {sn} to resource definition '{tr}': {err}"
.format(rd=self.name, sn=snapshot_name, tr=resource_name_to, err=rs[0].message)
)

return Resource(resource_name_to, ",".join(self.client.uri_list))
Expand Down

0 comments on commit 4a9132c

Please sign in to comment.