Midonet salt formula first version.

This commit is contained in:
marco 2016-06-10 10:40:50 +02:00
commit 0205f1ba53
32 changed files with 1051 additions and 0 deletions

0
README.md Normal file
View File

4
README.rst Normal file
View File

@ -0,0 +1,4 @@
=======
Midonet
=======

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.2

View File

@ -0,0 +1,19 @@
applications:
- midonet
classes:
- service.midonet.support
parameters:
_param:
midonet_version: v5.0
midonet:
compute:
version: ${_param:midonet_version}
enterprise:
enabled: true
enabled: true
zookeeper:
members:
- host: ${_param:cluster_node01_address}
- host: ${_param:cluster_node02_address}
- host: ${_param:cluster_node03_address}
template: medium

View File

@ -0,0 +1,14 @@
applications:
- midonet
classes:
- service.midonet.support
parameters:
_param:
midonet_version: v5.0
midonet:
analytics:
version: ${_param:midonet_version}
enterprise:
enabled: true
enabled: true
host: ${_param:single_address}

View File

@ -0,0 +1,37 @@
applications:
- midonet
classes:
- service.midonet.support
parameters:
_param:
midonet_version: v5.0
midonet:
control:
version: ${_param:midonet_version}
enterprise:
enabled: true
enabled: true
host: ${_param:cluster_vip_address}
nova:
control:
host: ${_param:cluster_vip_address}
database:
members:
- host: ${_param:cluster_node01_address}
port: 9160
- host: ${_param:cluster_node02_address}
port: 9160
- host: ${_param:cluster_node03_address}
port: 9160
zookeeper:
members:
- host: ${_param:cluster_node01_address}
- host: ${_param:cluster_node02_address}
- host: ${_param:cluster_node03_address}
identity:
user: midonet
password: ${_param:keystone_midonet_password}
host: ${_param:cluster_vip_address}
admin:
token: ${_param:keystone_service_token}
password: ${_param:keystone_admin_password}

View File

View File

@ -0,0 +1,15 @@
applications:
- midonet
classes:
- service.midonet.support
parameters:
_param:
midonet_version: v5.0
midonet:
web:
version: ${_param:midonet_version}
enabled: true
api:
host: ${_param:cluster_vip_address}
analytics:
host: ${_param:midonet_analytics_address}

View File

@ -0,0 +1,19 @@
applications:
- midonet
classes:
- service.midonet.support
parameters:
_param:
midonet_version: v5.0
midonet:
gateway:
version: ${_param:midonet_version}
enterprise:
enabled: true
enabled: true
zookeeper:
members:
- host: ${_param:cluster_node01_address}
- host: ${_param:cluster_node02_address}
- host: ${_param:cluster_node03_address}
template: medium

View File

@ -0,0 +1,11 @@
parameters:
midonet:
_support:
collectd:
enabled: false
heka:
enabled: false
sensu:
enabled: true
sphinx:
enabled: true

22
midonet/analytics.sls Normal file
View File

@ -0,0 +1,22 @@
{%- from "midonet/map.jinja" import analytics with context %}
{%- if analytics.enabled %}
midonet_analytics_packages:
pkg.installed:
- names: {{ analytics.pkgs }}
/etc/midonet/analytics_settings.conf:
file.managed:
- source: salt://midonet/files/{{ analytics.version }}/analytics_settings.conf
- template: jinja
- require:
- pkg: midonet_analytics_packages
- makedirs: true
midonet_analytics_setting:
cmd.run:
- name: mn-conf set -t default < /etc/midonet/analytics_settings.conf
- require:
- file: /etc/midonet/analytics_settings.conf
{%- endif %}

43
midonet/compute.sls Normal file
View File

@ -0,0 +1,43 @@
{%- from "midonet/map.jinja" import compute with context %}
{%- if compute.enabled %}
midonet_compute_packages:
pkg.installed:
- names: {{ compute.pkgs }}
/etc/midolman/midolman.conf:
file.managed:
- source: salt://midonet/files/{{ compute.version }}/midolman.conf.compute
- template: jinja
- require:
- pkg: midonet_compute_packages
/etc/midolman/midolman-env.sh:
file.managed:
- source: salt://midonet/files/{{ compute.version }}/midolman-env.sh.compute
- template: jinja
- require:
- pkg: midonet_compute_packages
midonet_configure_template:
cmd.run:
- name: mn-conf template-set -h local -t agent-compute-{{ compute.template }}
- require:
- file: /etc/midolman/midolman.conf
midonet_compute_services:
service.running:
- names: {{ compute.services }}
- enable: true
- watch:
- file: /etc/midolman/midolman.conf
{%- if compute.enterprise.enabled %}
midonet_enterprise_packages:
pkg.installed:
- names:
- midonet-jmxscraper
{%- endif %}
{%- endif %}

