Permalink
Browse files

initial barclamp files checkin

  • Loading branch information...
1 parent 60c3c79 commit 0dca1a6a36aac43b7b85d9222556b78dd9d21d93 Richard Yuan committed Mar 15, 2012
View
@@ -1,5 +1,6 @@
Welcome to a Barclamp for the Crowbar Framework project
=======================================================
+_Copyright 2011, Dell, Inc._
The code and documentation is distributed under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html). Contributions back to the source are encouraged.
@@ -8,7 +9,18 @@ A Barclamp is a module component that implements functionality for Crowbar. Cor
* This functonality of this barclamp DOES NOT stand alone, the Crowbar Framework is required *
-About this barclamp
--------------------
+About this Barclamp-Quantum
+-------------------------------------
Information for this barclamp is maintained on the Crowbar Framework Wiki: https://github.com/dellcloudedge/crowbar/wiki
+
+This is based on OpenStack.org distribution
+
+
+Legals
+-------------------------------------
+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.
View
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+# Copyright 2011, Dell
+#
+# 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.
+#
+
+
+require File.join(File.expand_path(File.dirname(__FILE__)), "barclamp_lib")
+@barclamp = "quantum"
+@timeout = 3600
+
+main
@@ -0,0 +1,2 @@
+This cookbook deployes the openstack quantum server and client
+
@@ -0,0 +1,33 @@
+
+# Copyright (c) 2011 Dell Inc.
+#
+# 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.
+#
+
+default[:quantum][:debug] = true
+default[:quantum][:verbose] = true
+
+default[:quantum][:db][:database] = "quantum"
+default[:quantum][:db][:user] = "quantum"
+default[:quantum][:db][:password] = "" # Set by Recipe
+
+default[:quantum][:api][:service_port] = "9696"
+default[:quantum][:api][:service_host] = "0.0.0.0"
+
+
+default[:quantum][:sql][:idle_timeout] = 30
+default[:quantum][:sql][:min_pool_size] = 5
+default[:quantum][:sql][:max_pool_size] = 10
+default[:quantum][:sql][:pool_timeout] = 200
+
+
@@ -0,0 +1,41 @@
+{
+ "replacing": {
+
+ },
+ "platforms": {
+
+ },
+ "license": "Apache 2.0 License, Copyright (c) 2011 Dell Inc. - http://www.apache.org/licenses/LICENSE-2.0",
+ "maintainer_email": "crowbar@Dell.com",
+ "groupings": {
+
+ },
+ "recommendations": {
+
+ },
+ "suggestions": {
+
+ },
+ "description": "Openstack Quantum server deployment recipes.",
+ "version": "1.0.0",
+ "conflicting": {
+
+ },
+ "attributes": {
+
+ },
+ "long_description": "This cookbook deployes the openstack quantum networking service for nova-network\r\n ",
+ "name": "quantum",
+ "recipes": {
+
+ },
+ "providing": {
+
+ },
+ "dependencies": {
+ "apt": [
+
+ ]
+ },
+ "maintainer": "Dell, Inc."
+}
@@ -0,0 +1,10 @@
+maintainer "Dell, Inc."
+maintainer_email "crowbar@Dell.com"
+license "Apache 2.0 License, Copyright (c) 2011 Dell Inc. - http://www.apache.org/licenses/LICENSE-2.0"
+description "Openstack Quantum server deployment recipes."
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "1.0"
+
+depends "openssl"
+depends "mysql"
+depends "nagios"
@@ -0,0 +1,47 @@
+#
+# Copyright 2011, Dell
+#
+# 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.
+#
+# Author: andi abes
+#
+
+####
+# if monitored by nagios, install the nrpe commands
+
+# Node addresses are dynamic and can't be set from attributes only.
+my_ipaddress = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
+
+node[:quantum][:monitor] = {} if node[:quantum][:monitor].nil?
+node[:quantum][:monitor][:svcs] = [] if node[:quantum][:monitor][:svcs].nil?
+node[:quantum][:monitor][:ports] = {} if node[:quantum][:monitor][:ports].nil?
+node[:quantum][:monitor][:ports]["quantum-service"] = [my_ipaddress, node[:quantum][:api][:service_port]]
+
+svcs = node[:quantum][:monitor][:svcs]
+ports = node[:quantum][:monitor][:ports]
+log ("will monitor quantum svcs: #{svcs.join(',')} and ports #{ports.values.join(',')}")
+
+include_recipe "nagios::common" if node["roles"].include?("nagios-client")
+
+template "/etc/nagios/nrpe.d/quantum_nrpe.cfg" do
+ source "quantum_nrpe.cfg.erb"
+ mode "0644"
+ group node[:nagios][:group]
+ owner node[:nagios][:user]
+ variables( {
+ :svcs => svcs ,
+ :ports => ports
+ })
+ notifies :restart, "service[nagios-nrpe-server]"
+end if node["roles"].include?("nagios-client")
+
@@ -0,0 +1,106 @@
+# Copyright 2011 Dell, Inc.
+#
+# 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.
+#
+
+package "quantum" do
+ action :install
+end
+
+service "quantum" do
+ supports :status => true, :restart => true
+ action :enable
+end
+
+::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
+
+node.set_unless['quantum']['db']['password'] = secure_password
+
+if node[:quantum][:sql_engine] == "mysql"
+ Chef::Log.info("Configuring Quantum to use MySQL backend")
+
+ include_recipe "mysql::client"
+
+ package "python-mysqldb" do
+ action :install
+ end
+
+ env_filter = " AND mysql_config_environment:mysql-config-#{node[:quantum][:mysql_instance]}"
+ mysqls = search(:node, "roles:mysql-server#{env_filter}") || []
+ if mysqls.length > 0
+ mysql = mysqls[0]
+ mysql = node if mysql.name == node.name
+ else
+ mysql = node
+ end
+
+ mysql_address = Chef::Recipe::Barclamp::Inventory.get_network_by_type(mysql, "admin").address if mysql_address.nil?
+ Chef::Log.info("Mysql server found at #{mysql_address}")
+
+ # Create the Quantum Database
+ mysql_database "create #{node[:quantum][:db][:database]} database" do
+ host mysql_address
+ username "db_maker"
+ password mysql[:mysql][:db_maker_password]
+ database node[:quantum][:db][:database]
+ action :create_db
+ end
+
+ mysql_database "create dashboard database user" do
+ host mysql_address
+ username "db_maker"
+ password mysql[:mysql][:db_maker_password]
+ database node[:quantum][:db][:database]
+ action :query
+ sql "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER on #{node[:quantum][:db][:database]}.* to '#{node[:quantum][:db][:user]}'@'%' IDENTIFIED BY '#{node[:quantum][:db][:password]}';"
+ end
+ sql_connection = "mysql://#{node[:quantum][:db][:user]}:#{node[:quantum][:db][:password]}@#{mysql_address}/#{node[:quantum][:db][:database]}"
+elsif node[:quantum][:sql_engine] == "sqlite"
+ Chef::Log.info("Configuring Quantum to use SQLite backend")
+ sql_connection = "sqlite:////var/lib/quantum/quantum.db"
+ file "/var/lib/quantum/quantum.db" do
+ owner "quantum"
+ action :create_if_missing
+ end
+end
+
+template "/etc/quantum/quantum.conf" do
+ source "quantum.conf.erb"
+ mode "0644"
+ variables(
+ :sql_connection => sql_connection,
+ :sql_idle_timeout => node[:quantum][:sql][:idle_timeout],
+ :sql_min_pool_size => node[:quantum][:sql][:min_pool_size],
+ :sql_max_pool_size => node[:quantum][:sql][:max_pool_size],
+ :sql_pool_timeout => node[:quantum][:sql][:pool_timeout],
+ :debug => node[:quantum][:debug],
+ :verbose => node[:quantum][:verbose],
+ :admin_token => node[:quantum][:service][:token],
+ :service_port => node[:quantum][:api][:service_port], # Compute port
+ :service_host => node[:quantum][:api][:service_host],
+ :use_syslog => node[:quantum][:use_syslog]
+ )
+ notifies :restart, resources(:service => "quantum"), :immediately
+end
+
+execute "quantum-manage db_sync" do
+ action :run
+end
+
+my_ipaddress = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
+pub_ipaddress = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "public").address rescue my_ipaddress
+
+node[:quantum][:monitor] = {} if node[:quantum][:monitor].nil?
+node[:quantum][:monitor][:svcs] = [] if node[:quantum][:monitor][:svcs].nil?
+node[:quantum][:monitor][:svcs] <<["quantum"]
+node.save
@@ -0,0 +1,89 @@
+[DEFAULT]
+# Show more verbose log output (sets INFO log level output)
+verbose = <%= @verbose ? "True" : "False" %>
+
+# Show debugging output in logs (sets DEBUG log level output)
+debug = <%= @debug ? "True" : "False" %>
+
+# Log to this file. Make sure you do not set the same log
+# file for both the API and registry servers!
+log_dir = /var/log/quantum
+log_file = quantum.log
+
+
+bind_host = <%= @service_host %>
+
+bind_port = <%= @service_port %>
+
+
+# ================= Syslog Options ============================
+# Send logs to syslog (/dev/log) instead of to file specified
+# by `log-file`
+use_syslog = <%= @use_syslog ? "True" : "False" %>
+
+# Facility to use. If unset defaults to LOG_USER.
+# syslog_log_facility = LOG_LOCAL0
+
+
+################# sql section will be used for OVS plugin config
+#[sql]
+## SQLAlchemy connection string for the reference implementation registry
+## server. Any valid SQLAlchemy connection string is fine.
+## See: http://bit.ly/ideIpI
+#connection = <%= @sql_connection %>
+## Period in seconds after which SQLAlchemy should reestablish its connection
+## to the database.
+##idle_timeout = <%= @sql_idle_timeout %>
+#min_pool_size = <%= @sql_min_pool_size %>
+#max_pool_size = <%= @sql_max_pool_size %>
+#pool_timeout = <%= @sql_pool_timeout %>
+###############
+
+# Path to the extensions. Note that this can be a colon-separated list of
+# paths. For example:
+# api_extensions_path = extensions:/path/to/more/extensions:/even/more/extensions
+# The __path__ of quantum.extensions is appended to this, so if your
+# extensions are in there you don't need to specify them here
+api_extensions_path =
+
+[composite:quantum]
+use = egg:Paste#urlmap
+/: quantumversions
+/v1.0: quantumapi_v1_0
+/v1.1: quantumapi_v1_1
+
+[pipeline:quantumapi_v1_0]
+# By default, authentication is disabled.
+# To enable Keystone integration uncomment the
+# following line and comment the next one
+pipeline = extensions quantumapiapp_v1_0
+#pipeline = authN extensions quantumapiapp_v1_0
+
+[pipeline:quantumapi_v1_1]
+# By default, authentication is disabled.
+# To enable Keystone integration uncomment the
+# following line and comment the next one
+pipeline = extensions quantumapiapp_v1_1
+#pipeline = authN extensions quantumapiapp_v1_1
+
+[filter:authN]
+paste.filter_factory = keystone.middleware.quantum_auth_token:filter_factory
+auth_host = 127.0.0.1
+auth_port = 35357
+auth_protocol = http
+auth_version = 2.0
+auth_admin_user = admin
+auth_admin_password = secrete
+#auth_admin_token = <token-value>
+
+[filter:extensions]
+paste.filter_factory = quantum.common.extensions:plugin_aware_extension_middleware_factory
+
+[app:quantumversions]
+paste.app_factory = quantum.api.versions:Versions.factory
+
+[app:quantumapiapp_v1_0]
+paste.app_factory = quantum.api:APIRouterV10.factory
+
+[app:quantumapiapp_v1_1]
+paste.app_factory = quantum.api:APIRouterV11.factory
@@ -0,0 +1,10 @@
+
+<% @svcs.each do |s| %>
+command[check_<%= s%>]=/usr/lib/nagios/plugins/check_procs -w 2:10 -c 1:100 -a "<%=s %>"
+<% end unless @svcs.nil? %>
+
+
+<% @ports.each do |name,dest| %>
+command[check_port_<%= name %>]=/usr/lib/nagios/plugins/check_tcp -H <%= dest[0] %> -p <%= dest[1] %>
+<% end unless @ports.nil? %>
+
Oops, something went wrong.

0 comments on commit 0dca1a6

Please sign in to comment.