stack@zuul:~/cinder_for_submit/cinder/cinder/volume$ sed -n ‘2544,2569p‘ driver.py def _do_iscsi_discovery(self, volume): # TODO(justinsb): Deprecate discovery and use stored info # NOTE(justinsb): Discovery won‘t work with CHAP-secured targets (?) LOG.warning("ISCSI provider_location not stored, using discovery") volume_name = volume[‘name‘] try: # NOTE(griff) We‘re doing the split straight away which should be # safe since using ‘@‘ in hostname is considered invalid (out, _err) = self._execute(‘iscsiadm‘, ‘-m‘, ‘discovery‘, ‘-t‘, ‘sendtargets‘, ‘-p‘, volume[‘host‘].split(‘@‘)[0], run_as_root=True) except processutils.ProcessExecutionError as ex: LOG.error("ISCSI discovery attempt failed for:%s", volume[‘host‘].split(‘@‘)[0]) LOG.debug("Error from iscsiadm -m discovery: %s", ex.stderr) return None for target in out.splitlines(): if (self.configuration.target_ip_address in target and volume_name in target): return target return None
原文:https://www.cnblogs.com/longchang/p/11775652.html