From: Jenkins Date: Thu, 1 Oct 2015 13:39:37 +0000 (+0000) Subject: Merge "Obtain target authentication from database same as LIO target" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7f498b0d4a07770d4f90fe2d185a8446ee0d5ace;p=openstack-build%2Fcinder-build.git Merge "Obtain target authentication from database same as LIO target" --- 7f498b0d4a07770d4f90fe2d185a8446ee0d5ace diff --cc cinder/volume/targets/tgt.py index 912c1eec3,d1e816999..ad93713b0 --- a/cinder/volume/targets/tgt.py +++ b/cinder/volume/targets/tgt.py @@@ -115,40 -114,12 +114,12 @@@ class TgtAdm(iscsi.ISCSITarget) iscsi_target = 0 # NOTE(jdg): Not used by tgtadm return iscsi_target, lun - def _get_target_chap_auth(self, context, iscsi_name): - """Get the current chap auth username and password.""" - volumes_dir = self.volumes_dir - vol_id = iscsi_name.split(':')[1] - volume_path = os.path.join(volumes_dir, vol_id) - - try: - with open(volume_path, 'r') as f: - volume_conf = f.read() - except IOError as e_fnf: - LOG.debug('Failed to open config for Volume %(vol_id)s: %(e)s', - {'vol_id': vol_id, 'e': e_fnf}) - # tgt is linux specific - if e_fnf.errno == 2: - return None - else: - raise - except Exception as e_vol: - LOG.error(_LE('Failed to open config for %(vol_id)s: %(e)s'), - {'vol_id': vol_id, 'e': e_vol}) - raise - - m = re.search('incominguser (\w+) (\w+)', volume_conf) - if m: - return (m.group(1), m.group(2)) - LOG.debug('Failed to find CHAP auth from config for %s', vol_id) - return None - @utils.retry(putils.ProcessExecutionError) def _do_tgt_update(self, name): - (out, err) = utils.execute('tgt-admin', '--update', name, - run_as_root=True) - LOG.debug("StdOut from tgt-admin --update: %s", out) - LOG.debug("StdErr from tgt-admin --update: %s", err) + (out, err) = utils.execute('tgt-admin', '--update', name, + run_as_root=True) + LOG.debug("StdOut from tgt-admin --update: %s", out) + LOG.debug("StdErr from tgt-admin --update: %s", err) def create_iscsi_target(self, name, tid, lun, path, chap_auth=None, **kwargs):