當前位置: 首頁>>代碼示例>>Python>>正文


Python NODE_ROLE.is_fuel方法代碼示例

本文整理匯總了Python中eayunstack_tools.utils.NODE_ROLE.is_fuel方法的典型用法代碼示例。如果您正苦於以下問題:Python NODE_ROLE.is_fuel方法的具體用法?Python NODE_ROLE.is_fuel怎麽用?Python NODE_ROLE.is_fuel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eayunstack_tools.utils.NODE_ROLE的用法示例。


在下文中一共展示了NODE_ROLE.is_fuel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: check_rabbitmq

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_rabbitmq():
    # node role check
    if not NODE_ROLE.is_fuel():
        if not NODE_ROLE.is_controller():
            LOG.warn('This command can only run on fuel or controller node !')
            return
    if NODE_ROLE.is_fuel():
        check_all_nodes('rabbitmq')
        return
    LOG.info('%s%s Checking rabbitmq cluster status' %('='*5, '>'))
    # get all controller node hostname
    controllers = get_controllers_hostname()
    if controllers is None:
        LOG.error('Can not get the controllers node list !')
        return
    # get masters & slaves node list
    running_nodes = get_rabbitmq_nodes()
    if running_nodes is None:
        LOG.error('Can not get the running node list for rabbitmq cluster !')
        return
    # check all controller nodes in masters + slaves node list
    error_nodes = []
    for node in controllers:
        if node.split('.')[0] not in running_nodes:
            error_nodes.append(node)

    if error_nodes:
        LOG.error('Node %s not in rabbitmq cluster !' % error_nodes)
        LOG.error('Rabbitmq cluster check faild !')
    else:
        LOG.info('Rabbitmq cluster check successfully !')
開發者ID:isyippee,項目名稱:eayunstack-tools,代碼行數:33,代碼來源:cls.py

示例2: check_mysql

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_mysql():
    # node role check
    if not NODE_ROLE.is_fuel():
        if not NODE_ROLE.is_controller():
            LOG.warn('This command can only run on fuel or controller node !')
            return
    if NODE_ROLE.is_fuel():
        check_all_nodes('mysql')
        return
    LOG.info('%s%s Checking mysql cluster status' %('='*5, '>'))
    # get running node list for mysql cluster
    running_nodes = get_mysql_nodes()
    if running_nodes is None:
        LOG.error('Can not get the running node list for mysql cluster !')
        return
    # get all controller node hostname
    controllers = get_controllers_hostname()
    if controllers is None:
        LOG.error('Can not get the controllers node list !')
        return
    # check all controller node in mysql cluster
    error_nodes = []
    for node in controllers:
        if node not in running_nodes:
            error_nodes.append(node)

    if error_nodes:
        LOG.error('Node %s is not running in mysql cluster !' % error_nodes)
        LOG.error('Mysql cluster check faild !')
    else:
        LOG.info('Mysql cluster check successfully !')
開發者ID:isyippee,項目名稱:eayunstack-tools,代碼行數:33,代碼來源:cls.py

