Browse Source

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
changes/14/608914/1
whoami-rajat 3 years ago
parent
commit
2ec51c3912
  1. 2
      cinder/volume/manager.py

2
cinder/volume/manager.py

@ -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})

Loading…
Cancel
Save