pstorage.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def get_monitors(self):
        """
        Parse ceph config and return ceph monitors list
        :return: list -> list of ip addresses
        """
        if self._monitors is not None:
            return self._monitors
        try:
            from ..settings import MONITORS
            self._monitors = [i.strip() for i in MONITORS.split(',')]
        except ImportError:
            # We have no monitor predefined configuration
            conf = self._get_client_config()
            if not conf:
                return
            fo = StringIO(conf)
            cp = ConfigParser()
            try:
                cp.readfp(fo)
            except Exception:
                raise APIError("Cannot get CEPH monitors."
                               " Make sure your CEPH cluster is available"
                               " and KuberDock is configured to use CEPH")
            if not cp.has_option('global', 'mon_host'):
                self._monitors = ['127.0.0.1']
            else:
                self._monitors = [
                    i.strip() for i in cp.get('global', 'mon_host').split(',')
                ]
        return self._monitors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号