本文整理汇总了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 !')
示例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 !')
示例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 !')
示例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()
示例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.')
示例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()
示例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')
示例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()
示例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)()
示例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)
示例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.')
示例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)()
示例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))()
示例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()
示例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)()