Fix: UnboundLocalError variable referenced before assignment

The variable used inside the try block is also used in the except
block for logging volume id which errors out to
UnboundLocalError: local variable 'add_vol_ref' referenced before
assignment.
This patch addresses the issue by using the volume id from the
for loop.

Change-Id: Ia43a6f2df7fd4066a0ed26450b26a1456d4cecfa
Related-Bug: #1645207
This commit is contained in:
whoami-rajat 2018-10-09 16:13:03 +05:30
parent fccd84cb2e
commit 2ec51c3912
1 changed files with 1 additions and 1 deletions

View File

@ -3541,7 +3541,7 @@ class VolumeManager(manager.CleanableManager,
LOG.error("Update group "
"failed to %(op)s volume-%(volume_id)s: "
"VolumeNotFound.",
{'volume_id': add_vol_ref.id,
{'volume_id': add_vol,
'op': 'add' if add else 'remove'},
resource={'type': 'group',
'id': group.id})