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
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