Skip to content

Commit cc4784f

Browse files
committed
resource: fix reply handling in activate() method
1 parent d73bd16 commit cc4784f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

linstor/resource.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,16 @@ def activate(self, node_name):
478478
diskless=True
479479
)
480480
])
481-
rsc_create_reply = rsc_create_replies[0]
482-
if rsc_create_reply.is_success() or rsc_create_reply.is_error(code=FAIL_EXISTS_RSC):
481+
482+
if Linstor.all_api_responses_no_error(rsc_create_replies):
483483
return True
484+
else:
485+
error_replies = Linstor.filter_api_call_response_errors(rsc_create_replies)
486+
if len(error_replies) == 1 and error_replies[0].is_error(code=FAIL_EXISTS_RSC):
487+
return True
484488

485489
raise linstor.LinstorError('Could not activate resource {} on node {}: {}'
486-
.format(self, node_name, rsc_create_reply))
490+
.format(self, node_name, ";".join([str(x) for x in rsc_create_replies])))
487491

488492
# no decorator, calles delete
489493
def deactivate(self, node_name):

0 commit comments

Comments
 (0)