From 2ec51c3912691c9918ccf45ec42930ea00536b70 Mon Sep 17 00:00:00 2001 From: whoami-rajat Date: Tue, 9 Oct 2018 16:13:03 +0530 Subject: [PATCH] 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 --- cinder/volume/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 8a01bd20097..00beee9b3a7 100644 --- a/cinder/volume/manager.py +++ b/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})