Fix creation of cell0
We need to use the proper db_uri() result here, like we do for the
database connection options in nova.conf, otherwise things will fail in
a multinode setup.
Change-Id: I70d27eb4456c9e8b322c05649254624d4be4c5e5
(cherry picked from commit b1f166b674
)
This commit is contained in:
@@ -25,6 +25,7 @@ Metrics/MethodLength:
|
|||||||
# SupportedStyles: nested, compact
|
# SupportedStyles: nested, compact
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'recipes/_nova_cell.rb'
|
||||||
- 'recipes/api-metadata.rb'
|
- 'recipes/api-metadata.rb'
|
||||||
- 'recipes/api-os-compute.rb'
|
- 'recipes/api-os-compute.rb'
|
||||||
- 'recipes/compute.rb'
|
- 'recipes/compute.rb'
|
||||||
@@ -39,6 +40,7 @@ Style/Documentation:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/**/*'
|
- 'spec/**/*'
|
||||||
- 'test/**/*'
|
- 'test/**/*'
|
||||||
|
- 'recipes/_nova_cell.rb'
|
||||||
- 'recipes/api-metadata.rb'
|
- 'recipes/api-metadata.rb'
|
||||||
- 'recipes/api-os-compute.rb'
|
- 'recipes/api-os-compute.rb'
|
||||||
- 'recipes/compute.rb'
|
- 'recipes/compute.rb'
|
||||||
|
@@ -6,7 +6,7 @@ source_url 'https://github.com/openstack/cookbook-openstack-compute' if respond_
|
|||||||
license 'Apache 2.0'
|
license 'Apache 2.0'
|
||||||
description 'The OpenStack Compute service Nova.'
|
description 'The OpenStack Compute service Nova.'
|
||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version '15.1.0'
|
version '15.2.0'
|
||||||
chef_version '>= 12.5' if respond_to?(:chef_version)
|
chef_version '>= 12.5' if respond_to?(:chef_version)
|
||||||
|
|
||||||
%w(ubuntu redhat centos).each do |os|
|
%w(ubuntu redhat centos).each do |os|
|
||||||
|
@@ -22,20 +22,20 @@
|
|||||||
# and not called directly. It creates a basic cellv2 setup, which is required
|
# and not called directly. It creates a basic cellv2 setup, which is required
|
||||||
# from Ocata forward.
|
# from Ocata forward.
|
||||||
|
|
||||||
|
class ::Chef::Recipe
|
||||||
|
include ::Openstack
|
||||||
|
end
|
||||||
|
|
||||||
nova_user = node['openstack']['compute']['user']
|
nova_user = node['openstack']['compute']['user']
|
||||||
nova_group = node['openstack']['compute']['group']
|
nova_group = node['openstack']['compute']['group']
|
||||||
|
db_user = node['openstack']['db']['compute_cell0']['username']
|
||||||
db_password = get_password('db', 'nova_cell0')
|
db_password = get_password('db', 'nova_cell0')
|
||||||
bind_db = node['openstack']['bind_service']['db']
|
uri = db_uri('compute_cell0', db_user, db_password)
|
||||||
listen_address = if bind_db['interface']
|
|
||||||
address_for bind_db['interface']
|
|
||||||
else
|
|
||||||
listen_address = bind_db['host']
|
|
||||||
end
|
|
||||||
|
|
||||||
execute 'map cell0' do
|
execute 'map cell0' do
|
||||||
user nova_user
|
user nova_user
|
||||||
group nova_group
|
group nova_group
|
||||||
command "nova-manage cell_v2 map_cell0 --database_connection mysql+pymysql://nova_cell0:#{db_password}@#{listen_address}/nova_cell0?charset=utf8"
|
command "nova-manage cell_v2 map_cell0 --database_connection #{uri}"
|
||||||
not_if 'nova-manage cell_v2 list_cells | grep -q cell0'
|
not_if 'nova-manage cell_v2 list_cells | grep -q cell0'
|
||||||
action :run
|
action :run
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user