Added cellv2 support
- Added basic cellv2 recipe, as it is required from Ocata on - Style and lint fixes to support newer chefdk - Rewrote metadata.rb for readability - Removed ancient Gemfile Change-Id: I97b453fc419bfbf01679dadf39a256b1f0f99859
This commit is contained in:
parent
5460cfba68
commit
012902ad92
|
@ -1,6 +1,6 @@
|
||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2017-03-06 14:33:48 +0000 using RuboCop version 0.39.0.
|
# on 2017-08-02 01:11:06 -0400 using RuboCop version 0.47.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
|
@ -10,6 +10,11 @@
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Max: 16
|
Max: 16
|
||||||
|
|
||||||
|
# Offense count: 28
|
||||||
|
# Configuration parameters: CountComments, ExcludedMethods.
|
||||||
|
Metrics/BlockLength:
|
||||||
|
Max: 373
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
|
@ -42,7 +47,7 @@ Style/Documentation:
|
||||||
- 'recipes/nova-setup.rb'
|
- 'recipes/nova-setup.rb'
|
||||||
- 'recipes/placement_api.rb'
|
- 'recipes/placement_api.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 3
|
||||||
# Configuration parameters: MinBodyLength.
|
# Configuration parameters: MinBodyLength.
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
@ -61,4 +66,7 @@ Style/Next:
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
||||||
# SupportedStyles: single_quotes, double_quotes
|
# SupportedStyles: single_quotes, double_quotes
|
||||||
Style/StringLiterals:
|
Style/StringLiterals:
|
||||||
Enabled: false
|
Exclude:
|
||||||
|
- 'spec/identity_registration_spec.rb'
|
||||||
|
- 'spec/placement_api_spec.rb'
|
||||||
|
- 'spec/spec_helper.rb'
|
||||||
|
|
14
Gemfile
14
Gemfile
|
@ -1,14 +0,0 @@
|
||||||
## THIS GEMFILE IS DEPRECATED AND WILL BE REMOVED AFTER THE NEXT RELEASE
|
|
||||||
## THERE WON'T BE ANY UPDATES TO THIS FILE DURING THIS RELEASE CYCLE
|
|
||||||
## WE SWITCHED TO CHEFDK AS THE BUNDLE FOR THE NEEDED GEMS
|
|
||||||
|
|
||||||
source 'https://rubygems.org'
|
|
||||||
|
|
||||||
gem 'chef', '~> 11.18.6'
|
|
||||||
gem 'json', '<= 1.7.7' # chef 11 dependency
|
|
||||||
gem 'berkshelf', '~> 3.2.1'
|
|
||||||
gem 'hashie', '~> 2.0'
|
|
||||||
gem 'chefspec', '~> 4.0.0'
|
|
||||||
gem 'rspec', '~> 3.0.0'
|
|
||||||
gem 'foodcritic', '~> 4.0'
|
|
||||||
gem 'rubocop', '~> 0.29.1'
|
|
|
@ -7,6 +7,7 @@ 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.0.0'
|
version '15.0.0'
|
||||||
|
chef_version '>= 12.5' if respond_to?(:chef_version)
|
||||||
|
|
||||||
%w(ubuntu redhat centos).each do |os|
|
%w(ubuntu redhat centos).each do |os|
|
||||||
supports os
|
supports os
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
# encoding: UTF-8
|
||||||
|
#
|
||||||
|
# Cookbook Name:: openstack-compute
|
||||||
|
# Recipe:: _nova_cell
|
||||||
|
#
|
||||||
|
# Copyright 2017, Workday, Inc.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
# This recipe is automatically included in openstack-compute::api-os-compute
|
||||||
|
# and not called directly. It creates a basic cellv2 setup, which is required
|
||||||
|
# from Ocata forward.
|
||||||
|
|
||||||
|
nova_user = node['openstack']['compute']['user']
|
||||||
|
nova_group = node['openstack']['compute']['group']
|
||||||
|
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
|
||||||
|
|
||||||
|
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"
|
||||||
|
not_if 'nova-manage cell_v2 list_cells | grep -q cell0'
|
||||||
|
action :run
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'create cell1' do
|
||||||
|
user nova_user
|
||||||
|
group nova_group
|
||||||
|
not_if 'nova-manage cell_v2 list_cells | grep -q cell1'
|
||||||
|
command 'nova-manage cell_v2 create_cell --verbose --name cell1'
|
||||||
|
action :run
|
||||||
|
end
|
||||||
|
|
||||||
|
execute '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
|
||||||
|
|
||||||
|
execute 'db sync' do
|
||||||
|
timeout node['openstack']['compute']['dbsync_timeout']
|
||||||
|
user nova_user
|
||||||
|
group nova_group
|
||||||
|
command 'nova-manage db sync'
|
||||||
|
action :run
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'discover hosts' do
|
||||||
|
user nova_user
|
||||||
|
group nova_group
|
||||||
|
command 'nova-manage cell_v2 discover_hosts'
|
||||||
|
action :run
|
||||||
|
end
|
|
@ -40,7 +40,7 @@ template '/etc/nova/api-paste.ini' do
|
||||||
source 'api-paste.ini.erb'
|
source 'api-paste.ini.erb'
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00644
|
mode 0o0644
|
||||||
end
|
end
|
||||||
|
|
||||||
service 'nova-api-metadata' do
|
service 'nova-api-metadata' do
|
||||||
|
|
|
@ -33,15 +33,16 @@ platform_options['api_os_compute_packages'].each do |pkg|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
template '/etc/nova/api-paste.ini' do
|
|
||||||
source 'api-paste.ini.erb'
|
|
||||||
owner node['openstack']['compute']['user']
|
|
||||||
group node['openstack']['compute']['group']
|
|
||||||
mode 00644
|
|
||||||
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']
|
||||||
|
|
||||||
|
template '/etc/nova/api-paste.ini' do
|
||||||
|
source 'api-paste.ini.erb'
|
||||||
|
owner nova_user
|
||||||
|
group nova_group
|
||||||
|
mode 0o0644
|
||||||
|
end
|
||||||
|
|
||||||
execute 'nova-manage api_db sync' do
|
execute 'nova-manage api_db sync' do
|
||||||
timeout node['openstack']['compute']['dbsync_timeout']
|
timeout node['openstack']['compute']['dbsync_timeout']
|
||||||
user nova_user
|
user nova_user
|
||||||
|
@ -59,3 +60,5 @@ service 'nova-api-os-compute' do
|
||||||
'template[/etc/nova/api-paste.ini]'
|
'template[/etc/nova/api-paste.ini]'
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
include_recipe 'openstack-compute::_nova_cell'
|
||||||
|
|
|
@ -53,14 +53,14 @@ end
|
||||||
# TODO: (jklare) this has to be refactored!!!
|
# TODO: (jklare) this has to be refactored!!!
|
||||||
cookbook_file '/etc/nova/nova-compute.conf' do
|
cookbook_file '/etc/nova/nova-compute.conf' do
|
||||||
source 'nova-compute.conf'
|
source 'nova-compute.conf'
|
||||||
mode 00644
|
mode 0o0644
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
|
||||||
directory node['openstack']['compute']['conf']['DEFAULT']['instances_path'] do
|
directory node['openstack']['compute']['conf']['DEFAULT']['instances_path'] do
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00755
|
mode 0o0755
|
||||||
recursive true
|
recursive true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,8 @@ def update_boot_kernel_and_trigger_reboot(flavor = 'default')
|
||||||
update_grub2_default_kernel(flavor)
|
update_grub2_default_kernel(flavor)
|
||||||
else
|
else
|
||||||
::Chef::Application.fatal!(
|
::Chef::Application.fatal!(
|
||||||
'Unknown bootloader. Could not change boot kernel.')
|
'Unknown bootloader. Could not change boot kernel.'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# trigger reboot through reboot_handler, if kernel-$flavor is not yet
|
# trigger reboot through reboot_handler, if kernel-$flavor is not yet
|
||||||
|
@ -127,7 +128,7 @@ template '/etc/libvirt/libvirtd.conf' do
|
||||||
source 'libvirtd.conf.erb'
|
source 'libvirtd.conf.erb'
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 0o0644
|
||||||
variables(
|
variables(
|
||||||
auth_tcp: node['openstack']['compute']['libvirt']['auth_tcp'],
|
auth_tcp: node['openstack']['compute']['libvirt']['auth_tcp'],
|
||||||
libvirt_group: node['openstack']['compute']['libvirt']['group']
|
libvirt_group: node['openstack']['compute']['libvirt']['group']
|
||||||
|
@ -139,7 +140,7 @@ template '/etc/default/libvirt-bin' do
|
||||||
source 'libvirt-bin.erb'
|
source 'libvirt-bin.erb'
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 0o0644
|
||||||
notifies :restart, 'service[libvirt-bin]', :immediately
|
notifies :restart, 'service[libvirt-bin]', :immediately
|
||||||
only_if { platform_family? 'debian' }
|
only_if { platform_family? 'debian' }
|
||||||
end
|
end
|
||||||
|
@ -148,7 +149,7 @@ template '/etc/sysconfig/libvirtd' do
|
||||||
source 'libvirtd.erb'
|
source 'libvirtd.erb'
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 0o0644
|
||||||
notifies :restart, 'service[libvirt-bin]', :immediately
|
notifies :restart, 'service[libvirt-bin]', :immediately
|
||||||
only_if { platform_family? %w(rhel) }
|
only_if { platform_family? %w(rhel) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,21 +56,21 @@ end
|
||||||
directory '/etc/nova' do
|
directory '/etc/nova' do
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00750
|
mode 0o0750
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
|
||||||
directory node['openstack']['compute']['conf']['DEFAULT']['state_path'] do
|
directory node['openstack']['compute']['conf']['DEFAULT']['state_path'] do
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00755
|
mode 0o0755
|
||||||
recursive true
|
recursive true
|
||||||
end
|
end
|
||||||
|
|
||||||
directory node['openstack']['compute']['conf']['oslo_concurrency']['lock_path'] do
|
directory node['openstack']['compute']['conf']['oslo_concurrency']['lock_path'] do
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00755
|
mode 0o0755
|
||||||
recursive true
|
recursive true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ template '/etc/nova/nova.conf' do
|
||||||
source 'nova.conf.erb'
|
source 'nova.conf.erb'
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00640
|
mode 0o0640
|
||||||
variables(
|
variables(
|
||||||
# TODO(jaypipes): No support here for >1 image API servers
|
# TODO(jaypipes): No support here for >1 image API servers
|
||||||
# with the glance_api_servers configuration option...
|
# with the glance_api_servers configuration option...
|
||||||
|
@ -235,7 +235,7 @@ template '/etc/nova/rootwrap.conf' do
|
||||||
# Must be root!
|
# Must be root!
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 0o0644
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'enable nova login' do
|
execute 'enable nova login' do
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
|
describe 'openstack-compute::_nova_cell' do
|
||||||
|
describe 'ubuntu' do
|
||||||
|
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||||
|
let(:node) { runner.node }
|
||||||
|
let(:chef_run) { runner.converge(described_recipe) }
|
||||||
|
|
||||||
|
include_context 'compute_stubs'
|
||||||
|
include_examples 'expect_runs_nova_cell_recipe'
|
||||||
|
|
||||||
|
it 'creates the cell0 mapping' do
|
||||||
|
expect(chef_run).to run_execute('map cell0')
|
||||||
|
.with(user: 'nova',
|
||||||
|
group: 'nova')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'creates a new cell' do
|
||||||
|
expect(chef_run).to run_execute('create cell1')
|
||||||
|
.with(user: 'nova',
|
||||||
|
group: 'nova')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'executes api_db sync' do
|
||||||
|
expect(chef_run).to run_execute('api db sync')
|
||||||
|
.with(user: 'nova',
|
||||||
|
group: 'nova')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'executes db sync' do
|
||||||
|
expect(chef_run).to run_execute('db sync')
|
||||||
|
.with(user: 'nova',
|
||||||
|
group: 'nova')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'discovers compute hosts' do
|
||||||
|
expect(chef_run).to run_execute('discover hosts')
|
||||||
|
.with(user: 'nova',
|
||||||
|
group: 'nova')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -13,6 +13,14 @@ describe 'openstack-compute::api-os-compute' do
|
||||||
include_examples 'expect_creates_nova_state_dir'
|
include_examples 'expect_creates_nova_state_dir'
|
||||||
include_examples 'expect_creates_nova_lock_dir'
|
include_examples 'expect_creates_nova_lock_dir'
|
||||||
|
|
||||||
|
it 'executes nova-manage api_db sync' 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
|
it 'upgrades openstack api packages' do
|
||||||
expect(chef_run).to upgrade_package 'openstack-nova-api'
|
expect(chef_run).to upgrade_package 'openstack-nova-api'
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,7 +75,7 @@ describe 'openstack-compute::compute' do
|
||||||
it 'creates the file' do
|
it 'creates the file' do
|
||||||
expect(chef_run).to create_cookbook_file(file.name).with(
|
expect(chef_run).to create_cookbook_file(file.name).with(
|
||||||
source: 'nova-compute.conf',
|
source: 'nova-compute.conf',
|
||||||
mode: 00644
|
mode: 0o0644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe 'openstack-compute::libvirt' do
|
||||||
expect(chef_run).to create_template(file.name).with(
|
expect(chef_run).to create_template(file.name).with(
|
||||||
owner: 'root',
|
owner: 'root',
|
||||||
group: 'root',
|
group: 'root',
|
||||||
mode: 0644
|
mode: 0o644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ describe 'openstack-compute::libvirt' do
|
||||||
expect(chef_run).to create_template(file.name).with(
|
expect(chef_run).to create_template(file.name).with(
|
||||||
owner: 'root',
|
owner: 'root',
|
||||||
group: 'root',
|
group: 'root',
|
||||||
mode: 0644
|
mode: 0o644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ describe 'openstack-compute::libvirt' do
|
||||||
expect(chef_run).to create_template(file.name).with(
|
expect(chef_run).to create_template(file.name).with(
|
||||||
owner: 'root',
|
owner: 'root',
|
||||||
group: 'root',
|
group: 'root',
|
||||||
mode: 0644
|
mode: 0o644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
expect(chef_run).to create_directory('/etc/nova').with(
|
expect(chef_run).to create_directory('/etc/nova').with(
|
||||||
owner: 'nova',
|
owner: 'nova',
|
||||||
group: 'nova',
|
group: 'nova',
|
||||||
mode: 0750
|
mode: 0o750
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
expect(chef_run).to create_template(file.name).with(
|
expect(chef_run).to create_template(file.name).with(
|
||||||
owner: 'nova',
|
owner: 'nova',
|
||||||
group: 'nova',
|
group: 'nova',
|
||||||
mode: 0640
|
mode: 0o640
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -155,7 +155,6 @@ describe 'openstack-compute::nova-common' do
|
||||||
|
|
||||||
it 'uses default values for attributes' do
|
it 'uses default values for attributes' do
|
||||||
[
|
[
|
||||||
|
|
||||||
%r{^api_servers = http://127.0.0.1:9292$}
|
%r{^api_servers = http://127.0.0.1:9292$}
|
||||||
|
|
||||||
].each do |line|
|
].each do |line|
|
||||||
|
@ -203,8 +202,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
node.set['openstack']['endpoints']['compute-vnc-bind']['bind_interface'] = 'lo'
|
node.set['openstack']['endpoints']['compute-vnc-bind']['bind_interface'] = 'lo'
|
||||||
|
|
||||||
[/^vncserver_listen = 127.0.0.1$/,
|
[/^vncserver_listen = 127.0.0.1$/,
|
||||||
/^vncserver_proxyclient_address = 127.0.0.1$/
|
/^vncserver_proxyclient_address = 127.0.0.1$/].each do |line|
|
||||||
].each do |line|
|
|
||||||
expect(chef_run).to render_file(file.name).with_content(line)
|
expect(chef_run).to render_file(file.name).with_content(line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -265,7 +263,8 @@ describe 'openstack-compute::nova-common' do
|
||||||
|
|
||||||
it 'has no auto_assign_floating_ip' do
|
it 'has no auto_assign_floating_ip' do
|
||||||
expect(chef_run).not_to render_file(file.name).with_content(
|
expect(chef_run).not_to render_file(file.name).with_content(
|
||||||
'auto_assign_floating_ip=false')
|
'auto_assign_floating_ip=false'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'rbd backend' do
|
context 'rbd backend' do
|
||||||
|
@ -385,7 +384,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
expect(chef_run).to render_config_file(file.name)
|
expect(chef_run).to render_config_file(file.name)
|
||||||
.with_section_content(
|
.with_section_content(
|
||||||
'api_database',
|
'api_database',
|
||||||
%r{connection = mysql://nova_api:nova_api_db_pass@127.0.0.1:3306/nova_api\?charset=utf8$}
|
%(connection = mysql+pymysql://nova_api:nova_api_db_pass@127.0.0.1:3306/nova_api?charset=utf8)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -397,7 +396,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
node.set['openstack']['db']['compute']['username'] = 'nova'
|
node.set['openstack']['db']['compute']['username'] = 'nova'
|
||||||
|
|
||||||
expect(chef_run).to render_config_file(file.name)\
|
expect(chef_run).to render_config_file(file.name)\
|
||||||
.with_section_content('database', %r{slave_connection = mysql://nova:nova_db_pass@10.10.1.1:3326/nova\?charset=utf8$})
|
.with_section_content('database', %(slave_connection = mysql+pymysql://nova:nova_db_pass@10.10.1.1:3326/nova?charset=utf8))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets overide database enabled_slave attribute as false' do
|
it 'sets overide database enabled_slave attribute as false' do
|
||||||
|
@ -407,7 +406,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
node.set['openstack']['db']['compute']['username'] = 'nova'
|
node.set['openstack']['db']['compute']['username'] = 'nova'
|
||||||
|
|
||||||
expect(chef_run).to_not render_config_file(file.name)\
|
expect(chef_run).to_not render_config_file(file.name)\
|
||||||
.with_section_content('database', %r{slave_connection = mysql://nova:nova_db_pass@10.10.1.1:3326/nova\?charset=utf8$})
|
.with_section_content('database', %(slave_connection = mysql+pymysql://nova:nova_db_pass@10.10.1.1:3326/nova?charset=utf8))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -419,7 +418,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
expect(chef_run).to create_template(file.name).with(
|
expect(chef_run).to create_template(file.name).with(
|
||||||
user: 'root',
|
user: 'root',
|
||||||
group: 'root',
|
group: 'root',
|
||||||
mode: 0644
|
mode: 0o644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,9 @@ shared_context 'compute_stubs' do
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||||
.with('db', 'nova_api')
|
.with('db', 'nova_api')
|
||||||
.and_return('nova_api_db_pass')
|
.and_return('nova_api_db_pass')
|
||||||
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||||
|
.with('db', 'nova_cell0')
|
||||||
|
.and_return('nova_cell0_db_pass')
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||||
.with('user', 'guest')
|
.with('user', 'guest')
|
||||||
.and_return('mq-pass')
|
.and_return('mq-pass')
|
||||||
|
@ -92,6 +95,12 @@ shared_context 'compute_stubs' do
|
||||||
stub_command('virsh secret-list | grep 00000000-0000-0000-0000-000000000000').and_return(false)
|
stub_command('virsh secret-list | grep 00000000-0000-0000-0000-000000000000').and_return(false)
|
||||||
stub_command('virsh secret-set-value --secret 00000000-0000-0000-0000-000000000000 --base64 $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)').and_return(false)
|
stub_command('virsh secret-set-value --secret 00000000-0000-0000-0000-000000000000 --base64 $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)').and_return(false)
|
||||||
stub_command('virsh secret-get-value 00000000-0000-0000-0000-000000000000 | grep $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)').and_return(false)
|
stub_command('virsh secret-get-value 00000000-0000-0000-0000-000000000000 | grep $(ceph-authtool -p -n client.cinder /etc/ceph/ceph.client.cinder.keyring)').and_return(false)
|
||||||
|
stub_command('nova-manage api_db sync').and_return(true)
|
||||||
|
stub_command('nova-manage cell_v2 map_cell0 --database_connection mysql+pymysql://nova_cell0:mypass@127.0.0.1/nova_cell0?charset=utf8').and_return(true)
|
||||||
|
stub_command('nova-manage cell_v2 create_cell --verbose --name cell1').and_return(true)
|
||||||
|
stub_command('nova-manage cell_v2 list_cells | grep -q cell0').and_return(false)
|
||||||
|
stub_command('nova-manage cell_v2 list_cells | grep -q cell1').and_return(false)
|
||||||
|
stub_command('nova-manage cell_v2 discover_hosts').and_return(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,12 +118,18 @@ shared_examples 'expect_runs_nova_common_recipe' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
shared_examples 'expect_runs_nova_cell_recipe' do
|
||||||
|
it 'includes _nova_cell' do
|
||||||
|
expect(chef_run).to include_recipe 'openstack-compute::_nova_cell'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
shared_examples 'expect_creates_nova_state_dir' do
|
shared_examples 'expect_creates_nova_state_dir' do
|
||||||
it 'creates the /var/lib/nova/lock directory' do
|
it 'creates the /var/lib/nova/lock directory' do
|
||||||
expect(chef_run).to create_directory('/var/lib/nova').with(
|
expect(chef_run).to create_directory('/var/lib/nova').with(
|
||||||
user: 'nova',
|
user: 'nova',
|
||||||
group: 'nova',
|
group: 'nova',
|
||||||
mode: 0755
|
mode: 0o755
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -124,7 +139,7 @@ shared_examples 'expect_creates_nova_lock_dir' do
|
||||||
expect(chef_run).to create_directory('/var/lib/nova/lock').with(
|
expect(chef_run).to create_directory('/var/lib/nova/lock').with(
|
||||||
user: 'nova',
|
user: 'nova',
|
||||||
group: 'nova',
|
group: 'nova',
|
||||||
mode: 0755
|
mode: 0o755
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -134,7 +149,7 @@ shared_examples 'expect_creates_nova_instances_dir' do
|
||||||
expect(chef_run).to create_directory('/var/lib/nova/instances').with(
|
expect(chef_run).to create_directory('/var/lib/nova/instances').with(
|
||||||
user: 'nova',
|
user: 'nova',
|
||||||
group: 'nova',
|
group: 'nova',
|
||||||
mode: 0755
|
mode: 0o755
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -145,7 +160,7 @@ shared_examples 'expect_creates_api_paste_template' do
|
||||||
expect(chef_run).to create_template('/etc/nova/api-paste.ini').with(
|
expect(chef_run).to create_template('/etc/nova/api-paste.ini').with(
|
||||||
user: 'nova',
|
user: 'nova',
|
||||||
group: 'nova',
|
group: 'nova',
|
||||||
mode: 0644
|
mode: 0o644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue