当前位置: 首页>>代码示例>>Python>>正文


Python NODE_ROLE.is_ceph_osd方法代码示例

本文整理汇总了Python中eayunstack_tools.utils.NODE_ROLE.is_ceph_osd方法的典型用法代码示例。如果您正苦于以下问题:Python NODE_ROLE.is_ceph_osd方法的具体用法?Python NODE_ROLE.is_ceph_osd怎么用?Python NODE_ROLE.is_ceph_osd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eayunstack_tools.utils.NODE_ROLE的用法示例。


在下文中一共展示了NODE_ROLE.is_ceph_osd方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_ceph

# 需要导入模块: from eayunstack_tools.utils import NODE_ROLE [as 别名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_ceph_osd [as 别名]
def check_ceph():
    # node role check
    if not NODE_ROLE.is_fuel():
        if not NODE_ROLE.is_controller():
            if not NODE_ROLE.is_ceph_osd():
                LOG.warn('This command can only run on fuel or controller or ceph-osd node !')
                return
    if NODE_ROLE.is_fuel():
        check_all_nodes('ceph')
        return
    # get cluster status
    LOG.info('%s%s Checking ceph cluster status' %('='*5, '>'))
    ceph_check_health()

    # check osd status
    LOG.info('%s%s Checking ceph osd status' %('='*5, '>'))
    check_success = True
    osd_status = get_ceph_osd_status()
    if not osd_status:
        LOG.error('Can not get ceph osd status !')
        check_success = False
    else:
        for l in osd_status.split('\n'):
            if 'id' not in l and 'weigh' not in l and 'osd.' in l:
                osd = l.split()[2]
                status = l.split()[3]
                if status != 'up':
                    LOG.error('%s status is not correct, please check it !' % osd)
                    check_success = False
    if check_success:
        LOG.info('Ceph osd status check successfully !')
开发者ID:isyippee,项目名称:eayunstack-tools,代码行数:33,代码来源:cls.py

示例2: _network_check_remote

# 需要导入模块: from eayunstack_tools.utils import NODE_ROLE [as 别名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_ceph_osd [as 别名]
def _network_check_remote(remote_inf):
    def _ping(peer_inf, role):
        LOG.debug('=====> start ping %s of %s(%s):' %
                  (role, peer_inf['host'], peer_inf['role']))
        ping(peer_inf[role])

    for inf in remote_inf:
        _ping(inf, 'internal_address')
        if (not NODE_ROLE.is_mongo()) and (not inf['role'].endswith('mongo')):
            _ping(inf, 'storage_address')
        if NODE_ROLE.is_controller() and inf['role'] == 'controller':
            _ping(inf, 'public_address')
        if NODE_ROLE.is_ceph_osd() and inf['role'] == 'ceph-osd':
            _ping(inf, 'ceph_cluster_address')
开发者ID:pengdake,项目名称:eayunstack-tools,代码行数:16,代码来源:env.py

示例3: get_node_role

# 需要导入模块: from eayunstack_tools.utils import NODE_ROLE [as 别名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_ceph_osd [as 别名]
def get_node_role():
    node_roles = []
    if NODE_ROLE.is_unknown():
        return node_roles
    if NODE_ROLE.is_fuel():
        node_roles.append('fuel')
    if NODE_ROLE.is_controller():
        node_roles.append('controller')
    if NODE_ROLE.is_compute():
        node_roles.append('compute')
    if NODE_ROLE.is_ceph_osd():
        node_roles.append('ceph_osd')
    if NODE_ROLE.is_mongo():
        node_roles.append('mongo')
    return node_roles
开发者ID:isyippee,项目名称:eayunstack-tools,代码行数:17,代码来源:utils.py

示例4: _network_check_local

# 需要导入模块: from eayunstack_tools.utils import NODE_ROLE [as 别名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_ceph_osd [as 别名]
def _network_check_local(local_inf, nic_status):
    # 1) check if nic we need link is ok
    if NODE_ROLE.is_mongo():
        local_inf = [i for i in local_inf if i["name"] not in ["br-storage", "br-prv"]]
    if NODE_ROLE.is_ceph_osd():
        local_inf = [i for i in local_inf if i["name"] != "br-prv"]

    nic_need = [i["phy_port"] for i in local_inf]
    for nic in set(nic_need):
        # if two network roles use same nic, e.g. br-mgmt and br-fw-admin
        # use eno1, we can ignore it since we just want physic network nic
        inf = filter(lambda inf: inf["phy_port"] == nic, local_inf)[0]
        if nic_status[nic].lower() != "yes":
            LOG.error("Network card %s(%s) is not connected" % (nic, inf["name"]))
        else:
            LOG.debug("Network card %s(%s) connected" % (nic, inf["name"]))
