Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue 941 #139

Merged
merged 1 commit into from
May 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
default["neutron"]["db"]["name"] = "neutron"
default["neutron"]["db"]["username"] = "neutron"

# this is set for the DB Stamp, REQUIRED in later Havana and >
default["neutron"]["db"]["stamp"]["revision"] = "havana"
default["neutron"]["db"]["stamp"]["plugin"] = "/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
default["neutron"]["db"]["stamp"]["config"] = "/etc/neutron/neutron.conf"

default["neutron"]["service_tenant_name"] = "service"
default["neutron"]["service_user"] = "neutron"
default["neutron"]["service_role"] = "admin"
Expand Down
62 changes: 40 additions & 22 deletions recipes/neutron-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
include_recipe "osops-utils"

platform_options = node["neutron"]["platform"]
plugin = node["neutron"]["plugin"]

if plugin == "ovs"
platform_options["neutron_#{plugin}_packages"].each do |pkg|
package pkg do
action node["osops"]["do_package_upgrades"] == true ? :upgrade : :install
options platform_options["package_options"]
end
end
end

# If we're HA
if get_role_count("nova-network-controller") > 1
Expand All @@ -34,18 +44,14 @@
node.set["neutron"]["neutron_metadata_proxy_shared_secret"] =
neutron["neutron_metadata_proxy_shared_secret"]
else # Make some stuff up
if node["developer_mode"] == true
node.set_unless["neutron"]["db"]["password"] =
"neutron"
if node["developer_mode"]
node.set_unless["neutron"]["db"]["password"] = "neutron"
else
node.set_unless["neutron"]["db"]["password"] =
secure_password
node.set_unless["neutron"]["db"]["password"] = secure_password
end

node.set_unless['neutron']['service_pass'] =
secure_password
node.set_unless["neutron"]["neutron_metadata_proxy_shared_secret"] =
secure_password
node.set_unless["neutron"]["service_pass"] = secure_password
node.set_unless["neutron"]["neutron_metadata_proxy_shared_secret"] = secure_password
end

unless Chef::Config[:solo]
Expand All @@ -55,26 +61,20 @@
# Only do this setup once the db/service pass has been set.
include_recipe "nova-network::neutron-common"

packages = platform_options["neutron_api_packages"]

platform_options["neutron_api_packages"].each do |pkg|
package pkg do
action node["osops"]["do_package_upgrades"] == true ? :upgrade : :install
action node["osops"]["do_package_upgrades"] ? :upgrade : :install
options platform_options["package_options"]
end
end

ks_admin_endpoint =
get_access_endpoint("keystone-api", "keystone", "admin-api")
ks_service_endpoint =
get_access_endpoint("keystone-api", "keystone", "service-api")
keystone =
get_settings_by_role("keystone-setup", "keystone")
ks_admin_endpoint = get_access_endpoint("keystone-api", "keystone", "admin-api")
keystone = get_settings_by_role("keystone-setup", "keystone")

# Create db and user
# return connection info
# defined in osops-utils/libraries
mysql_info = create_db_and_user(
create_db_and_user(
"mysql",
node["neutron"]["db"]["name"],
node["neutron"]["db"]["username"],
Expand All @@ -84,16 +84,34 @@
api_endpoint = get_bind_endpoint("neutron", "api")
access_endpoint = get_access_endpoint("nova-network-controller", "neutron", "api")

# Get stamp hash
stamp = node["neutron"]["db"]["stamp"]

# Add a revision
execute 'add_revision' do
command "neutron-db-manage revision -m 'RCBOPS Deployment #{stamp["revision"]}'"
action :nothing
end

# Stamp the DB
execute 'stamp_db' do
command "neutron-db-manage --config-file #{stamp["config"]} --config-file #{stamp["plugin"]} stamp #{stamp["revision"]}"
action :run
not_if "neutron-db-manage history | grep \"RCBOPS Deployment #{stamp["revision"]}\""
notifies :run, 'execute[add_revision]', :delayed
end


service "neutron-server" do
service_name platform_options["neutron_api_service"]
supports :status => true, :restart => true
unless api_endpoint["scheme"] == "https"
if api_endpoint["scheme"] == "https"
action [:disable, :stop]
else
action :enable
subscribes :restart, "template[/etc/neutron/neutron.conf]", :delayed
subscribes :restart, "template[/etc/neutron/api-paste.ini]", :delayed
subscribes :restart, "template[/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini]", :delayed
else
action [ :disable, :stop ]
end
end

Expand Down