Clean up cookbook for bp/clean-up-attr-for-mq-and-db

This change removes the attributes we'll be moving to openstack-common
and changes reference of those attributes to reflect new (more
consistent) namespace. We also fix a broken test which doesn't properly
converge after changing a node attribute.  Lastly, we handle the rabbit
mq attribute use_ssl.

Change-Id: I12b9c33f89eb35a66bae7420340aff10efd18b1c
Implements: blueprint clean-up-attr-for-mq-and-db
This commit is contained in:
Matt Thompson
2014-01-16 14:13:49 +00:00
parent 6c480393fe
commit 59c1955caf
17 changed files with 52 additions and 78 deletions

View File

@@ -82,37 +82,6 @@ when 'qpid'
default['openstack']['block_storage']['rpc_backend'] = 'cinder.openstack.common.rpc.impl_qpid'
end
# MQ options
default['openstack']['block-storage']['mq']['service_type'] = node['openstack']['mq']['service_type']
default['openstack']['block-storage']['mq']['qpid']['host'] = '127.0.0.1'
default['openstack']['block-storage']['mq']['qpid']['port'] = '5672'
default['openstack']['block-storage']['mq']['qpid']['qpid_hosts'] = ['127.0.0.1:5672']
default['openstack']['block-storage']['mq']['qpid']['username'] = ''
default['openstack']['block-storage']['mq']['qpid']['password'] = ''
default['openstack']['block-storage']['mq']['qpid']['sasl_mechanisms'] = ''
default['openstack']['block-storage']['mq']['qpid']['reconnect'] = true
default['openstack']['block-storage']['mq']['qpid']['reconnect_timeout'] = 0
default['openstack']['block-storage']['mq']['qpid']['reconnect_limit'] = 0
default['openstack']['block-storage']['mq']['qpid']['reconnect_interval_min'] = 0
default['openstack']['block-storage']['mq']['qpid']['reconnect_interval_max'] = 0
default['openstack']['block-storage']['mq']['qpid']['reconnect_interval'] = 0
default['openstack']['block-storage']['mq']['qpid']['heartbeat'] = 60
default['openstack']['block-storage']['mq']['qpid']['protocol'] = 'tcp'
default['openstack']['block-storage']['mq']['qpid']['tcp_nodelay'] = true
# This user's password is stored in an encrypted databag
# and accessed with openstack-common cookbook library's
# get_password routine. You are expected to create
# the user, pass, vhost in a wrapper rabbitmq cookbook.
default['openstack']['block-storage']['rabbit']['username'] = 'guest'
default['openstack']['block-storage']['rabbit']['vhost'] = '/'
default['openstack']['block-storage']['rabbit']['port'] = 5672
default['openstack']['block-storage']['rabbit']['host'] = '127.0.0.1'
default['openstack']['block-storage']['rabbit']['ha'] = false
default['openstack']['block-storage']['db']['username'] = 'cinder'
default['openstack']['block-storage']['service_tenant_name'] = 'service'
default['openstack']['block-storage']['service_user'] = 'cinder'
default['openstack']['block-storage']['service_role'] = 'admin'

View File

@@ -36,7 +36,7 @@ platform_options['cinder_api_packages'].each do |pkg|
end
end
db_type = node['openstack']['db']['volume']['db_type']
db_type = node['openstack']['db']['block-storage']['service_type']
platform_options["#{db_type}_python_packages"].each do |pkg|
package pkg do
action :upgrade

View File

