Skip to content

Commit 4a9132c

Browse files
committed
resource: add linstor error messages to exception
1 parent d091672 commit 4a9132c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

linstor/resource.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ def restore_from_snapshot(self, snapshot_name, resource_name_to):
557557
with linstor.MultiLinstor(self.client.uri_list, self.client.timeout, self.client.keep_alive) as lin:
558558
rs = lin.resource_dfn_create(resource_name_to)
559559
if not rs[0].is_success():
560-
raise linstor.LinstorError("Could not resource definition '{}' for snapshot restore"
561-
.format(resource_name_to))
560+
raise linstor.LinstorError("Could not resource definition '{r}' for snapshot restore: {err}"
561+
.format(r=resource_name_to, err=rs[0].message))
562562

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

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

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

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

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

0 commit comments

Comments
 (0)