首页 > 其他 > 详细

sed 输出文件中指定的行

时间:2019-11-01 11:24:04      阅读:102      评论:0      收藏:0      [点我收藏+]
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 wont work with CHAP-secured targets (?)
        LOG.warning("ISCSI provider_location not stored, using discovery")

        volume_name = volume[name]

        try:
            # NOTE(griff) Were 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

 

sed 输出文件中指定的行

原文:https://www.cnblogs.com/longchang/p/11775652.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!