@@ -30,15 +30,15 @@ platform_options['cinder_common_packages'].each do |pkg|
end
end
db_user = node['openstack']['block-storage']['db']['username']
db_user = node['openstack']['db']['block-storage']['username']
db_pass = get_password 'db', 'cinder'
sql_connection = db_uri('volume', db_user, db_pass)
sql_connection = db_uri('block-storage', db_user, db_pass)
if node['openstack']['block-storage']['mq']['service_type'] == 'rabbitmq'
if node['openstack']['block-storage']['rabbit']['ha']
if node['openstack']['mq']['block-storage']['service_type'] == 'rabbitmq'
if node['openstack']['mq']['block-storage']['rabbit']['ha']
rabbit_hosts = rabbit_servers
end
rabbit_pass = get_password 'user', node['openstack']['block-storage']['rabbit']['username']
rabbit_pass = get_password 'user', node['openstack']['mq']['block-storage']['rabbit']['userid']
end
glance_api_endpoint = endpoint 'image-api'

View File

@@ -29,7 +29,7 @@ end
identity_admin_endpoint = endpoint 'identity-admin'
bootstrap_token = secret 'secrets', 'openstack_identity_bootstrap_token'
auth_uri = ::URI.decode identity_admin_endpoint.to_s
cinder_api_endpoint = endpoint 'volume-api'
cinder_api_endpoint = endpoint 'block-storage-api'
service_pass = get_password 'service', 'openstack-block-storage'
region = node['openstack']['block-storage']['region']
service_tenant_name = node['openstack']['block-storage']['service_tenant_name']

View File

@@ -33,7 +33,7 @@ platform_options['cinder_scheduler_packages'].each do |pkg|
end
end
db_type = node['openstack']['db']['volume']['db_type']
db_type = node['openstack']['db']['block-storage']['service_type']
platform_options["#{db_type}_python_packages"].each do |pkg|
package pkg do
action :upgrade

View File

@@ -37,7 +37,7 @@ platform_options['cinder_volume_packages'].each do |pkg|
end
end
db_type = node['openstack']['db']['volume']['db_type']
db_type = node['openstack']['db']['block-storage']['service_type']
platform_options["#{db_type}_python_packages"].each do |pkg|
package pkg do
action :upgrade

View File

