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:
Jens Harbott
2017-11-28 14:05:44 +00:00
parent 31ca62de17
commit 5997d533ec
3 changed files with 10 additions and 8 deletions

View File

@@ -25,6 +25,7 @@ Metrics/MethodLength:
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'recipes/_nova_cell.rb'
- 'recipes/api-metadata.rb'
- 'recipes/api-os-compute.rb'
- 'recipes/compute.rb'
@@ -39,6 +40,7 @@ Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'recipes/_nova_cell.rb'
- 'recipes/api-metadata.rb'
- 'recipes/api-os-compute.rb'
- 'recipes/compute.rb'

View File

@@ -6,7 +6,7 @@ source_url 'https://github.com/openstack/cookbook-openstack-compute' if respond_
license 'Apache 2.0'
description 'The OpenStack Compute service Nova.'
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)
%w(ubuntu redhat centos).each do |os|

View File

@@ -22,20 +22,20 @@
# and not called directly. It creates a basic cellv2 setup, which is required
# from Ocata forward.
class ::Chef::Recipe
include ::Openstack
end
nova_user = node['openstack']['compute']['user']
nova_group = node['openstack']['compute']['group']
db_user = node['openstack']['db']['compute_cell0']['username']
db_password = get_password('db', 'nova_cell0')
bind_db = node['openstack']['bind_service']['db']
listen_address = if bind_db['interface']
address_for bind_db['interface']
else
listen_address = bind_db['host']
end
uri = db_uri('compute_cell0', db_user, db_password)
execute 'map cell0' do
user nova_user
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'
action :run
end