fix initial opencontrail database startup and redis configuration
Change-Id: Ic5cd4a0560db380a2e13c9b5c9ea6975b17973a8
diff --git a/opencontrail/compute.sls b/opencontrail/compute.sls
index 231900c..f2f6ca1 100644
--- a/opencontrail/compute.sls
+++ b/opencontrail/compute.sls
@@ -69,6 +69,18 @@
- source: salt://opencontrail/files/findns
- mode: 755
+{% if compute.version == 3.0 %}
+
+/etc/contrail/supervisord_vrouter_files/contrail-vrouter-nodemgr.ini:
+ file.managed:
+ - source: salt://opencontrail/files/{{ compute.version }}/contrail-vrouter-nodemgr.ini
+ - require:
+ - pkg: opencontrail_compute_packages
+ - require_in:
+ - service: opencontrail_compute_services
+
+{% endif %}
+
{%- if network.interface.get('vhost0', {}).get('enabled', False) %}
contrail_load_vrouter_kernel_module:
diff --git a/opencontrail/database.sls b/opencontrail/database.sls
index 93662e2..ba1d4d9 100644
--- a/opencontrail/database.sls
+++ b/opencontrail/database.sls
@@ -103,6 +103,14 @@
{% endif %}
+{% if grains.os_family == "Debian" %}
+#Stop cassandra started by init script - replaced by contrail-database
+disable-cassandra-service:
+ service.dead:
+ - name: cassandra
+ - enable: None
+{% endif %}
+
opencontrail_database_services:
service.running:
- enable: true
diff --git a/opencontrail/files/3.0/collector/redis.conf b/opencontrail/files/3.0/collector/redis.conf
index a3b2c90..a196902 100644
--- a/opencontrail/files/3.0/collector/redis.conf
+++ b/opencontrail/files/3.0/collector/redis.conf
@@ -12,6 +12,26 @@
#
# units are case insensitive so 1GB 1Gb 1gB are all the same.
+################################## INCLUDES ###################################
+
+# Include one or more other config files here. This is useful if you
+# have a standard template that goes to all Redis server but also need
+# to customize a few per-server settings. Include files can include
+# other files, so use this wisely.
+#
+# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
+# from admin or Redis Sentinel. Since Redis always uses the last processed
+# line as value of a configuration directive, you'd better put includes
+# at the beginning of this file to avoid overwriting config change at runtime.
+#
+# If instead you are interested in using includes to override configuration
+# options, it is better to use include as the last line.
+#
+# include /path/to/local.conf
+# include /path/to/other.conf
+
+################################ GENERAL #####################################
+
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
@@ -24,9 +44,14 @@
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
-# If you want you can bind a single interface, if the bind option is not
-# specified all the interfaces will listen for incoming connections.
+# By default Redis listens for connections from all the network interfaces
+# available on the server. It is possible to listen to just one or multiple
+# interfaces using the "bind" configuration directive, followed by one or
+# more IP addresses.
#
+# Examples:
+#
+# bind 192.168.1.100 10.0.0.1
#bind 127.0.0.1
# Specify the path for the unix socket that will be used to listen for
@@ -63,7 +88,7 @@
# warning (only very important / critical messages are logged)
loglevel notice
-# Specify the log file name. Also 'stdout' can be used to force
+# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile /var/log/redis/redis-server.log
@@ -83,7 +108,7 @@
# dbid is a number between 0 and 'databases'-1
databases 16
-################################ SNAPSHOTTING #################################
+################################ SNAPSHOTTING ################################
#
# Save the DB on disk:
#
@@ -105,22 +130,22 @@
#
# save ""
-save 900 1
-save 300 10
-save 60 10000
+#save 900 1
+#save 300 10
+#save 60 10000
# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
-# This will make the user aware (in an hard way) that data is not persisting
+# This will make the user aware (in a hard way) that data is not persisting
# on disk properly, otherwise chances are that no one will notice and some
-# distater will happen.
+# disaster will happen.
#
# If the background saving process will start working again Redis will
# automatically allow writes again.
#
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
-# continue to work as usually even if there are problems with disk,
+# continue to work as usual even if there are problems with disk,
# permissions, and so forth.
stop-writes-on-bgsave-error yes
@@ -140,7 +165,7 @@
rdbchecksum yes
# The filename where to dump the DB
-dbfilename dump.rdb
+#dbfilename dump.rdb
# The working directory.
#
@@ -192,7 +217,7 @@
# Note: read only slaves are not designed to be exposed to untrusted clients
# on the internet. It's just a protection layer against misuse of the instance.
# Still a read only slave exports by default all the administrative commands
-# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve
+# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only slaves using 'rename-command' to shadow all the
# administrative / dangerous commands.
slave-read-only yes
@@ -203,8 +228,11 @@
#
# repl-ping-slave-period 10
-# The following option sets a timeout for both Bulk transfer I/O timeout and
-# master data or ping response timeout. The default value is 60 seconds.
+# The following option sets the replication timeout for:
+#
+# 1) Bulk transfer I/O during SYNC, from the point of view of slave.
+# 2) Master timeout from the point of view of slaves (data, pings).
+# 3) Slave timeout from the point of view of masters (REPLCONF ACK pings).
#
# It is important to make sure that this value is greater than the value
# specified for repl-ping-slave-period otherwise a timeout will be detected
@@ -227,13 +255,35 @@
# be a good idea.
repl-disable-tcp-nodelay no
+# Set the replication backlog size. The backlog is a buffer that accumulates
+# slave data when slaves are disconnected for some time, so that when a slave
+# wants to reconnect again, often a full resync is not needed, but a partial
+# resync is enough, just passing the portion of data the slave missed while
+# disconnected.
+#
+# The biggest the replication backlog, the longer the time the slave can be
+# disconnected and later be able to perform a partial resynchronization.
+#
+# The backlog is only allocated once there is at least a slave connected.
+#
+# repl-backlog-size 1mb
+
+# After a master has no longer connected slaves for some time, the backlog
+# will be freed. The following option configures the amount of seconds that
+# need to elapse, starting from the time the last slave disconnected, for
+# the backlog buffer to be freed.
+#
+# A value of 0 means to never release the backlog.
+#
+# repl-backlog-ttl 3600
+
# The slave priority is an integer number published by Redis in the INFO output.
# It is used by Redis Sentinel in order to select a slave to promote into a
# master if the master is no longer working correctly.
#
# A slave with a low priority number is considered better for promotion, so
# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
-# pick the one wtih priority 10, that is the lowest.
+# pick the one with priority 10, that is the lowest.
#
# However a special priority of 0 marks the slave as not able to perform the
# role of master, so a slave with priority of 0 will never be selected by
@@ -242,6 +292,28 @@
# By default the priority is 100.
slave-priority 100
+# It is possible for a master to stop accepting writes if there are less than
+# N slaves connected, having a lag less or equal than M seconds.
+#
+# The N slaves need to be in "online" state.
+#
+# The lag in seconds, that must be <= the specified value, is calculated from
+# the last ping received from the slave, that is usually sent every second.
+#
+# This option does not GUARANTEES that N replicas will accept the write, but
+# will limit the window of exposure for lost writes in case not enough slaves
+# are available, to the specified number of seconds.
+#
+# For example to require at least 3 slaves with a lag <= 10 seconds use:
+#
+# min-slaves-to-write 3
+# min-slaves-max-lag 10
+#
+# Setting one or the other to 0 disables the feature.
+#
+# By default min-slaves-to-write is set to 0 (feature disabled) and
+# min-slaves-max-lag is set to 10.
+
################################## SECURITY ###################################
# Require clients to issue AUTH <PASSWORD> before processing any other
@@ -291,7 +363,7 @@
# Don't use more memory than the specified amount of bytes.
# When the memory limit is reached Redis will try to remove keys
-# accordingly to the eviction policy selected (see maxmemmory-policy).
+# according to the eviction policy selected (see maxmemory-policy).
#
# If Redis can't remove keys according to the policy, or if the policy is
# set to 'noeviction', Redis will start to reply with errors to commands
@@ -299,7 +371,7 @@
# to reply to read-only commands like GET.
#
# This option is usually useful when using Redis as an LRU cache, or to set
-# an hard memory limit for an instance (using the 'noeviction' policy).
+# a hard memory limit for an instance (using the 'noeviction' policy).
#
# WARNING: If you have slaves attached to an instance with maxmemory on,
# the size of the output buffers needed to feed the slaves are subtracted
@@ -368,6 +440,7 @@
appendonly no
# The name of the append only file (default: "appendonly.aof")
+
appendfilename "appendonly.aof"
# The fsync() call tells the Operating System to actually write data on disk
@@ -415,6 +488,7 @@
#
# If you have latency problems turn this to "yes". Otherwise leave it as
# "no" that is the safest pick from the point of view of durability.
+
no-appendfsync-on-rewrite no
# Automatic rewrite of the append only file.
@@ -453,7 +527,7 @@
# termination of the script.
#
# Set it to 0 or a negative value for unlimited execution without warnings.
-lua-time-limit 5000
+lua-time-limit 15000
################################## SLOW LOG ###################################
@@ -555,7 +629,7 @@
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
# order to help rehashing the main Redis hash table (the one mapping top-level
# keys to values). The hash table implementation Redis uses (see dict.c)
-# performs a lazy rehashing: the more operation you run into an hash table
+# performs a lazy rehashing: the more operation you run into a hash table
# that is rehashing, the more rehashing "steps" are performed, so if the
# server is idle the rehashing is never complete and some more memory is used
# by the hash table.
@@ -581,7 +655,7 @@
#
# normal -> normal clients
# slave -> slave clients and MONITOR clients
-# pubsub -> clients subcribed to at least one pubsub channel or pattern
+# pubsub -> clients subscribed to at least one pubsub channel or pattern
#
# The syntax of every client-output-buffer-limit directive is the following:
#
@@ -610,10 +684,10 @@
client-output-buffer-limit pubsub 32mb 8mb 60
# Redis calls an internal function to perform many background tasks, like
-# closing connections of clients in timeot, purging expired keys that are
+# closing connections of clients in timeout, purging expired keys that are
# never requested, and so forth.
#
-# Not all tasks are perforemd with the same frequency, but Redis checks for
+# Not all tasks are performed with the same frequency, but Redis checks for
# tasks to perform accordingly to the specified "hz" value.
#
# By default "hz" is set to 10. Raising the value will use more CPU when
@@ -631,3 +705,4 @@
# in order to commit the file to the disk more incrementally and avoid
# big latency spikes.
aof-rewrite-incremental-fsync yes
+
diff --git a/opencontrail/files/3.0/config.global.js b/opencontrail/files/3.0/config.global.js
index ddb59bb..a6a252b 100644
--- a/opencontrail/files/3.0/config.global.js
+++ b/opencontrail/files/3.0/config.global.js
@@ -9,6 +9,12 @@
config.orchestration = {};
{%- if web.identity.engine == "keystone" %}
config.orchestration.Manager = 'openstack'
+
+{%- if web.identity.version == "3" %}
+config.multi_tenancy = {};
+config.multi_tenancy.enabled = true;
+{%- endif %}
+
{%- else %}
config.orchestration.Manager = 'none'
{%- endif %}
@@ -113,7 +119,7 @@
* If want to use with default apiVersion(v2.0), then can specify it as
* empty array.
******************************************************************************/
-config.identityManager.apiVersion = ['v2.0'];
+config.identityManager.apiVersion = ['v{{ web.identity.version }}'];
config.identityManager.strictSSL = false;
config.identityManager.ca = '';
diff --git a/opencontrail/files/3.0/contrail-vrouter-nodemgr.ini b/opencontrail/files/3.0/contrail-vrouter-nodemgr.ini
new file mode 100644
index 0000000..2ba3b63
--- /dev/null
+++ b/opencontrail/files/3.0/contrail-vrouter-nodemgr.ini
@@ -0,0 +1,39 @@
+; The below sample eventlistener section shows all possible
+; eventlistener subsection values, create one or more 'real'
+; eventlistener: sections to be able to handle event notifications
+; sent by supervisor.
+
+[eventlistener:contrail-vrouter-nodemgr]
+command=/bin/bash -c "exec python /usr/bin/contrail-nodemgr --nodetype=contrail-vrouter"
+events=PROCESS_COMMUNICATION,PROCESS_STATE,TICK_60
+;[eventlistener:theeventlistnername]
+;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
+;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
+;numprocs=1 ; number of processes copies to start (def 1)
+;events=EVENT ; event notif. types to subscribe to (req'd)
+buffer_size=10000 ; event buffer queue size (default 10)
+;directory=/tmp ; directory to cwd to before exec (def no cwd)
+;umask=022 ; umask for process (default None)
+;priority=-1 ; the relative start priority (default -1)
+;autostart=true ; start at supervisord start (default: true)
+;autorestart=unexpected ; whether/when to restart (default: unexpected)
+;startsecs=1 ; number of secs prog must stay running (def. 1)
+;startretries=3 ; max # of serial start failures (default 3)
+;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
+;stopsignal=QUIT ; signal used to kill process (default TERM)
+;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
+;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)
+;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
+;stdout_events_enabled=false ; emit events on stdout writes (default false)
+stderr_logfile=/var/log/contrail/contrail-vrouter-nodemgr-stderr.log ; stderr log path, NONE for none; default AUTO
+;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
+;stderr_logfile_backups ; # of stderr logfile backups (default 10)
+;stderr_events_enabled=false ; emit events on stderr writes (default false)
+;environment=A=1,B=2 ; process environment additions
+;serverurl=AUTO ; override serverurl computation (childutils)
+
diff --git a/opencontrail/map.jinja b/opencontrail/map.jinja
index 1be5ba6..7d0aefa 100644
--- a/opencontrail/map.jinja
+++ b/opencontrail/map.jinja
@@ -2,7 +2,7 @@
{% set common = salt['grains.filter_by']({
'Debian': {
'source': {'engine': 'pkg', 'address': 'http://'},
- 'pkgs': ['dpkg-dev','contrail-utils'],
+ 'pkgs': ['dpkg-dev','contrail-utils', 'contrail-nodemgr'],
},
'RedHat': {
'source': {'engine': 'pkg', 'address': 'http://'},