示例3: check_ceph

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [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

示例4: check_all

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_all():
    '''Check All Cluster'''
    # node role check
    if not NODE_ROLE.is_fuel():
        if not NODE_ROLE.is_controller():
            LOG.warn('This command can only run on fuel or controller node !')
            return
    if NODE_ROLE.is_fuel():
        check_all_nodes('all')
    else:
        check_rabbitmq()
        check_mysql()
        check_haproxy()
        check_ceph()
開發者ID:yeming233,項目名稱:eayunstack-tools,代碼行數:16,代碼來源:cls.py

示例5: setup

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def setup(parser):
    """Set things up for the upgrade operation."""
    if NODE_ROLE.is_fuel():
        setup_rsyncd_config()
        setup_nodes(parser.MYIP)
    else:
        LOG.error('This command can only be run on the fuel node.')
開發者ID:caisan,項目名稱:eayunstack-tools,代碼行數:9,代碼來源:setup.py

示例6: stack

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [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.CONTROLLER or parser.COMPUTE or parser.MONGO:
        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.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.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')
        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:caisan,項目名稱:eayunstack-tools,代碼行數:61,代碼來源:stack.py

示例7: check_all

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_all():
    '''Check All OpenStack Component'''
    if not NODE_ROLE.is_fuel():
        check_all_profile()
        check_all_service()
    else:
        for role in all_roles:
            check_nodes(role, 'all')
開發者ID:caisan,項目名稱:eayunstack-tools,代碼行數:10,代碼來源:stack.py

示例8: init

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def init(parser):
    if NODE_ROLE.is_unknown():
        LOG.error("Can not confirm the node role!")
    if not NODE_ROLE.is_fuel():
        LOG.warn("This command can only run on fuel node !")
        return
    init_node_list_file()
    init_node_role_file()
開發者ID:masterpy,項目名稱:eayunstack-tools,代碼行數:10,代碼來源:__init__.py

示例9: check_all_service

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_all_service():
    if NODE_ROLE.is_fuel():
        for role in all_roles:
            if role == 'ceph_osd': role = 'ceph-osd'
            check_nodes(role, 'service', multi_role=True)
    else:
        for node_role in node_roles:
            eval('check_%s_service' % node_role)()
開發者ID:zeus911,項目名稱:eayunstack-tools,代碼行數:10,代碼來源:stack.py

示例10: deployment_monitor_plugins

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def deployment_monitor_plugins(parser):
    if not NODE_ROLE.is_fuel():
        LOG.warn('This command can only run on fuel node !')
        return
    if parser.INFLUXDB:
        deployment_influxdb_grafana(parser.ENV)
    if parser.LMA_COLLECTOR:
        deployment_lma_collector(parser.ENV)
開發者ID:caisan,項目名稱:eayunstack-tools,代碼行數:10,代碼來源:deployment_monitor_plugins.py

示例11: go

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def go(parser):
    """Upgrade"""
    if NODE_ROLE.is_fuel():
        if parser.CHECK_ONLY:
            check_upgrade_process()
        else:
            go_upgrade(parser.MYIP)
    else:
        LOG.error('This command can only be run on the fuel node.')
開發者ID:caisan,項目名稱:eayunstack-tools,代碼行數:11,代碼來源:go.py

示例12: check_all_profile

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_all_profile():
    if NODE_ROLE.is_fuel():
        for role in all_roles:
            if role == 'ceph_osd': role = 'ceph-osd'
            check_nodes(role, 'profile', multi_role=True)
    else:
        for node_role in node_roles:
           # print node_role
       	    eval('check_%s_profile' % node_role)()
開發者ID:zeus911,項目名稱:eayunstack-tools,代碼行數:11,代碼來源:stack.py

示例13: check

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check(role, obj):
   if NODE_ROLE.is_fuel():
       check_nodes(role, obj)
   else:
       if not eval('NODE_ROLE.is_%s' % role)():
           LOG.warn('This command can only run on fuel or %s node !' % role)
       else:
           if obj == 'all':
               eval('check_%s_%s' % (role, 'profile'))()
               eval('check_%s_%s' % (role, 'service'))()
           else:
               eval('check_%s_%s' % (role, obj))()
開發者ID:caisan,項目名稱:eayunstack-tools,代碼行數:14,代碼來源:stack.py

示例14: init

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def init(parser):
    if NODE_ROLE.is_unknown():
        LOG.error('Can not confirm the node role!')
    if not NODE_ROLE.is_fuel():
        LOG.warn('This command can only run on fuel node !')
        return
    if parser.UPDATE:
        update()
        return
    init_env()
    init_node_list_file()
    init_node_role_file()
開發者ID:taicai,項目名稱:eayunstack-tools,代碼行數:14,代碼來源:__init__.py

示例15: check_all

# 需要導入模塊: from eayunstack_tools.utils import NODE_ROLE [as 別名]
# 或者: from eayunstack_tools.utils.NODE_ROLE import is_fuel [as 別名]
def check_all():
    '''Check All Environement Object'''
    if NODE_ROLE.is_fuel():
        check_cmd = get_check_cmd('all')
        for role in ['controller','compute','mongo','ceph-osd']:
            node_list = get_node_list(role)
            proc_list = run_doctor_on_nodes(role, node_list, check_cmd)
        for proc in proc_list:
            proc.join()
    else:
        for i in register.all:
            eval(i)()
開發者ID:masterpy,項目名稱:eayunstack-tools,代碼行數:14,代碼來源:env.py


注:本文中的eayunstack_tools.utils.NODE_ROLE.is_fuel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。