50
midonet/control.sls Normal file
View File

@ -0,0 +1,50 @@
{%- from "midonet/map.jinja" import control with context %}
{%- if control.enabled %}
midonet_control_packages:
pkg.installed:
- names: {{ control.pkgs }}
/etc/midonet/midonet.conf:
file.managed:
- source: salt://midonet/files/{{ control.version }}/midonet.conf
- template: jinja
- require:
- pkg: midonet_control_packages
/etc/midonet/default.json:
file.managed:
- source: salt://midonet/files/{{ control.version }}/default.json
- template: jinja
- require:
- pkg: midonet_control_packages
midonet_initial_setting:
cmd.run:
- name: cat /etc/midonet/default.json | mn-conf set -t default
- require:
- file: /etc/midonet/default.json
/root/.midonetrc:
file.managed:
- source: salt://midonet/files/{{ control.version }}/midonetrc
- template: jinja
- require:
- pkg: midonet_control_packages
midonet_control_services:
service.running:
- names: {{ control.services }}
- enable: true
- watch:
- file: /etc/midonet/midonet.conf
{%- if control.enterprise.enabled %}
midonet_enterprise_packages:
pkg.installed:
- names:
- midonet-cluster-mem
{%- endif %}
{%- endif %}

View File

@ -0,0 +1,17 @@
{%- from "midonet/map.jinja" import compute with context %}
#!/bin/bash -e
cat /srv/salt/pillar/midonet-compute.sls | envsubst > /tmp/midonet-computer.sls
mv /tmp/midonet-compute.sls /srv/salt/pillar/midonet-compute.sls
salt-call --local --retcode-passthrough state.highstate
{% for service in compute.services %}
service {{ service }} stop || true
{% endfor %}
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Djava.library.path=/lib:/usr/lib -cp /usr/share/midolman/midolman.jar -XX:+AggressiveOpts -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms$MAX_HEAP_SIZE -Xmx$MAX_HEAP_SIZE -XX:HeapDumpPath=/var/log/midolman/ -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill;-3;%p" -XX:-UseBiasedLocking -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:InitiatingHeapOccupancyPercent=70 -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=8 -XX:+UseTLAB -XX:+ResizeTLAB -XX:TLABSize=2m -XX:PretenureSizeThreshold=2m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintClassHistogram -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -Xloggc:/var/log/midolman/gc-20160615_101957.log -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only= -Dcom.sun.management.jmxremote.port=7200 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=$HOSTNAME -Dmidolman.log.dir=/var/log/midolman/ -Dlogback.configurationFile=/etc/midolman/logback.xml org.midonet.midolman.Midolman -c /etc/midolman/midolman.conf
{#-
vim: syntax=jinja
-#}

View File

@ -0,0 +1,17 @@
{%- from "midonet/map.jinja" import control with context %}
#!/bin/bash -e
cat /srv/salt/pillar/midonet-control.sls | envsubst > /tmp/midonet-control.sls
mv /tmp/midonet-control.sls /srv/salt/pillar/midonet-control.sls
salt-call --local --retcode-passthrough state.highstate
{% for service in control.services %}
service {{ service }} stop || true
{% endfor %}
/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -Djava.library.path=/lib:/usr/lib -cp /etc/midonet-cluster:/usr/share/midonet-cluster/midonet-cluster.jar:/usr/share/midonet-cluster/addons/* -XX:+AggressiveOpts -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms$MAX_HEAP_SIZE -Xmx$MAX_HEAP_SIZE -Xmn$HEAP_NEWSIZE -XX:HeapDumpPath=/var/log/midonet-cluster/ -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill;-3;%p" -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=6 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseTLAB -XX:+ResizeTLAB -XX:TLABSize=2m -XX:PretenureSizeThreshold=2m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only= -Dcom.sun.management.jmxremote.port=7201 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=$HOSTNAME -Dmidonet-cluster.log.dir=/var/log/midonet-cluster/ -Dconfig.file= -Dlogback.configurationFile=/etc/midonet-cluster/logback.xml org.midonet.cluster.ClusterNode /etc/midonet/midonet.conf
{#-
vim: syntax=jinja
-#}

View File

@ -0,0 +1,17 @@
{%- from "midonet/map.jinja" import gateway with context %}
#!/bin/bash -e
cat /srv/salt/pillar/midonet-gateway.sls | envsubst > /tmp/midonet-gateway.sls
mv /tmp/midonet-gateway.sls /srv/salt/pillar/midonet-gateway.sls
salt-call --local --retcode-passthrough state.highstate
{% for service in gateway.services %}
service {{ service }} stop || true
{% endfor %}
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Djava.library.path=/lib:/usr/lib -cp /usr/share/midolman/midolman.jar -XX:+AggressiveOpts -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms$MAX_HEAP_SIZE -Xmx$MAX_HEAP_SIZE -XX:HeapDumpPath=/var/log/midolman/ -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill;-3;%p" -XX:-UseBiasedLocking -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:InitiatingHeapOccupancyPercent=70 -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=8 -XX:+UseTLAB -XX:+ResizeTLAB -XX:TLABSize=2m -XX:PretenureSizeThreshold=2m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintClassHistogram -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -Xloggc:/var/log/midolman/gc-20160615_101957.log -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only= -Dcom.sun.management.jmxremote.port=7200 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=$HOSTNAME -Dmidolman.log.dir=/var/log/midolman/ -Dlogback.configurationFile=/etc/midolman/logback.xml org.midonet.midolman.Midolman -c /etc/midolman/midolman.conf
{#-
vim: syntax=jinja
-#}

View File

@ -0,0 +1,17 @@
{%- from "midonet/map.jinja" import web with context %}
#!/bin/bash -e
cat /srv/salt/pillar/midonet-web.sls | envsubst > /tmp/midonet-web.sls
mv /tmp/midonet-web.sls /srv/salt/pillar/midonet-web.sls
salt-call --local --retcode-passthrough state.highstate
{% for service in web.services %}
service {{ service }} stop || true
{% endfor %}
/usr/sbin/apache2 -k start
{#-
vim: syntax=jinja
-#}

View File

@ -0,0 +1,17 @@
{%- from "midonet/map.jinja" import analytics with context %}
clio.enabled : true
clio.service.udp_port : 5001
clio.service.encoding : "binary"
clio.target.udp_endpoint : "{{ analytics.host }}:5000"
clio.data.fields : [ "cookie", "devices", "host_uuid", "in_port", "in_tenant", "out_ports", "out_tenant", "match_eth_src", "match_eth_dst", "match_ethertype", "match_network_dst", "match_network_src", "match_network_proto", "match_src_port", "match_dst_port", "action_drop", "action_arp_sip", "action_arp_tip", "action_arp_op", "rules", "sim_result", "final_eth_src", "final_eth_dst", "final_net_src", "final_net_dst", "final_transport_src", "final_transport_dst", "timestamp", "type" ]
calliope.enabled : true
calliope.service.ws_port : 8080
calliope.auth.ssl.enabled : true
jmxscraper.enabled : true
jmxscraper.target.udp_endpoint : "{{ analytics.host }}:5000"
mem_cluster.flow_tracing.enabled : true
mem_cluster.flow_tracing.service.ws_port : 8460
mem_cluster.flow_tracing.auth.ssl.enabled : true
agent.flow_history.enabled : true
agent.flow_history.encoding : "binary"
agent.flow_history.udp_endpoint : "{{ analytics.host }}:5001"

View File

@ -0,0 +1,14 @@
{%- from "midonet/map.jinja" import web with context %}
{
"api_host": "http://{{ web.api.host }}:8181",
"login_host": "http://{{ web.api.host }}:8181",
"trace_api_host": "http://{{ web.api.host }}:8181",
"traces_ws_url": "wss://{{ web.analytics.host }}:8460/trace",
"api_namespace": "midonet-api",
"api_version": "5.0",
"api_token": false,
"agent_config_api_namespace": "conf",
"analytics_ws_api_url": "wss://{{ web.analytics.host }}:8080/analytics",
"poll_enabled": true,
"login_animation_enabled": true
}

View File

@ -0,0 +1,24 @@
{%- from "midonet/map.jinja" import control with context %}
zookeeper {
zookeeper_hosts = "{% for member in control.zookeeper.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}"
}
cassandra {
servers = "{% for member in control.database.members %}{{ member.host }}{% if not loop.last %},{% endif %}{% endfor %}"
replication_factor : 3
}
cluster.auth {
provider_class = "org.midonet.cluster.auth.keystone.KeystoneService"
admin_role = "admin"
keystone.tenant_name = "admin"
keystone.admin_token = "{{ control.identity.admin.token }}"
keystone.host = {{ control.identity.host }}
keystone.port = 35357
}
agent {
openstack {
metadata {
nova_metadata_url : "http://{{ control.nova.control.host }}:8775"
enabled : true
}
}
}

View File

@ -0,0 +1,116 @@
{%- from "midonet/map.jinja" import compute with context %}
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
MIDO_HOME=/usr/share/midolman
MIDO_CFG=/etc/midolman
MIDO_LOG_DIR=/var/log/midolman/
MIDO_DEBUG_PORT=8001
JMX_PORT="7200"
MIDO_CFG_FILE=midolman.conf
QUAGGA_DIR=/var/run/quagga
# setting this option will make the agent not run under the watchdog
#WATCHDOG_DISABLE=
WATCHDOG_TIMEOUT=10
# Amount of memory to allocate for the JVM heap.
MAX_HEAP_SIZE="{%-if compute.template == 'medium' %}2048{%- else %}4096{%- endif %}M"
# Here we create the arguments that will get passed to the jvm when
# starting midolman.
# enable assertions. disabling this in production will give a modest
# performance benefit (around 5%).
# JVM_OPTS="$JVM_OPTS -ea"
JVM_OPTS="$JVM_OPTS -XX:+AggressiveOpts"
# enable thread priorities, primarily so we can give periodic tasks
# a lower priority to avoid interfering with client workload
JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities"
# allows lowering thread priority without being root. see
# http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42"
# min and max heap sizes should be set to the same value to avoid
# stop-the-world GC pauses during resize, and so that we can lock the
# heap in memory on startup to prevent any of it from being swapped
# out.
JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=/var/log/midolman/"
JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JVM_OPTS="$JVM_OPTS -XX:OnOutOfMemoryError=\"kill;-3;%p\""
# Do not use biased locking
JVM_OPTS="$JVM_OPTS -XX:-UseBiasedLocking"
# GC tuning options
JVM_OPTS="$JVM_OPTS -XX:+UseG1GC"
JVM_OPTS="$JVM_OPTS -XX:MaxGCPauseMillis=500"
JVM_OPTS="$JVM_OPTS -XX:InitiatingHeapOccupancyPercent=70"
JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8"
JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=8"
JVM_OPTS="$JVM_OPTS -XX:+UseTLAB"
JVM_OPTS="$JVM_OPTS -XX:+ResizeTLAB"
JVM_OPTS="$JVM_OPTS -XX:TLABSize=2m"
JVM_OPTS="$JVM_OPTS -XX:PretenureSizeThreshold=2m"
# GC logging options
JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails"
JVM_OPTS="$JVM_OPTS -XX:+PrintGCTimeStamps"
JVM_OPTS="$JVM_OPTS -XX:+PrintClassHistogram"
JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution"
JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime"
JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation"
JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10"
JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M"
JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/midolman/gc-`date +%Y%m%d_%H%M%S`.log"
# uncomment to have Midolman JVM listen for remote debuggers/profilers on port 1414
# JVM_OPTS="$JVM_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414"
# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
# comment out this entry to enable IPv6 support).
# JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
# uncomment to disable JMX
# JMXDISABLE=true
# jmx: metrics and administration interface
#
# add this if you're having trouble connecting:
# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"
#
# see
# http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
# for more on configuring JMX through firewalls, etc. (Short version:
# get it working with no firewall first.)
if [ "x$JMXDISABLE" = "x" ] ; then
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
HOSTNAME=`hostname`
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=$HOSTNAME"
fi
if [ "$MIDOLMAN_HPROF" = "1" ] ; then
DATE=$(date +'%H%M%S')
HPROF_FILENAME=${HPROF_FILENAME:-/tmp/midolman-$DATE.hprof}
JVM_OPTS="$JVM_OPTS -agentlib:hprof=cpu=samples,depth=100,interval=1,lineno=y,thread=y,file=$HPROF_FILENAME"
fi

View File

@ -0,0 +1,116 @@
{%- from "midonet/map.jinja" import gateway with context %}
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
MIDO_HOME=/usr/share/midolman
MIDO_CFG=/etc/midolman
MIDO_LOG_DIR=/var/log/midolman/
MIDO_DEBUG_PORT=8001
JMX_PORT="7200"
MIDO_CFG_FILE=midolman.conf
QUAGGA_DIR=/var/run/quagga
# setting this option will make the agent not run under the watchdog
#WATCHDOG_DISABLE=
WATCHDOG_TIMEOUT=10
# Amount of memory to allocate for the JVM heap.
MAX_HEAP_SIZE="{%-if gateway.template == 'medium' %}8192{%- else %}10240{%- endif %}M"
# Here we create the arguments that will get passed to the jvm when
# starting midolman.
# enable assertions. disabling this in production will give a modest
# performance benefit (around 5%).
# JVM_OPTS="$JVM_OPTS -ea"
JVM_OPTS="$JVM_OPTS -XX:+AggressiveOpts"
# enable thread priorities, primarily so we can give periodic tasks
# a lower priority to avoid interfering with client workload
JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities"
# allows lowering thread priority without being root. see
# http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html
JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42"
# min and max heap sizes should be set to the same value to avoid
# stop-the-world GC pauses during resize, and so that we can lock the
# heap in memory on startup to prevent any of it from being swapped
# out.
JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"
JVM_OPTS="$JVM_OPTS -Xmx${MAX_HEAP_SIZE}"
JVM_OPTS="$JVM_OPTS -XX:HeapDumpPath=/var/log/midolman/"
JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JVM_OPTS="$JVM_OPTS -XX:OnOutOfMemoryError=\"kill;-3;%p\""
# Do not use biased locking
JVM_OPTS="$JVM_OPTS -XX:-UseBiasedLocking"
# GC tuning options
JVM_OPTS="$JVM_OPTS -XX:+UseG1GC"
JVM_OPTS="$JVM_OPTS -XX:MaxGCPauseMillis=500"
JVM_OPTS="$JVM_OPTS -XX:InitiatingHeapOccupancyPercent=70"
JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8"
JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=8"
JVM_OPTS="$JVM_OPTS -XX:+UseTLAB"
JVM_OPTS="$JVM_OPTS -XX:+ResizeTLAB"
JVM_OPTS="$JVM_OPTS -XX:TLABSize=2m"
JVM_OPTS="$JVM_OPTS -XX:PretenureSizeThreshold=2m"
# GC logging options
JVM_OPTS="$JVM_OPTS -XX:+PrintGCDetails"
JVM_OPTS="$JVM_OPTS -XX:+PrintGCTimeStamps"
JVM_OPTS="$JVM_OPTS -XX:+PrintClassHistogram"
JVM_OPTS="$JVM_OPTS -XX:+PrintTenuringDistribution"
JVM_OPTS="$JVM_OPTS -XX:+PrintGCApplicationStoppedTime"
JVM_OPTS="$JVM_OPTS -XX:+UseGCLogFileRotation"
JVM_OPTS="$JVM_OPTS -XX:NumberOfGCLogFiles=10"
JVM_OPTS="$JVM_OPTS -XX:GCLogFileSize=10M"
JVM_OPTS="$JVM_OPTS -Xloggc:/var/log/midolman/gc-`date +%Y%m%d_%H%M%S`.log"
# uncomment to have Midolman JVM listen for remote debuggers/profilers on port 1414
# JVM_OPTS="$JVM_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414"
# Prefer binding to IPv4 network intefaces (when net.ipv6.bindv6only=1). See
# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561 (short version:
# comment out this entry to enable IPv6 support).
# JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
# uncomment to disable JMX
# JMXDISABLE=true
# jmx: metrics and administration interface
#
# add this if you're having trouble connecting:
# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"
#
# see
# http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
# for more on configuring JMX through firewalls, etc. (Short version:
# get it working with no firewall first.)
if [ "x$JMXDISABLE" = "x" ] ; then
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
HOSTNAME=`hostname`
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=$HOSTNAME"
fi
if [ "$MIDOLMAN_HPROF" = "1" ] ; then
DATE=$(date +'%H%M%S')
HPROF_FILENAME=${HPROF_FILENAME:-/tmp/midolman-$DATE.hprof}
JVM_OPTS="$JVM_OPTS -agentlib:hprof=cpu=samples,depth=100,interval=1,lineno=y,thread=y,file=$HPROF_FILENAME"
fi

View File

@ -0,0 +1,32 @@
{%- from "midonet/map.jinja" import compute with context %}
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################
#
# DEPRECATION NOTICE
#
#
# This file is DEPRECATED. Although FULLY backwards compatible.
#
# The two values found here will only be used by MidoNet to
# find the zookeeper server that holds MidoNet configuration.
#
# Please read mn-conf(1) for further details.
#
# You can import your midolman.conf configuration into the
# new system by running `mn-conf import`. (Check the manual
# page for usage example and details).
#
#
########################################################################
[zookeeper]
zookeeper_hosts = {% for member in compute.zookeeper.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}

View File

@ -0,0 +1,32 @@
{%- from "midonet/map.jinja" import gateway with context %}
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################
#
# DEPRECATION NOTICE
#
#
# This file is DEPRECATED. Although FULLY backwards compatible.
#
# The two values found here will only be used by MidoNet to
# find the zookeeper server that holds MidoNet configuration.
#
# Please read mn-conf(1) for further details.
#
# You can import your midolman.conf configuration into the
# new system by running `mn-conf import`. (Check the manual
# page for usage example and details).
#
#
########################################################################
[zookeeper]
zookeeper_hosts = {% for member in gateway.zookeeper.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}

View File

@ -0,0 +1,17 @@
{%- from "midonet/map.jinja" import control with context %}
# Copyright 2015 Midokura SARL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[zookeeper]
zookeeper_hosts = {% for member in control.zookeeper.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}

View File

@ -0,0 +1,6 @@
{%- from "midonet/map.jinja" import control with context %}
[cli]
api_url = http://{{ control.identity.host }}:8181/midonet-api
username = admin
password = {{ control.identity.admin.password }}
project_id = admin

43
midonet/gateway.sls Normal file
View File

@ -0,0 +1,43 @@
{%- from "midonet/map.jinja" import gateway with context %}
{%- if gateway.enabled %}
midonet_gateway_packages:
pkg.installed:
- names: {{ gateway.pkgs }}
/etc/midolman/midolman.conf:
file.managed:
- source: salt://midonet/files/{{ gateway.version }}/midolman.conf.gateway
- template: jinja
- require:
- pkg: midonet_gateway_packages
/etc/midolman/midolman-env.sh:
file.managed:
- source: salt://midonet/files/{{ gateway.version }}/midolman-env.sh.gateway
- template: jinja
- require:
- pkg: midonet_gateway_packages
midonet_configure_template:
cmd.run:
- name: mn-conf template-set -h local -t agent-gateway-{{ gateway.template }}
- require:
- file: /etc/midolman/midolman.conf
midonet_gateway_services:
service.running:
- names: {{ gateway.services }}
- enable: true
- watch:
- file: /etc/midolman/midolman.conf
{%- if compute.enterprise.enabled %}
midonet_enterprise_packages:
pkg.installed:
- names:
- midonet-jmxscraper
{%- endif %}
{%- endif %}

17
midonet/init.sls Normal file
View File

@ -0,0 +1,17 @@
include:
{% if pillar.midonet.compute is defined %}
- midonet.compute
{% endif %}
{% if pillar.midonet.control is defined %}
- midonet.control
{% endif %}
{% if pillar.midonet.gateway is defined %}
- midonet.gateway
{% endif %}
{% if pillar.midonet.web is defined %}
- midonet.web
{% endif %}
{% if pillar.midonet.analytics is defined %}
- midonet.analytics
{% endif %}

55
midonet/map.jinja Normal file
View File

@ -0,0 +1,55 @@
{% set compute = salt['grains.filter_by']({
'Debian': {
'pkgs': ['openjdk-8-jre-headless', 'midolman', 'nova-network'],
'services': ['midolman']
},
'RedHat': {
'pkgs': [],
'services': []
},
}, merge=salt['pillar.get']('midonet:compute')) %}
{% set gateway = salt['grains.filter_by']({
'Debian': {
'pkgs': ['openjdk-8-jre-headless','midolman'],
'services': ['midolman']
},
'RedHat': {
'pkgs': [],
'services': []
},
}, merge=salt['pillar.get']('midonet:gateway')) %}
{% set control = salt['grains.filter_by']({
'Debian': {
'pkgs': ['midonet-cluster','python-midonetclient'],
'services': ['midonet-cluster']
},
'RedHat': {
'pkgs': [],
'services': []
},
}, merge=salt['pillar.get']('midonet:control')) %}
{% set web = salt['grains.filter_by']({
'Debian': {
'pkgs': ['midonet-manager'],
'services': ['apache2']
},
'RedHat': {
'pkgs': [],
'services': []
},
}, merge=salt['pillar.get']('midonet:web')) %}
{% set analytics = salt['grains.filter_by']({
'Debian': {
'pkgs': ['midonet-tools', 'midonet-analytics', 'python-elasticsearch-curator'],
'services': []
},
'RedHat': {
'pkgs': [],
'services': []
},
}, merge=salt['pillar.get']('midonet:analytics')) %}

61
midonet/meta/sensu.yml Normal file
View File

@ -0,0 +1,61 @@
check:
local_system_cassandra_proc:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -a '/usr/share/cassandra' -u root -w 5 -c 10"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-database
local_contrail_ifmap_proc:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -C ifmap-server -u contrail -c 1:1"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-config
local_contrail_analytics:
command: "PATH=$PATH:/etc/sensu/plugins check_contrail_analytics.sh"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-collector
local_contrail_database:
command: "PATH=$PATH:/etc/sensu/plugins check_contrail_database.sh"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-database
local_contrail_config:
command: "PATH=$PATH:/etc/sensu/plugins check_contrail_config.sh"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-config
local_contrail_control:
command: "PATH=$PATH:/etc/sensu/plugins check_contrail_control.sh"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-control
local_contrail_vrouter:
command: "PATH=$PATH:/etc/sensu/plugins check_vrouter.sh"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-compute
local_contrail_vrouter_agent_proc:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -a '/usr/bin/contrail-vrouter-agent' -u root -c 1:1"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-compute
local_contrail_supervisord_proc:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -a '/usr/bin/supervisord' -u root -c 2:2"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-compute
local_contrail_api:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_http -H 0.0.0.0 -p 9100 -w 5 -c 10 -e 401"
interval: 60
occurrences: 1
subscribers:
- local-opencontrail-config

176
midonet/meta/sphinx.yml Normal file
View File

@ -0,0 +1,176 @@
doc:
name: OpenContrail
description: OpenContrail is an open source network virtualization platform for the cloud.
role:
{%- if pillar.opencontrail.config is defined %}
{%- from "opencontrail/map.jinja" import config with context %}
config:
name: config
param:
bind:
value: {{ config.bind.address }}
discovery:
name: "Discovery host"
value: {{ config.discovery.host }}
analytics:
name: "Analytics host"
value: {{ config.analytics.host }}
cache:
name: "Cache host"
value: {{ config.cache.host }}
version:
name: "Contrail version"
value: {{ config.version }}
database_host:
name: "Database members"
value: {% for member in config.database.members %}{{ member.host }}:{{ member.port }} {% endfor %}
network_host:
name: "Network service"
value: {{ config.network.host }}:{{ config.network.port }}
message_queue_ip:
name: "Message queue"
value: {{ config.message_queue.host }}:{{ config.message_queue.port }}
identity_host:
name: "Identity host ip"
value: {{ config.identity.user }}@{{ config.identity.host }}:{{ config.identity.port }}
packages:
value: |
{%- for pkg in config.pkgs %}
{%- set pkg_version = "dpkg -l "+pkg+" | grep "+pkg+" | awk '{print $3}'" %}
* {{ pkg }}: {{ salt['cmd.run'](pkg_version) }}
{%- endfor %}
{%- endif %}
{%- if pillar.opencontrail.control is defined %}
{%- from "opencontrail/map.jinja" import control with context %}
control:
name: control
param:
bind:
value: {{ control.bind.address }}
discovery:
name: "Discovery host"
value: {{ control.discovery.host }}
master:
name: "Master host"
value: {{ control.master.host }}
version:
name: "Contrail version"
value: {{ control.version }}
database_host:
name: "Database members"
value: {% for member in control.members %}{{ member.host }},{% endfor %}
packages:
value: |
{%- for pkg in control.pkgs %}
{%- set pkg_version = "dpkg -l "+pkg+" | grep "+pkg+" | awk '{print $3}'" %}
* {{ pkg }}: {{ salt['cmd.run'](pkg_version) }}
{%- endfor %}
{%- endif %}
{%- if pillar.opencontrail.database is defined %}
{%- from "opencontrail/map.jinja" import database with context %}
database:
name: database
param:
bind:
value: {{ database.bind.host }}{{ database.bind.port }}
discovery:
name: "Discovery host"
value: {{ database.discovery.host }}
version:
name: "Contrail version"
value: {{ database.version }}
data_dirs:
name: "Data dir for cassandra"
value: {{ database.data_dirs }}
database_host:
name: "Database members"
value: {% for member in database.members %}{{ member.host }},{% endfor %}
packages:
value: |
{%- for pkg in database.pkgs %}
{%- set pkg_version = "dpkg -l "+pkg+" | grep "+pkg+" | awk '{print $3}'" %}
* {{ pkg }}: {{ salt['cmd.run'](pkg_version) }}
{%- endfor %}
{%- endif %}
{%- if pillar.opencontrail.web is defined %}
{%- from "opencontrail/map.jinja" import web with context %}
web:
name: web
param:
bind:
value: {{ web.bind.address }}
analytics:
name: "Analytics host"
value: {{ web.analytics.host }}
cache:
name: "Cache host"
value: {{ web.cache.host }}{{ web.cache.port }}
version:
name: "Contrail version"
value: {{ web.version }}
identity_host:
name: "Identity host ip"
value: {{ web.identity.user }}@{{ web.identity.host }}:{{ web.identity.port }}
database_host:
name: "Database members"
value: {% for member in web.members %}{{ member.host }},{% endfor %}
packages:
value: |
{%- for pkg in web.pkgs %}
{%- set pkg_version = "dpkg -l "+pkg+" | grep "+pkg+" | awk '{print $3}'" %}
* {{ pkg }}: {{ salt['cmd.run'](pkg_version) }}
{%- endfor %}
{%- endif %}
{%- if pillar.opencontrail.collector is defined %}
{%- from "opencontrail/map.jinja" import collector with context %}
analytics:
name: analytics
param:
bind:
value: {{ collector.bind.address }}
discovery:
name: "Discovery host"
value: {{ collector.discovery.host }}
data_ttl:
name: "Data TTL hours"
value: {{ collector.data_ttl }}
version:
name: "Contrail version"
value: {{ collector.version }}
database_host:
name: "Database members"
value: {% for member in collector.database.members %}{{ member.host }}:{{ member.port }} {% endfor %}
packages:
value: |
{%- for pkg in collector.pkgs %}
{%- set pkg_version = "dpkg -l "+pkg+" | grep "+pkg+" | awk '{print $3}'" %}
* {{ pkg }}: {{ salt['cmd.run'](pkg_version) }}
{%- endfor %}
{%- endif %}
{%- if pillar.opencontrail.compute is defined %}
{%- from "opencontrail/map.jinja" import compute with context %}
vrouter:
name: vrouter
param:
discovery:
name: "Discovery host"
value: {{ compute.discovery.host }}
disable_flow_collection:
name: "Disable flow collection"
value: {{ compute.disable_flow_collection }}
version:
name: "Contrail version"
value: {{ compute.version }}
compute_interface:
name: vrouter vhost0 interface
value: |
* interface binded: {{ compute.interface.dev }}
* ip address: {{ compute.interface.address }}
* MTU: {{ compute.interface.mtu }}
packages:
value: |
{%- for pkg in compute.pkgs %}
{%- set pkg_version = "dpkg -l "+pkg+" | grep "+pkg+" | awk '{print $3}'" %}
* {{ pkg }}: {{ salt['cmd.run'](pkg_version) }}
{%- endfor %}
{%- endif %}

22
midonet/web.sls Normal file
View File

@ -0,0 +1,22 @@
{%- from "midonet/map.jinja" import web with context %}
{%- if web.enabled %}
midonet_web_packages:
pkg.installed:
- names: {{ web.pkgs }}
/var/www/html/midonet-manager/config/client.js:
file.managed:
- source: salt://midonet/files/{{ web.version }}/client.js
- template: jinja
- require:
- pkg: midonet_web_packages
midonet_web_services:
service.running:
- names: {{ web.services }}
- enable: true
- watch:
- file: /var/www/html/midonet-manager/config/client.js
{%- endif %}