Skip to content

Commit

Permalink
netns command crashes not reported through nodemgr Closes-Bug: #1374396
Browse files Browse the repository at this point in the history
Change-Id: I88e126cbbf4677a0ce4f1b54c3b6d3ccf1d4a7dd
  • Loading branch information
shabbir0734 committed Nov 25, 2014
1 parent 33caf00 commit a03216d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions common/control_files/contrail-nodemgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def __init__(self, rules, node_type='contrail-analytics'):
self.max_old_cores = 3
self.max_new_cores = 1
self.node_type = node_type
self.all_core_file_list = []
self.core_dir_modified_time = 0
if (node_type == 'contrail-vrouter'):
os_nova_comp = process_stat()
(os_nova_comp_state, error_value) = Popen("openstack-status | grep openstack-nova-compute | cut -d ':' -f2", shell=True, stdout=PIPE).communicate()
Expand Down Expand Up @@ -226,6 +228,7 @@ def send_process_state_db(self, sandeshconn):
node_status = NodeStatus()
node_status.name = socket.gethostname()
node_status.process_info = process_infos
node_status.all_core_file_list = self.all_core_file_list
node_status_uve = NodeStatusUVE(data = node_status)
sys.stderr.write('Sending UVE:' + str(node_status_uve))
node_status_uve.send()
Expand Down Expand Up @@ -260,6 +263,17 @@ def send_database_usage(self):
usage_stat.send()
# end send_database_usage

def send_all_core_file(self, sandeshconn):
stat_command_option = "stat --printf=%Y /var/crashes"
modified_time = Popen(stat_command_option.split(), stdout=PIPE).communicate()
if modified_time[0] == self.core_dir_modified_time:
return
self.core_dir_modified_time = modified_time[0]
ls_command_option = "ls /var/crashes"
(corename, stderr) = Popen(ls_command_option.split(), stdout=PIPE).communicate()
self.all_core_file_list = corename.split('\n')[0:-1]
self.send_process_state_db(sandeshconn)

def runforever(self, sandeshconn, test=False):
#sys.stderr.write(str(self.rules_data['Rules'])+'\n')
prev_current_time = int(time.time())
Expand Down Expand Up @@ -314,6 +328,8 @@ def runforever(self, sandeshconn, test=False):

# do periodic events
if headers['eventname'].startswith("TICK_60"):
# send other core file
self.send_all_core_file(sandeshconn)
# check for openstack nova compute status
if (self.node_type == "contrail-vrouter"):
os_nova_comp = self.process_state_db['openstack-nova-compute']
Expand Down

0 comments on commit a03216d

Please sign in to comment.