LIO: Fix UnboundLocalError in ensure_export
If db.volume_get() fails here, volume_info (and chap_auth) are unbound, and the below usages will fail. volume_get() failing is the only way to land in the NotFound handler, so just remove this debug line. It won't ever have info to print. Move code not related to db lookup out of this try block, and return when NotFound occurs. Closes-Bug: #1387866 Change-Id: I13a88bec1a66d8a0794b08514cc9844d60f6c809
This commit is contained in:
@@ -253,16 +253,17 @@ class LioAdm(_ExportMixin, iscsi.LioAdm):
|
||||
vg_name, conf, old_name=None):
|
||||
try:
|
||||
volume_info = self.db.volume_get(context, volume['id'])
|
||||
(auth_method,
|
||||
auth_user,
|
||||
auth_pass) = volume_info['provider_auth'].split(' ', 3)
|
||||
chap_auth = self._iscsi_authentication(auth_method,
|
||||
auth_user,
|
||||
auth_pass)
|
||||
except exception.NotFound:
|
||||
LOG.debug("volume_info:%s", volume_info)
|
||||
LOG.info(_("Skipping ensure_export. No iscsi_target "
|
||||
"provision for volume: %s"), volume['id'])
|
||||
return
|
||||
|
||||
(auth_method,
|
||||
auth_user,
|
||||
auth_pass) = volume_info['provider_auth'].split(' ', 3)
|
||||
chap_auth = self._iscsi_authentication(auth_method,
|
||||
auth_user,
|
||||
auth_pass)
|
||||
|
||||
iscsi_target = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user