@@ -23,7 +23,7 @@ describe 'openstack-block-storage::api' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::api'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -23,7 +23,7 @@ describe 'openstack-block-storage::api' do
it 'installs db2 python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'db2'
node.set['openstack']['db']['block-storage']['service_type'] = 'db2'
chef_run.converge 'openstack-block-storage::api'
['db2-odbc', 'python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
@@ -34,7 +34,7 @@ describe 'openstack-block-storage::api' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::api'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -35,7 +35,7 @@ describe 'openstack-block-storage::api' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::api'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -107,6 +107,10 @@ describe 'openstack-block-storage::cinder-common' do
expect(@chef_run).to render_file(@file.name).with_content('rabbit_port=5672')
end
it 'has rabbit_use_ssl' do
expect(@chef_run).to render_file(@file.name).with_content('rabbit_use_ssl=false')
end
it 'has rabbit_userid' do
expect(@chef_run).to render_file(@file.name).with_content('rabbit_userid=guest')
end
@@ -122,7 +126,7 @@ describe 'openstack-block-storage::cinder-common' do
describe 'rabbit ha' do
before do
@chef_run = ::ChefSpec::Runner.new(::UBUNTU_OPTS) do |n|
n.set['openstack']['block-storage']['rabbit']['ha'] = true
n.set['openstack']['mq']['block-storage']['rabbit']['ha'] = true
end
@chef_run.converge 'openstack-block-storage::cinder-common'
end
@@ -147,7 +151,8 @@ describe 'openstack-block-storage::cinder-common' do
describe 'qpid' do
before do
@file = @chef_run.template '/etc/cinder/cinder.conf'
@chef_run.node.set['openstack']['block-storage']['mq']['service_type'] = 'qpid'
@chef_run.node.set['openstack']['mq']['block-storage']['service_type'] = 'qpid'
@chef_run.converge 'openstack-block-storage::cinder-common'
end
it 'has qpid_hostname' do

View File

@@ -30,7 +30,7 @@ describe 'openstack-block-storage::scheduler' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::scheduler'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -30,7 +30,7 @@ describe 'openstack-block-storage::scheduler' do
it 'installs db2 python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'db2'
node.set['openstack']['db']['block-storage']['service_type'] = 'db2'
chef_run.converge 'openstack-block-storage::scheduler'
['db2-odbc', 'python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
@@ -41,7 +41,7 @@ describe 'openstack-block-storage::scheduler' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::scheduler'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -34,7 +34,7 @@ describe 'openstack-block-storage::scheduler' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::scheduler'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -23,7 +23,7 @@ describe 'openstack-block-storage::volume' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::volume'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -19,7 +19,7 @@ describe 'openstack-block-storage::volume' do
it 'installs db2 python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'db2'
node.set['openstack']['db']['block-storage']['service_type'] = 'db2'
chef_run.converge 'openstack-block-storage::volume'
['db2-odbc', 'python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
@@ -30,7 +30,7 @@ describe 'openstack-block-storage::volume' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::volume'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -34,7 +34,7 @@ describe 'openstack-block-storage::volume' do
it 'installs postgresql python packages if explicitly told' do
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
node = chef_run.node
node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
chef_run.converge 'openstack-block-storage::volume'
expect(chef_run).to upgrade_package 'python-psycopg2'

View File

@@ -172,8 +172,8 @@ auth_strategy=keystone
#### (StrOpt) The strategy to use for auth. Supports noauth, keystone, and
#### deprecated.
<% if node["openstack"]["block-storage"]["rabbit"]["control_exchange"] %>
control_exchange=<%=node["openstack"]["block-storage"]["rabbit"]["control_exchange"]%>
<% if node["openstack"]["mq"]["block-storage"]["rabbit"]["control_exchange"] %>
control_exchange=<%=node["openstack"]["mq"]["block-storage"]["rabbit"]["control_exchange"]%>
<% end %>
# control_exchange=cinder
#### (StrOpt) AMQP exchange to connect to if using RabbitMQ or Qpid
@@ -362,7 +362,7 @@ rpc_response_timeout=<%= node["openstack"]["block-storage"]["rpc_response_timeou
#### receiving exception data from an rpc call.
<% if node["openstack"]["block-storage"]["mq"]["service_type"] == "rabbitmq" %>
<% if node["openstack"]["mq"]["block-storage"]["service_type"] == "rabbitmq" %>
# fake_rabbit=false
#### (BoolOpt) If passed, use a fake RabbitMQ provider
@@ -381,7 +381,7 @@ rpc_response_timeout=<%= node["openstack"]["block-storage"]["rpc_response_timeou
# kombu_ssl_ca_certs=
#### (StrOpt) SSL certification authority file (valid only if SSL enabled)
<% if node["openstack"]["block-storage"]["rabbit"]["ha"] -%>
<% if node["openstack"]["mq"]["block-storage"]["rabbit"]["ha"] -%>
rabbit_hosts=<%= @rabbit_hosts %>
#### (ListOpt) RabbitMQ HA cluster host:port pairs
@@ -392,23 +392,23 @@ rabbit_ha_queues=True
#### (BoolOpt) use H/A queues in RabbitMQ (x-ha-policy: all).You need to
#### wipe RabbitMQ database when changing this option.
<% else -%>
rabbit_host=<%= node["openstack"]["block-storage"]["rabbit"]["host"] %>
rabbit_host=<%= node["openstack"]["mq"]["block-storage"]["rabbit"]["host"] %>
#### (StrOpt) The RabbitMQ broker address where a single node is used
rabbit_port=<%= node["openstack"]["block-storage"]["rabbit"]["port"] %>
rabbit_port=<%= node["openstack"]["mq"]["block-storage"]["rabbit"]["port"] %>
#### (IntOpt) The RabbitMQ broker port where a single node is used
<% end -%>
# rabbit_use_ssl=false
rabbit_use_ssl=<%= node["openstack"]["mq"]["block-storage"]["rabbit"]["use_ssl"] %>
#### (BoolOpt) connect over SSL for RabbitMQ
rabbit_userid=<%= node["openstack"]["block-storage"]["rabbit"]["username"] %>
rabbit_userid=<%= node["openstack"]["mq"]["block-storage"]["rabbit"]["userid"] %>
#### (StrOpt) the RabbitMQ userid
rabbit_password=<%= @rabbit_password %>
#### (StrOpt) the RabbitMQ password
rabbit_virtual_host=<%= node["openstack"]["block-storage"]["rabbit"]["vhost"] %>
rabbit_virtual_host=<%= node["openstack"]["mq"]["block-storage"]["rabbit"]["vhost"] %>
#### (StrOpt) the RabbitMQ virtual host
# rabbit_retry_interval=1
@@ -425,52 +425,52 @@ rabbit_virtual_host=<%= node["openstack"]["block-storage"]["rabbit"]["vhost"] %>
<% end %>
<% if node["openstack"]["block-storage"]["mq"]["service_type"] == "qpid" %>
<% if node["openstack"]["mq"]["block-storage"]["service_type"] == "qpid" %>
##### QPID #####
######## defined in cinder.openstack.common.rpc.impl_qpid ########
rpc_backend=cinder.openstack.common.rpc.impl_qpid
qpid_hostname=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["host"] %>
qpid_hostname=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["host"] %>
#### (StrOpt) Qpid broker hostname
qpid_port=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["port"] %>
qpid_port=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["port"] %>
#### (StrOpt) Qpid broker port
qpid_username=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["username"] %>
qpid_username=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["username"] %>
#### (StrOpt) Username for qpid connection
qpid_password=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["password"] %>
qpid_password=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["password"] %>
#### (StrOpt) Password for qpid connection
qpid_sasl_mechanisms=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["sasl_mechanisms"] %>
qpid_sasl_mechanisms=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["sasl_mechanisms"] %>
#### (StrOpt) Space separated list of SASL mechanisms to use for auth
qpid_reconnect=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["reconnect"] %>
qpid_reconnect=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["reconnect"] %>
#### (BoolOpt) Automatically reconnect
qpid_reconnect_timeout=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["reconnect_timeout"] %>
qpid_reconnect_timeout=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["reconnect_timeout"] %>
#### (IntOpt) Reconnection timeout in seconds
qpid_reconnect_limit=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["reconnect_limit"] %>
qpid_reconnect_limit=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["reconnect_limit"] %>
#### (IntOpt) Max reconnections before giving up
qpid_reconnect_interval_min=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["reconnect_interval_min"] %>
qpid_reconnect_interval_min=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["reconnect_interval_min"] %>
#### (IntOpt) Minimum seconds between reconnection attempts
qpid_reconnect_interval_max=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["reconnect_interval_max"] %>
qpid_reconnect_interval_max=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["reconnect_interval_max"] %>
#### (IntOpt) Maximum seconds between reconnection attempts
qpid_reconnect_interval=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["reconnect_interval"] %>
qpid_reconnect_interval=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["reconnect_interval"] %>
#### (IntOpt) Equivalent to setting max and min to the same value
qpid_heartbeat=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["heartbeat"] %>
qpid_heartbeat=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["heartbeat"] %>
#### (IntOpt) Seconds between connection keepalive heartbeats
qpid_protocol=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["protocol"] %>
qpid_protocol=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["protocol"] %>
#### (StrOpt) Transport to use, either 'tcp' or 'ssl'
qpid_tcp_nodelay=<%= node["openstack"]["block-storage"]["mq"]["qpid"]["tcp_nodelay"] %>
qpid_tcp_nodelay=<%= node["openstack"]["mq"]["block-storage"]["qpid"]["tcp_nodelay"] %>
#### (BoolOpt) Disable Nagle algorithm
<% end %>