开发者ID:fabian4,项目名称:eayunstack-tools,代码行数:18,代码来源:env.py

示例5: _network_check_local

# 需要导入模块: from eayunstack_tools.utils import NODE_ROLE [as 别名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_ceph_osd [as 别名]
def _network_check_local(local_inf, nic_status):
    # 1) check if nic we need link is ok
    if NODE_ROLE.is_mongo():
        local_inf = [i for i in local_inf if i['name']
                     not in ['br-storage', 'br-prv']]
    if NODE_ROLE.is_ceph_osd():
        local_inf = [i for i in local_inf if i['name'] != 'br-prv']

    nic_need = []
    for inf in local_inf:
        nic_need.extend(inf['phy_port'])
    for nic in set(nic_need):
        # if two network roles use same nic, e.g. br-mgmt and br-fw-admin
        # use eno1, we can ignore it since we just want physic network nic
        inf = filter(lambda inf: nic in inf['phy_port'], local_inf)[0]
        if nic_status[nic].lower() != 'yes':
            LOG.error('Network card %s(%s) is not connected' %
                      (nic, inf['name']))
        else:
            LOG.debug('Network card %s(%s) connected' %
                      (nic, inf['name']))
开发者ID:caisan,项目名称:eayunstack-tools,代码行数:23,代码来源:env.py

示例6: stack

# 需要导入模块: from eayunstack_tools.utils import NODE_ROLE [as 别名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_ceph_osd [as 别名]
def stack(parser):
    # if node role is "unknow", go back
    if NODE_ROLE.is_unknown():
        LOG.error('Can not confirm the node role!')
        return
    if not NODE_ROLE.is_fuel():
        if parser.CONTROLLER:
            if not NODE_ROLE.is_controller():
                cmd_warn('controller')
                return
        if parser.COMPUTE:
            if not NODE_ROLE.is_compute():
                cmd_warn('compute')
                return
        if parser.MONGO:
            if not NODE_ROLE.is_mongo():
                cmd_warn('mongo')
                return
        if parser.CEPH_OSD:
            if not NODE_ROLE.is_ceph_osd():
                cmd_warn('ceph-osd')
                return
    if parser.CONTROLLER or parser.COMPUTE or parser.MONGO or parser.CEPH_OSD:
        if parser.PROFILE and not parser.SERVICE and not parser.CHECK_ALL:
            if parser.CONTROLLER:
                check('controller', 'profile')
            if parser.COMPUTE:
                check('compute', 'profile')
            if parser.MONGO:
                check('mongo', 'profile')
            if parser.CEPH_OSD:
                check('ceph-osd', 'profile')
        if parser.SERVICE and not parser.PROFILE and not parser.CHECK_ALL:
            if parser.CONTROLLER:
                check('controller', 'service')
            if parser.COMPUTE:
                check('compute', 'service')
            if parser.MONGO:
                check('mongo', 'service')
            if parser.CEPH_OSD:
                check('ceph-osd', 'service')
        if parser.SERVICE and parser.PROFILE or parser.CHECK_ALL or not parser.PROFILE and not parser.SERVICE:
            if parser.CONTROLLER:
                check('controller', 'all')
            if parser.COMPUTE:
                check('compute', 'all')
            if parser.MONGO:
                check('mongo', 'all')
            if parser.CEPH_OSD:
                check('ceph-osd', 'all')
        return
    # check all
    if parser.CHECK_ALL and parser.PROFILE and parser.SERVICE:
        check_all()
        return
    elif parser.CHECK_ALL and parser.PROFILE:
        check_all_profile()
        return
    elif parser.CHECK_ALL and parser.SERVICE:
        check_all_service()
        return
    elif parser.CHECK_ALL:
        check_all()
        return
    # check profile or service
    if parser.PROFILE:
        check_all_profile()
    if parser.SERVICE:
        check_all_service()
开发者ID:zeus911,项目名称:eayunstack-tools,代码行数:71,代码来源:stack.py


注:本文中的eayunstack_tools.utils.NODE_ROLE.is_ceph_osd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。