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
评论列表
文章目录