Custom Search

Tuesday, June 23, 2015

How to tweak OpenContrail supervisor

1)
Check all services run by supervisor
 
#ps -aux | grep /usr/bin/supervisord

root      1530  0.0  0.1  60712  5432 ?        S    13:44   0:01 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_analytics.conf
root      1532  0.0  0.1  60692  5312 ?        S    13:44   0:01 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_database.conf
root      1533  0.0  0.1  60924  7968 ?        S    13:44   0:01 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_support_service.conf
root      1535  0.0  0.1  60676  5088 ?        S    13:44   0:00 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_webui.conf
root      1536  0.0  0.1  60700  5268 ?        S    13:44   0:01 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_control.conf
root      1555  0.0  0.1  60684  5196 ?        S    13:45   0:00 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_vrouter.conf
root      1557  0.2  0.1  61416  7948 ?        S    13:45   0:04 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_openstack.conf
root      4287  0.0  0.2  60636  9556 ?        Ss   13:45   0:00 /usr/bin/python /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
saju      5874  0.0  0.0  11748   928 pts/2    S+   14:15   0:00 grep --color=auto /usr/bin/supervisord
root      6365  0.1  0.3  60720 14260 ?        S    13:45   0:01 /usr/bin/python /usr/bin/supervisord --nodaemon -c /etc/contrail/supervisord_config.conf

2)
main contrail supervisord and its config

#sudo vim /etc/contrail/supervisord_config.conf
[include]
files = /etc/contrail/supervisord_config_files/*.ini

3)

Check the files in the "/etc/contrail/supervisord_config_files" directory. All configurations used by supervisor for "contrail config node" can find here.

#sudo ls /etc/contrail/supervisord_config_files
contrail-api.ini       contrail-device-manager.ini  contrail-nodemgr-config.ini  contrail-svc-monitor.ini
contrail-config.rules  contrail-discovery.ini        contrail-schema.ini         ifmap.ini

4)
Check the command used by supervisor to run "contrail-api" server.

#sudo vim /etc/contrail/supervisord_config_files/contrail-api.ini
[program:contrail-api]
command=/usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --listen_port 910%(process_num)01d --worker_id %(process_num)s
numprocs=1
process_name=%(process_num)s
redirect_stderr=true
stdout_logfile= /var/log/contrail/contrail-api-%(process_num)s-stdout.log
stderr_logfile=/dev/null
priority=440
autostart=true
killasgroup=true
stopsignal=KILL
exitcodes=0

5)

Check the rules used by supervisor for "contrail-config".

#sudo vim /etc/contrail/supervisord_config_files/contrail-config.rules
{ "Rules": [
    {"processname": "contrail-api", "process_state": "PROCESS_STATE_STOPPED", "action": "sudo service supervisor-config restart"},
    {"processname": "contrail-api", "process_state": "PROCESS_STATE_EXITED", "action": "sudo service supervisor-config restart"},
    {"processname": "contrail-api", "process_state": "PROCESS_STATE_FATAL", "action": "sudo service supervisor-config restart"},

    {"processname": "ifmap", "process_state": "PROCESS_STATE_STOPPED", "action": "sudo service supervisor-config restart"},
    {"processname": "ifmap", "process_state": "PROCESS_STATE_EXITED", "action": "sudo service supervisor-config restart"},
    {"processname": "ifmap", "process_state": "PROCESS_STATE_FATAL", "action": "sudo service supervisor-config restart"}
     ]
}

6)

Find the command which used to run "contrail-api" server and copy it.

#ps -aux | grep contrail-api

root      6493  0.8  1.3 324804 61400 ?        Sl   13:46   0:17 /usr/bin/python /usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --listen_port 9100 --worker_id 0

7)
Try neutron command "neutron net-list", this should work since we haven't made any change.

export OS_USERNAME=admin
export OS_PASSWORD=secret123
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://127.0.0.1:35357/v2.0

#neutron net-list

8)
Rename "contrail-api.ini" to "contrail-api.ini_bkp"

#sudo mv /etc/contrail/supervisord_config_files/contrail-api.ini /etc/contrail/supervisord_config_files/contrail-api.ini_bkp

9)
Comment first 3 lines which contains "processname": "contrail-api"

#sudo vim /etc/contrail/supervisord_config_files/contrail-config.rules
{ "Rules": [
#    {"processname": "contrail-api", "process_state": "PROCESS_STATE_STOPPED", "action": "sudo service supervisor-config restart"},
#    {"processname": "contrail-api", "process_state": "PROCESS_STATE_EXITED", "action": "sudo service supervisor-config restart"},
#    {"processname": "contrail-api", "process_state": "PROCESS_STATE_FATAL", "action": "sudo service supervisor-config restart"},

    {"processname": "ifmap", "process_state": "PROCESS_STATE_STOPPED", "action": "sudo service supervisor-config restart"},
    {"processname": "ifmap", "process_state": "PROCESS_STATE_EXITED", "action": "sudo service supervisor-config restart"},
    {"processname": "ifmap", "process_state": "PROCESS_STATE_FATAL", "action": "sudo service supervisor-config restart"}
     ]
}

10)
Restart supervisor-config

#sudo service supervisor-config restart
supervisor-config stop/waiting
supervisor-config start/running, process 21955

11)
Ensure that "contrail-api" server not running now

#ps -aux | grep contrail-api
saju     22333  0.0  0.0  11744   924 pts/2    S+   14:33   0:00 grep --color=auto contrail-api

12)
Try neutron command "neutron net-list", this would not work if "contrail-api" server is not running.

#neutron net-list
500-{u'NeutronError': {u'message': u'An unknown exception occurred.', u'type': u'NeutronException', u'detail': u''}}

13)
Manually Start "contrail-api" server

#sudo /usr/bin/python /usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --listen_port 9100 --worker_id 0

14)
Try neutron command "neutron net-list", this should work.

#neutron net-list
Works :)


2 comments:

  1. #sudo find /etc/contrail/ -name *.rules

    /etc/contrail/supervisord_config_files/contrail-config.rules
    /etc/contrail/supervisord_vrouter_files/contrail-vrouter.rules
    /etc/contrail/supervisord_control_files/contrail-control.rules
    /etc/contrail/supervisord_database_files/contrail-database.rules
    /etc/contrail/supervisord_analytics_files/contrail-analytics.rules

    ReplyDelete
  2. #service contrail-analytics-api stop

    ReplyDelete