Skip to content

Commit

Permalink
[doctor][stack] check ceph.config
Browse files Browse the repository at this point in the history
redmine #6354

Signed-off-by: blkart <[email protected]>
  • Loading branch information
blkart committed Apr 12, 2016
1 parent 4c57df1 commit 722f418
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 23 deletions.
36 changes: 35 additions & 1 deletion eayunstack_tools/doctor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
'/etc/mongodb.conf'
]

controller_ceph_p = [
'/etc/ceph/ceph.conf'
]

ceph_osd_ceph_p = [
'/etc/ceph/ceph.conf'
]

# 'XXX_s' for XXX's services list

keystone_s = [
Expand Down Expand Up @@ -77,6 +85,12 @@
'mongod'
]

controller_ceph_s = [
]

ceph_osd_ceph_s = [
]

# component db profile list

component_db_p = {
Expand Down Expand Up @@ -107,7 +121,8 @@
'nova',
'neutron',
'cinder',
'ceilometer'
'ceilometer',
'ceph'
]

compute_c = [
Expand All @@ -118,6 +133,10 @@
'mongo'
]

ceph_osd_c = [
'ceph'
]

# return profile list

def get_keystone_profiles():
Expand All @@ -141,6 +160,12 @@ def get_ceilometer_profiles():
def get_mongo_profiles():
return mongo_p

def get_controller_ceph_profiles():
return controller_ceph_p

def get_ceph_osd_ceph_profiles():
return ceph_osd_ceph_p

# return services list

def get_keystone_services():
Expand All @@ -167,6 +192,12 @@ def get_ceilometer_services():
def get_mongo_services():
return mongo_s

def get_controller_ceph_services():
return controller_ceph_s

def get_ceph_osd_ceph_services():
return ceph_osd_ceph_s

# return db profile

def get_db_profile():
Expand All @@ -183,6 +214,9 @@ def get_compute_component():
def get_mongo_component():
return mongo_c

def get_ceph_osd_component():
return ceph_osd_c

# return a list of commands for check component availability

def get_component_check_cmd():
Expand Down
39 changes: 32 additions & 7 deletions eayunstack_tools/doctor/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,38 @@ def stack(parser):
if not NODE_ROLE.is_mongo():
cmd_warn('mongo')
return
if parser.CONTROLLER or parser.COMPUTE or parser.MONGO:
if parser.CEPHOSD:
if not NODE_ROLE.is_ceph_osd():
cmd_warn('ceph-osd')
return
if parser.CONTROLLER or parser.COMPUTE or parser.MONGO or parser.CEPHOSD:
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.CEPHOSD:
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.CEPHOSD:
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.CEPHOSD:
check('ceph_osd', 'all')
return
# check all
if parser.CHECK_ALL and parser.PROFILE and parser.SERVICE:
Expand Down Expand Up @@ -109,13 +119,20 @@ def make(parser):
default=False,
help='Check All Mongo Node',
)
parser.add_argument(
'--ceph-osd',
dest='CEPHOSD',
action='store_true',
default=False,
help='Check All Ceph-OSD Node',
)
common.add_common_opt(parser)
parser.set_defaults(func=stack)

# check all component

# IMPORTANT: node include fuel
all_roles = ('controller','compute','mongo')
all_roles = ('controller','compute','mongo','ceph_osd')

def check(role, obj):
if NODE_ROLE.is_fuel():
Expand Down Expand Up @@ -146,18 +163,15 @@ def check_all_profile():
check_nodes(role, 'profile', multi_role=True)
else:
for node_role in node_roles:
# print node_role
if node_role != 'ceph_osd':
eval('check_%s_profile' % node_role)()
eval('check_%s_profile' % node_role)()

def check_all_service():
if NODE_ROLE.is_fuel():
for role in all_roles:
check_nodes(role, 'service', multi_role=True)
else:
for node_role in node_roles:
if node_role != 'ceph_osd':
eval('check_%s_service' % node_role)()
eval('check_%s_service' % node_role)()

# check controller profile & service
@userful_msg()
Expand Down Expand Up @@ -193,5 +207,16 @@ def check_mongo_profile():
def check_mongo_service():
check_node_services('mongo')

# check ceph-osd node profile & service
@userful_msg()
@register
def check_ceph_osd_profile():
check_node_profiles('ceph_osd')

@userful_msg()
@register
def check_ceph_osd_service():
check_node_services('ceph_osd')

def cmd_warn(node_role):
LOG.warn('This command can only run on fuel or %s node !' % node_role)
9 changes: 6 additions & 3 deletions eayunstack_tools/doctor/stack_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ def check_node_profiles(role):
component_list = eval('get_%s_component' % role)()
for c in component_list:
LOG.info('Checking "%s" Component' % c.capitalize())
profile_list = eval('get_%s_profiles' % c)()
if c == 'ceph':
profile_list = eval('get_%s_%s_profiles' % (role, c))()
else:
profile_list = eval('get_%s_profiles' % c)()
for p in profile_list:
LOG.debug('Profile: ' + p)
check_profile(p, role)
Expand All @@ -273,14 +276,14 @@ def check_node_services(node):
for c in component_list:
LOG.info('Checking "%s" Component' % c.capitalize())
LOG.debug('-Service Status')
if c == 'nova':
if c == 'nova' or c == 'ceph':
service_list = eval('get_%s_%s_services' % (node, c))()
else:
service_list = eval('get_%s_services' % c)()
for s in service_list:
# utils.check_service(s)
check_service(s)
if node != 'controller':
if node != 'controller' or c == 'ceph':
continue
LOG.debug('-DB Connectivity')
check_db_connect(c)
Expand Down
12 changes: 0 additions & 12 deletions template/ceph_osd/ceph.conf.template
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
[global]
## filter options
fsid =
cluster_network =
mon_host =
public_network =
mon_initial_members =
##
log_to_syslog_level = info
log_to_syslog = False
log_to_syslog_facility = LOG_LOCAL0
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
filestore_xattr_use_omap = true
osd_pool_default_size = 2
osd_pool_default_min_size = 1
osd_pool_default_pg_num = 1024
osd_journal_size = 2048
auth_supported = cephx
osd_pool_default_pgp_num = 1024
osd_mkfs_type = xfs
[client]
rbd_cache_writethrough_until_flush = True
Expand Down
5 changes: 5 additions & 0 deletions template/ceph_osd/ceph.conf.template.filter
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ cluster_network =
mon_host =
public_network =
mon_initial_members =
osd_pool_default_pg_num =
osd_pool_default_pgp_num =
osd_journal_size =
osd_pool_default_size =
osd_pool_default_min_size =
13 changes: 13 additions & 0 deletions template/controller/ceph.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[global]
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx
filestore_xattr_use_omap = true
log_to_syslog_level = info
log_to_syslog = False
log_to_syslog_facility = LOG_LOCAL0
auth_supported = cephx
osd_mkfs_type = xfs
[client]
rbd_cache_writethrough_until_flush = True
rbd_cache = True
11 changes: 11 additions & 0 deletions template/controller/ceph.conf.template.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[global]
cluster_network =
mon_host =
public_network =
mon_initial_members =
fsid =
osd_pool_default_pg_num =
osd_pool_default_pgp_num =
osd_journal_size =
osd_pool_default_size =
osd_pool_default_min_size =

0 comments on commit 722f418

Please sign in to comment.