Initial commit of cinder-common
Noticed that every recipe in the cookbook had a declaration for the cinder.conf template, with a notify to the service defined in that recipie. I moved the template, and the variables that it needs to populate, to cinder-common.rb, included that in all the other recipes, and changed the notify in the template to subscribes in each service All tests pass Change-Id: Ibcab9566a907e1ea9febbd61e37b9587625a15e6
This commit is contained in:
parent
71dea12a76
commit
c4cfb42070
|
@ -4,8 +4,9 @@ maintainer_email "cookbooks@lists.tfoundry.com"
|
|||
license "Apache 2.0"
|
||||
description "The OpenStack Advanced Volume Management service Cinder."
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "7.0.0"
|
||||
version "7.1.0"
|
||||
|
||||
recipe "openstack-block-storage::common", "Defines the common pieces of repeated code from the other recipes"
|
||||
recipe "openstack-block-storage::api", "Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone"
|
||||
recipe "openstack-block-storage::db", "Creates the Cinder database"
|
||||
recipe "openstack-block-storage::keystone_registration", "Registers cinder service/user/endpoints in keystone"
|
||||
|
|
|
@ -23,9 +23,7 @@ class ::Chef::Recipe
|
|||
include ::Openstack
|
||||
end
|
||||
|
||||
if node["openstack"]["block-storage"]["syslog"]["use"]
|
||||
include_recipe "openstack-common::logging"
|
||||
end
|
||||
include_recipe "openstack-block-storage::cinder-common"
|
||||
|
||||
platform_options = node["openstack"]["block-storage"]["platform"]
|
||||
|
||||
|
@ -50,45 +48,13 @@ service "cinder-api" do
|
|||
supports :status => true, :restart => true
|
||||
|
||||
action :enable
|
||||
subscribes :restart, "template[/etc/cinder/cinder.conf]"
|
||||
end
|
||||
|
||||
db_user = node["openstack"]["block-storage"]["db"]["username"]
|
||||
db_pass = db_password "cinder"
|
||||
sql_connection = db_uri("volume", db_user, db_pass)
|
||||
|
||||
rabbit_server_role = node["openstack"]["block-storage"]["rabbit_server_chef_role"]
|
||||
rabbit_info = config_by_role rabbit_server_role, "queue"
|
||||
|
||||
rabbit_user = node["openstack"]["block-storage"]["rabbit"]["username"]
|
||||
rabbit_pass = user_password "rabbit"
|
||||
rabbit_vhost = node["openstack"]["block-storage"]["rabbit"]["vhost"]
|
||||
|
||||
glance_api_role = node["openstack"]["block-storage"]["glance_api_chef_role"]
|
||||
glance = config_by_role glance_api_role, "glance"
|
||||
glance_api_endpoint = endpoint "image-api"
|
||||
|
||||
identity_admin_endpoint = endpoint "identity-admin"
|
||||
service_pass = service_password "openstack-block-storage"
|
||||
|
||||
template "/etc/cinder/cinder.conf" do
|
||||
source "cinder.conf.erb"
|
||||
group node["openstack"]["block-storage"]["group"]
|
||||
owner node["openstack"]["block-storage"]["user"]
|
||||
mode 00644
|
||||
variables(
|
||||
:sql_connection => sql_connection,
|
||||
:rabbit_ipaddress => rabbit_info["host"],
|
||||
:rabbit_user => rabbit_user,
|
||||
:rabbit_password => rabbit_pass,
|
||||
:rabbit_port => rabbit_info["port"],
|
||||
:rabbit_virtual_host => rabbit_vhost,
|
||||
:glance_host => glance_api_endpoint.host,
|
||||
:glance_port => glance_api_endpoint.port
|
||||
)
|
||||
|
||||
notifies :restart, "service[cinder-api]"
|
||||
end
|
||||
|
||||
execute "cinder-manage db sync"
|
||||
|
||||
template "/etc/cinder/api-paste.ini" do
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
class ::Chef::Recipe
|
||||
include ::Openstack
|
||||
end
|
||||
|
||||
if node["openstack"]["block-storage"]["syslog"]["use"]
|
||||
include_recipe "openstack-common::logging"
|
||||
end
|
||||
|
||||
platform_options = node["openstack"]["block-storage"]["platform"]
|
||||
|
||||
db_user = node["openstack"]["block-storage"]["db"]["username"]
|
||||
db_pass = db_password "cinder"
|
||||
sql_connection = db_uri("volume", db_user, db_pass)
|
||||
|
||||
rabbit_server_role = node["openstack"]["block-storage"]["rabbit_server_chef_role"]
|
||||
rabbit_info = config_by_role rabbit_server_role, "queue"
|
||||
|
||||
rabbit_user = node["openstack"]["block-storage"]["rabbit"]["username"]
|
||||
rabbit_pass = user_password "rabbit"
|
||||
rabbit_vhost = node["openstack"]["block-storage"]["rabbit"]["vhost"]
|
||||
|
||||
glance_api_role = node["openstack"]["block-storage"]["glance_api_chef_role"]
|
||||
glance = config_by_role glance_api_role, "glance"
|
||||
glance_api_endpoint = endpoint "image-api"
|
||||
|
||||
template "/etc/cinder/cinder.conf" do
|
||||
source "cinder.conf.erb"
|
||||
group node["openstack"]["block-storage"]["group"]
|
||||
owner node["openstack"]["block-storage"]["user"]
|
||||
mode 00644
|
||||
variables(
|
||||
:sql_connection => sql_connection,
|
||||
:rabbit_ipaddress => rabbit_info["host"],
|
||||
:rabbit_user => rabbit_user,
|
||||
:rabbit_password => rabbit_pass,
|
||||
:rabbit_port => rabbit_info["port"],
|
||||
:rabbit_virtual_host => rabbit_vhost,
|
||||
:glance_host => glance_api_endpoint.host,
|
||||
:glance_port => glance_api_endpoint.port
|
||||
)
|
||||
|
||||
end
|
|
@ -19,9 +19,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
if node["openstack"]["block-storage"]["syslog"]["use"]
|
||||
include_recipe "openstack-common::logging"
|
||||
end
|
||||
include_recipe "openstack-block-storage::cinder-common"
|
||||
|
||||
platform_options = node["openstack"]["block-storage"]["platform"]
|
||||
|
||||
|
@ -33,43 +31,10 @@ platform_options["cinder_scheduler_packages"].each do |pkg|
|
|||
end
|
||||
end
|
||||
|
||||
db_user = node["openstack"]["block-storage"]["db"]["username"]
|
||||
db_pass = db_password "cinder"
|
||||
sql_connection = db_uri("volume", db_user, db_pass)
|
||||
|
||||
rabbit_server_role = node["openstack"]["block-storage"]["rabbit_server_chef_role"]
|
||||
rabbit_info = config_by_role rabbit_server_role, "queue"
|
||||
|
||||
rabbit_user = node["openstack"]["block-storage"]["rabbit"]["username"]
|
||||
rabbit_pass = user_password "rabbit"
|
||||
rabbit_vhost = node["openstack"]["block-storage"]["rabbit"]["vhost"]
|
||||
|
||||
glance_api_role = node["openstack"]["block-storage"]["glance_api_chef_role"]
|
||||
glance = config_by_role glance_api_role, "glance"
|
||||
glance_api_endpoint = endpoint "image-api"
|
||||
|
||||
service "cinder-scheduler" do
|
||||
service_name platform_options["cinder_scheduler_service"]
|
||||
supports :status => true, :restart => true
|
||||
|
||||
action [ :enable, :start ]
|
||||
end
|
||||
|
||||
template "/etc/cinder/cinder.conf" do
|
||||
source "cinder.conf.erb"
|
||||
group node["openstack"]["block-storage"]["group"]
|
||||
owner node["openstack"]["block-storage"]["user"]
|
||||
mode 00644
|
||||
variables(
|
||||
:sql_connection => sql_connection,
|
||||
:rabbit_ipaddress => rabbit_info["host"],
|
||||
:rabbit_user => rabbit_user,
|
||||
:rabbit_password => rabbit_pass,
|
||||
:rabbit_port => rabbit_info["port"],
|
||||
:rabbit_virtual_host => rabbit_vhost,
|
||||
:glance_host => glance_api_endpoint.host,
|
||||
:glance_port => glance_api_endpoint.port
|
||||
)
|
||||
|
||||
notifies :restart, "service[cinder-scheduler]"
|
||||
subscribes :restart, "template[/etc/cinder/cinder.conf]"
|
||||
end
|
||||
|
|
|
@ -23,9 +23,7 @@ class ::Chef::Recipe
|
|||
include ::Openstack
|
||||
end
|
||||
|
||||
if node["openstack"]["block-storage"]["syslog"]["use"]
|
||||
include_recipe "openstack-common::logging"
|
||||
end
|
||||
include_recipe "openstack-block-storage::cinder-common"
|
||||
|
||||
platform_options = node["openstack"]["block-storage"]["platform"]
|
||||
|
||||
|
@ -45,21 +43,6 @@ platform_options["cinder_iscsitarget_packages"].each do |pkg|
|
|||
end
|
||||
end
|
||||
|
||||
db_user = node["openstack"]["block-storage"]["db"]["username"]
|
||||
db_pass = db_password "cinder"
|
||||
sql_connection = db_uri("volume", db_user, db_pass)
|
||||
|
||||
rabbit_server_role = node["openstack"]["block-storage"]["rabbit_server_chef_role"]
|
||||
rabbit_info = config_by_role rabbit_server_role, "queue"
|
||||
|
||||
rabbit_user = node["openstack"]["block-storage"]["rabbit"]["username"]
|
||||
rabbit_pass = user_password "rabbit"
|
||||
rabbit_vhost = node["openstack"]["block-storage"]["rabbit"]["vhost"]
|
||||
|
||||
glance_api_role = node["openstack"]["block-storage"]["glance_api_chef_role"]
|
||||
glance = config_by_role glance_api_role, "glance"
|
||||
glance_api_endpoint = endpoint "image-api"
|
||||
|
||||
node.override["openstack"]["block-storage"]["netapp"]["dfm_password"] = service_password "netapp"
|
||||
|
||||
service "cinder-volume" do
|
||||
|
@ -67,25 +50,7 @@ service "cinder-volume" do
|
|||
supports :status => true, :restart => true
|
||||
|
||||
action [ :enable, :start ]
|
||||
end
|
||||
|
||||
template "/etc/cinder/cinder.conf" do
|
||||
source "cinder.conf.erb"
|
||||
group node["openstack"]["block-storage"]["group"]
|
||||
owner node["openstack"]["block-storage"]["user"]
|
||||
mode 00644
|
||||
variables(
|
||||
:sql_connection => sql_connection,
|
||||
:rabbit_ipaddress => rabbit_info["host"],
|
||||
:rabbit_user => rabbit_user,
|
||||
:rabbit_password => rabbit_pass,
|
||||
:rabbit_port => rabbit_info["port"],
|
||||
:rabbit_virtual_host => rabbit_vhost,
|
||||
:glance_host => glance_api_endpoint.host,
|
||||
:glance_port => glance_api_endpoint.port
|
||||
)
|
||||
|
||||
notifies :restart, "service[cinder-volume]"
|
||||
subscribes :restart, "template[/etc/cinder/cinder.conf]"
|
||||
end
|
||||
|
||||
service "iscsitarget" do
|
||||
|
|
Loading…
Reference in New Issue