Skip to content

Commit

Permalink
Run nodemgr process as contrail user - src (3/3)
Browse files Browse the repository at this point in the history
Nodemgr process runs as root on all nodes.
- Setting to make supervisord start nodemgr process as contrail:contrail
- contrail-cassandra-status script writes to /var/log/contrail/{cassandra-status-up|cassandra-status.log}
- if node minimum_diskGB < configured minimum_diskGB, nodemgr raises an alarm.
  contrail-database service will NOT be stopped.

Change-Id: I4f562ce6748fc00cdc5db0167260da9c5ab84397
Depends-On: Ieab1c4e3b95618d559b8351af2ddbbb9fac0f2cf
Partial-Bug: #1699603
  • Loading branch information
Santosh Gupta committed May 15, 2018
1 parent 4e6f870 commit 0c2ffd9
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/analytics/database/utils/contrail-cassandra-status.py
Expand Up @@ -218,7 +218,7 @@ def main():
" not be UP before stopping cassandra")

parser.add_argument("--status-up-file", dest="status_up_file",
metavar="FILENAME", default="/var/log/cassandra/status-up",
metavar="FILENAME", default="/var/log/contrail/cassandra-status-up",
help="Record up status to file")

parser.add_argument("-v", "--verbose", dest="verbose", action='store_true',
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/supervisord_analytics.conf
Expand Up @@ -9,7 +9,7 @@
[unix_http_server]
file=/var/run/supervisord_analytics.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
chown=contrail:contrail ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))

Expand Down
2 changes: 1 addition & 1 deletion src/config/api-server/supervisord_config.conf
Expand Up @@ -9,7 +9,7 @@
[unix_http_server]
file=/var/run/supervisord_config.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
chown=contrail:contrail ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))

Expand Down
2 changes: 1 addition & 1 deletion src/control-node/supervisord_control.conf
Expand Up @@ -9,7 +9,7 @@
[unix_http_server]
file=/var/run/supervisord_control.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
chown=contrail:contrail ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))

Expand Down
Expand Up @@ -21,6 +21,7 @@ buffer_size=10000 ; event buffer queue size (default 10)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
user=contrail ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/contrail/contrail-analytics-nodemgr-stdout.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
Expand Down
6 changes: 1 addition & 5 deletions src/nodemgr/common/cassandra_manager.py
Expand Up @@ -38,7 +38,7 @@ def __init__(self, cassandra_repair_logdir, db_name, contrail_databases,

def status(self):
subprocess.Popen(["contrail-cassandra-status",
"--log-file", "/var/log/cassandra/status.log",
"--log-file", "/var/log/contrail/cassandra-status.log",
"--debug"], close_fds=True)

def repair(self):
Expand Down Expand Up @@ -169,10 +169,6 @@ def process(self, event_mgr):
else:
disk_space = int(total_disk_space_used) + int(total_disk_space_available)
if (disk_space / (1024 * 1024) < self.minimum_diskgb):
cmd_str = "service " + SERVICE_CONTRAIL_DATABASE + " stop"
(ret_value, error_value) = subprocess.Popen(
cmd_str, shell=True, stdout=subprocess.PIPE,
close_fds=True).communicate()
event_mgr.fail_status_bits |= event_mgr.FAIL_STATUS_DISK_SPACE
event_mgr.fail_status_bits &= ~event_mgr.FAIL_STATUS_DISK_SPACE_NA
except:
Expand Down
1 change: 1 addition & 0 deletions src/nodemgr/config_nodemgr/contrail-config-nodemgr.ini
Expand Up @@ -24,6 +24,7 @@ buffer_size=10000 ; event buffer queue size (default 10)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
user=contrail ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/contrail/contrail-config-nodemgr-stdout.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
Expand Down
1 change: 1 addition & 0 deletions src/nodemgr/control_nodemgr/contrail-control-nodemgr.ini
Expand Up @@ -24,6 +24,7 @@ buffer_size=10000 ; event buffer queue size (default 10)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
user=contrail ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/contrail/contrail-control-nodemgr-stdout.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
Expand Down
2 changes: 1 addition & 1 deletion src/nodemgr/database_nodemgr/contrail-database-nodemgr.ini
Expand Up @@ -23,7 +23,7 @@ buffer_size=10000 ; event buffer queue size (default 10)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
user=contrail ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/contrail/contrail-database-nodemgr-stdout.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
Expand Down
2 changes: 1 addition & 1 deletion src/nodemgr/vrouter_nodemgr/contrail-vrouter-nodemgr.ini
Expand Up @@ -24,7 +24,7 @@ buffer_size=10000 ; event buffer queue size (default 10)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
user=contrail ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/contrail/contrail-vrouter-nodemgr-stdout.log ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/supervisord_vrouter.conf
Expand Up @@ -9,7 +9,7 @@
[unix_http_server]
file=/var/run/supervisord_vrouter.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
chown=contrail:contrail ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))

Expand Down

0 comments on commit 0c2ffd9

Please sign in to comment.