added api_db sync and made libvirtd-bin template configurable
* added sync for api_db (required in mitaka) and needed configuration options in nova.conf * made libvirtd_opts configurable in preparation for xenial and systemd on ubuntu (libvirtd needs to be started with just -l option on xenial) Change-Id: I6c01e45f10d75db96c95c0bb37b016ada2f5933f Depends-On: Idf6645064a1c2f337f542b29a026969c7d35efbe
This commit is contained in:
parent
9b46ac6d13
commit
53eacd9934
|
@ -49,6 +49,9 @@ default['openstack']['compute']['rootwrap']['syslog_log_level'] = 'ERROR'
|
|||
|
||||
default['openstack']['compute']['driver'] = 'libvirt.LibvirtDriver'
|
||||
|
||||
# libvirtd_opts used in template for /etc/default/libvirt-bin
|
||||
default['openstack']['compute']['libvirt']['libvirtd_opts'] = '-d -l'
|
||||
|
||||
default['openstack']['compute']['libvirt']['auth_tcp'] = 'none'
|
||||
# libvirt.max_clients (default: 20)
|
||||
default['openstack']['compute']['libvirt']['max_clients'] = 20
|
||||
|
|
|
@ -51,6 +51,16 @@ template '/etc/nova/api-paste.ini' do
|
|||
mode 00644
|
||||
end
|
||||
|
||||
nova_user = node['openstack']['compute']['user']
|
||||
nova_group = node['openstack']['compute']['group']
|
||||
execute 'nova-manage api_db sync' do
|
||||
timeout node['openstack']['compute']['dbsync_timeout']
|
||||
user nova_user
|
||||
group nova_group
|
||||
command 'nova-manage api_db sync'
|
||||
action :run
|
||||
end
|
||||
|
||||
service 'nova-api-os-compute' do
|
||||
service_name platform_options['api_os_compute_service']
|
||||
supports status: true, restart: true
|
||||
|
|
|
@ -75,15 +75,23 @@ directory node['openstack']['compute']['conf']['oslo_concurrency']['lock_path']
|
|||
end
|
||||
|
||||
db_user = node['openstack']['db']['compute']['username']
|
||||
api_db_user = node['openstack']['db']['compute_api']['username']
|
||||
db_pass = get_password 'db', 'nova'
|
||||
api_db_pass = get_password 'db', 'nova_api'
|
||||
|
||||
node.default['openstack']['compute']['conf_secrets']
|
||||
.[]('database')['connection'] =
|
||||
db_uri('compute', db_user, db_pass)
|
||||
|
||||
node.default['openstack']['compute']['conf_secrets']
|
||||
.[]('api_database')['connection'] =
|
||||
db_uri('compute_api', api_db_user, api_db_pass)
|
||||
if node['openstack']['endpoints']['db']['enabled_slave']
|
||||
node.default['openstack']['compute']['conf_secrets']
|
||||
.[]('database')['slave_connection'] =
|
||||
db_uri('compute', db_user, db_pass, true)
|
||||
node.default['openstack']['compute']['conf_secrets']
|
||||
.[]('api_database')['slave_connection'] =
|
||||
db_uri('compute_api', api_db_user, api_db_pass, true)
|
||||
end
|
||||
|
||||
if node['openstack']['compute']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
|
||||
|
|
|
@ -23,6 +23,14 @@ describe 'openstack-compute::api-os-compute' do
|
|||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to run_execute('nova-manage api_db sync')
|
||||
.with(timeout: 3600,
|
||||
user: 'nova',
|
||||
group: 'nova',
|
||||
command: 'nova-manage api_db sync')
|
||||
end
|
||||
|
||||
it 'upgrades openstack api packages' do
|
||||
expect(chef_run).to upgrade_package 'nova-api-os-compute'
|
||||
end
|
||||
|
|
|
@ -365,25 +365,34 @@ describe 'openstack-compute::nova-common' do
|
|||
end
|
||||
end
|
||||
|
||||
it do
|
||||
node.set['openstack']['db']['compute_api']['username'] = 'nova_api'
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content(
|
||||
'api_database',
|
||||
%r{connection = mysql://nova_api:nova_api_db_pass@127.0.0.1:3306/nova_api\?charset=utf8$}
|
||||
)
|
||||
end
|
||||
|
||||
context 'set enabled_slave attribute' do
|
||||
it 'sets overide database enabled_slave attribute as true' do
|
||||
node.set['openstack']['endpoints']['db']['enabled_slave'] = true
|
||||
node.set['openstack']['endpoints']['db']['slave_host'] = '10.10.1.1'
|
||||
node.set['openstack']['endpoints']['db']['slave_port'] = '3326'
|
||||
node.set['openstack']['db']['compute']['username'] = 'nova1'
|
||||
node.set['openstack']['db']['compute']['username'] = 'nova'
|
||||
|
||||
expect(chef_run).to render_config_file(file.name)\
|
||||
.with_section_content('database', %r{slave_connection = mysql://nova1:@10.10.1.1:3326/nova\?charset=utf8$})
|
||||
.with_section_content('database', %r{slave_connection = mysql://nova:nova_db_pass@10.10.1.1:3326/nova\?charset=utf8$})
|
||||
end
|
||||
|
||||
it 'sets overide database enabled_slave attribute as false' do
|
||||
node.set['openstack']['endpoints']['db']['enabled_slave'] = false
|
||||
node.set['openstack']['endpoints']['db']['slave_host'] = '10.10.1.1'
|
||||
node.set['openstack']['endpoints']['db']['slave_port'] = '3326'
|
||||
node.set['openstack']['db']['compute']['username'] = 'nova1'
|
||||
node.set['openstack']['db']['compute']['username'] = 'nova'
|
||||
|
||||
expect(chef_run).to_not render_config_file(file.name)\
|
||||
.with_section_content('database', %r{slave_connection = mysql://nova1:@10.10.1.1:3326/nova\?charset=utf8$})
|
||||
.with_section_content('database', %r{slave_connection = mysql://nova:nova_db_pass@10.10.1.1:3326/nova\?charset=utf8$})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,8 +53,11 @@ shared_context 'compute_stubs' do
|
|||
.with('token', 'openstack_vmware_secret_name')
|
||||
.and_return 'vmware_secret_name'
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', anything)
|
||||
.and_return('')
|
||||
.with('db', 'nova')
|
||||
.and_return('nova_db_pass')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', 'nova_api')
|
||||
.and_return('nova_api_db_pass')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('user', 'guest')
|
||||
.and_return('mq-pass')
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
start_libvirtd="yes"
|
||||
|
||||
# options passed to libvirtd, add "-l" to listen on tcp
|
||||
libvirtd_opts="-d -l"
|
||||
libvirtd_opts="<%=node['openstack']['compute']['libvirt']['libvirtd_opts']%>"
|
||||
|
||||
# pass in location of kerberos keytab
|
||||
#export KRB5_KTNAME=/etc/libvirt/libvirt.keytab
|
||||
|
|
Loading…
Reference in New Issue