Browse Source

Updates for Train

The major change in this release is that the placement-api code base has been
removed from nova and put into it's own project called placement [1]. Users who
are coming from Stein will need to follow the upgrade guide [2] to properly
upgrade to the new service.

All attributes related to placement-api have been moved into their own files
including configuration file attributes for placement.conf.

Added:
- Template to manage /etc/placement/placement.conf
- Include openstack-compute::_nova_cell recipe to nova-setup so that the db
  migrations happen properly

Changed:
- Update release to train
- Migrated from nova-placement-api to placement-api [1]

Fixed:
- Cookstyle & ChefSpec
- Ordering of db syncs which was causing issues for Train
- Set default['openstack']['compute']['syslog']['use'] to false by default
- Various comments

Removed:
- Removed references to nova-consoleauth which has been removed upstream [3]
- Removed references to xvpvnc which was removed upstream
- Unused .rubocop.yml and .rubocop_todo.yml

[1] https://docs.openstack.org/releasenotes/placement/train.html
[2] https://docs.openstack.org/placement/latest/admin/upgrade-to-stein.html
[3] https://docs.openstack.org/releasenotes/nova/train.html#prelude

Change-Id: I996bcd2f63a080e10fadf0c7adf9a0ddcb0b5c7a
Depends-On: https://review.opendev.org/731859
Depends-On: https://review.opendev.org/731860
Depends-On: https://review.opendev.org/731861
changes/65/731865/2
Lance Albertson 11 months ago
parent
commit
6c69ce58b1
23 changed files with 304 additions and 211 deletions
  1. +0
    -16
      .rubocop.yml
  2. +0
    -21
      .rubocop_todo.yml
  3. +1
    -1
      Berksfile
  4. +7
    -7
      README.rst
  5. +6
    -23
      attributes/default.rb
  6. +1
    -1
      attributes/nova_conf.rb
  7. +57
    -0
      attributes/placement.rb
  8. +20
    -0
      attributes/placement_conf.rb
  9. +6
    -6
      metadata.rb
  10. +10
    -9
      recipes/_nova_cell.rb
  11. +0
    -7
      recipes/nova-common.rb
  12. +1
    -0
      recipes/nova-setup.rb
  13. +83
    -32
      recipes/placement_api.rb
  14. +0
    -12
      recipes/vncproxy.rb
  15. +15
    -3
      spec/_nova_cell_spec.rb
  16. +1
    -1
      spec/api-metadata_spec.rb
  17. +1
    -1
      spec/api-os-compute_spec.rb
  18. +0
    -3
      spec/nova-common_spec.rb
  19. +3
    -7
      spec/placement_api-redhat_spec.rb
  20. +86
    -37
      spec/placement_api_spec.rb
  21. +6
    -0
      spec/spec_helper.rb
  22. +0
    -12
      spec/vncproxy-redhat_spec.rb
  23. +0
    -12
      spec/vncproxy_spec.rb

+ 0
- 16
.rubocop.yml View File

@ -1,16 +0,0 @@
inherit_from: .rubocop_todo.yml
AllCops:
Include:
- metadata.rb
- Gemfile
- attributes/**
- libraries/**
- providers/**
- recipes/**
- resources/**
- spec/**
Exclude:
- .cookbooks/**/*
- berks-cookbooks/**/*
- .bundle/**/*

+ 0
- 21
.rubocop_todo.yml View File

@ -1,21 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-08-03 20:56:54 -0700 using RuboCop version 0.55.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 3
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'attributes/nova_conf.rb'
- 'recipes/libvirt.rb'
- 'recipes/nova-common.rb'
# Offense count: 97
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 171

+ 1
- 1
Berksfile View File

@ -11,7 +11,7 @@ solver :ruby, :required
%w(-integration-test integration),
%w(-network dep),
%w(-ops-database integration),
%w(-ops-messaging integration)
%w(-ops-messaging integration),
].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group


+ 7
- 7
README.rst View File

@ -21,7 +21,7 @@ Requirements
============
- Chef 15 or higher
- Chef Workstation 0.15.18 for testing (also includes Berkshelf for
- Chef Workstation 0.18.3 for testing (also includes Berkshelf for
cookbook dependency resolution)
Platform
@ -36,12 +36,12 @@ Cookbooks
The following cookbooks are dependencies:
- 'apache2', '~> 8.0'
- 'openstackclient', '>= 0.1.0'
- 'openstack-common', '>= 19.0.0'
- 'openstack-identity', '>= 19.0.0'
- 'openstack-image', '>= 19.0.0'
- 'openstack-network', '>= 19.0.0'
- 'apache2', '~> 8.1'
- 'openstackclient'
- 'openstack-common', '>= 20.0.0'
- 'openstack-identity', '>= 20.0.0'
- 'openstack-image', '>= 20.0.0'
- 'openstack-network', '>= 20.0.0'
Attributes
==========


+ 6
- 23
attributes/default.rb View File

@ -19,6 +19,7 @@ default['openstack']['compute']['user'] = 'nova'
default['openstack']['compute']['group'] = 'nova'
# Logging stuff
default['openstack']['compute']['syslog']['use'] = false
default['openstack']['compute']['syslog']['facility'] = 'LOG_LOCAL1'
default['openstack']['compute']['syslog']['config_facility'] = 'local1'
@ -30,7 +31,7 @@ default['openstack']['compute']['rootwrap']['syslog_log_facility'] = 'syslog'
default['openstack']['compute']['rootwrap']['syslog_log_level'] = 'ERROR'
# SSL settings
%w(api placement metadata).each do |service|
%w(api metadata).each do |service|
default['openstack']['compute'][service]['ssl']['enabled'] = false
default['openstack']['compute'][service]['ssl']['certfile'] = ''
default['openstack']['compute'][service]['ssl']['chainfile'] = ''
@ -45,8 +46,6 @@ end
# https://docs.openstack.org/releasenotes/nova/stein.html#known-issues
default['openstack']['compute']['api']['threads'] = 1
default['openstack']['compute']['api']['processes'] = 6
default['openstack']['compute']['placement']['threads'] = 10
default['openstack']['compute']['placement']['processes'] = 2
default['openstack']['compute']['metadata']['threads'] = 10
default['openstack']['compute']['metadata']['processes'] = 2
@ -56,8 +55,6 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['compute']['platform'] = {
'api_os_compute_packages' => ['openstack-nova-api'],
'api_os_compute_service' => 'openstack-nova-api',
'api_placement_packages' => ['openstack-nova-placement-api'],
'api_placement_service' => 'openstack-nova-placement-api',
'memcache_python_packages' => ['python-memcached'],
'compute_api_metadata_packages' => ['openstack-nova-api'],
'compute_api_metadata_service' => 'openstack-nova-metadata-api',
@ -71,8 +68,6 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'compute_conductor_service' => 'openstack-nova-conductor',
'compute_vncproxy_packages' => ['openstack-nova-novncproxy'],
'compute_vncproxy_service' => 'openstack-nova-novncproxy',
'compute_vncproxy_consoleauth_packages' => ['openstack-nova-console'],
'compute_vncproxy_consoleauth_service' => 'openstack-nova-consoleauth',
'compute_serialproxy_packages' => ['openstack-nova-serialproxy'],
'compute_serialproxy_service' => 'openstack-nova-serialproxy',
'libvirt_packages' => %w(libvirt device-mapper python-libguestfs),
@ -90,8 +85,6 @@ when 'debian'
default['openstack']['compute']['platform'] = {
'api_os_compute_packages' => %w(python3-nova nova-api),
'api_os_compute_service' => 'nova-api',
'api_placement_packages' => %w(python3-nova libapache2-mod-wsgi-py3 nova-placement-api),
'api_placement_service' => 'nova-placement-api',
'memcache_python_packages' => ['python3-memcache'],
'compute_api_metadata_packages' => %w(python3-nova nova-api-metadata),
'compute_api_metadata_service' => 'nova-api-metadata',
@ -106,8 +99,6 @@ when 'debian'
# Websockify is needed due to https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1076442
'compute_vncproxy_packages' => %w(novnc websockify python3-nova nova-novncproxy),
'compute_vncproxy_service' => 'nova-novncproxy',
'compute_vncproxy_consoleauth_packages' => %w(python3-nova nova-consoleauth),
'compute_vncproxy_consoleauth_service' => 'nova-consoleauth',
'compute_serialproxy_packages' => %w(python3-nova nova-serialproxy),
'compute_serialproxy_service' => 'nova-serialproxy',
'libvirt_packages' => %w(libvirt-bin python3-guestfs),
@ -126,11 +117,12 @@ default['openstack']['compute']['misc_paste'] = nil
# ****************** OpenStack Compute Endpoints ******************************
# The OpenStack Compute (Nova) XVPvnc endpoint
# The OpenStack Compute (Nova) endpoints
%w(
compute-xvpvnc compute-novnc
compute-api
compute-metadata-api
compute-vnc compute-api
compute-novnc
compute-vnc
).each do |service|
default['openstack']['bind_service']['all'][service]['host'] = '127.0.0.1'
%w(public internal).each do |type|
@ -139,8 +131,6 @@ default['openstack']['compute']['misc_paste'] = nil
end
end
%w(public internal).each do |type|
default['openstack']['endpoints'][type]['compute-xvpvnc']['port'] = '6081'
default['openstack']['endpoints'][type]['compute-xvpvnc']['path'] = '/console'
# The OpenStack Compute (Nova) Native API endpoint
default['openstack']['endpoints'][type]['compute-api']['port'] = '8774'
default['openstack']['endpoints'][type]['compute-api']['path'] = '/v2.1/%(tenant_id)s'
@ -155,15 +145,10 @@ end
default['openstack']['endpoints'][type]['compute-serial-proxy']['port'] = '6083'
default['openstack']['endpoints'][type]['compute-serial-proxy']['path'] = '/'
default['openstack']['endpoints'][type]['compute-serial-proxy']['host'] = '127.0.0.1'
# The OpenStack Compute (Nova) Placement API endpoint
default['openstack']['endpoints'][type]['placement-api']['port'] = '8778'
default['openstack']['endpoints'][type]['placement-api']['path'] = ''
default['openstack']['endpoints'][type]['placement-api']['host'] = '127.0.0.1'
end
default['openstack']['bind_service']['all']['compute-serial-proxy']['host'] = '127.0.0.1'
default['openstack']['bind_service']['all']['compute-vnc-proxy']['host'] = '127.0.0.1'
default['openstack']['bind_service']['all']['compute-serial-console']['host'] = '127.0.0.1'
default['openstack']['bind_service']['all']['compute-xvpvnc']['port'] = '6081'
default['openstack']['bind_service']['all']['compute-vnc']['port'] = '6081'
default['openstack']['bind_service']['all']['compute-serial-proxy']['port'] = '6081'
default['openstack']['bind_service']['all']['compute-novnc']['port'] = '6080'
@ -171,5 +156,3 @@ default['openstack']['bind_service']['all']['compute-metadata-api']['host'] = '1
default['openstack']['bind_service']['all']['compute-metadata-api']['port'] = '8775'
default['openstack']['bind_service']['all']['compute-api']['host'] = '127.0.0.1'
default['openstack']['bind_service']['all']['compute-api']['port'] = '8774'
default['openstack']['bind_service']['all']['placement-api']['port'] = '8778'
default['openstack']['bind_service']['all']['placement-api']['host'] = '127.0.0.1'

+ 1
- 1
attributes/nova_conf.rb View File

@ -8,7 +8,7 @@ default['openstack']['compute']['conf'].tap do |conf|
conf['DEFAULT']['compute_driver'] = 'libvirt.LibvirtDriver'
conf['DEFAULT']['instances_path'] = "#{node['openstack']['compute']['conf']['DEFAULT']['state_path']}/instances"
conf['DEFAULT']['enabled_apis'] = 'osapi_compute,metadata'
if node['openstack']['compute']['syslog']['use'] #= false
if node['openstack']['compute']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
end


+ 57
- 0
attributes/placement.rb View File

@ -0,0 +1,57 @@
# encoding: UTF-8
#
# Set to some text value if you want templated config files
# to contain a custom banner at the top of the written file
default['openstack']['placement']['custom_template_banner'] = '
# This file is automatically generated by Chef
# Any changes will be overwritten
'
default['openstack']['placement']['user'] = 'placement'
default['openstack']['placement']['group'] = 'placement'
# Logging stuff
default['openstack']['placement']['syslog']['use'] = false
# SSL settings
default['openstack']['placement']['ssl']['enabled'] = false
default['openstack']['placement']['ssl']['certfile'] = ''
default['openstack']['placement']['ssl']['chainfile'] = ''
default['openstack']['placement']['ssl']['keyfile'] = ''
default['openstack']['placement']['ssl']['ca_certs_path'] = ''
default['openstack']['placement']['ssl']['cert_required'] = false
default['openstack']['placement']['ssl']['protocol'] = ''
default['openstack']['placement']['ssl']['ciphers'] = ''
# Apache wsgi settings for vhost
default['openstack']['placement']['threads'] = 10
default['openstack']['placement']['processes'] = 2
# Platform specific settings
case node['platform_family']
when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['placement']['platform'] = {
'placement_packages' => ['openstack-placement-api'],
'placement_service' => 'openstack-placement-api',
}
when 'debian'
default['openstack']['placement']['platform'] = {
'placement_packages' => %w(python3-placement libapache2-mod-wsgi-py3),
'placement_service' => 'placement-api',
}
end
# Array of options for `api-paste.ini` (e.g. ['option1=value1', ...])
default['openstack']['placement']['misc_paste'] = nil
# ****************** OpenStack Compute Endpoints ******************************
%w(public internal).each do |type|
# The OpenStack Placement API endpoint
default['openstack']['endpoints'][type]['placement-api']['port'] = '8778'
default['openstack']['endpoints'][type]['placement-api']['path'] = ''
default['openstack']['endpoints'][type]['placement-api']['host'] = '127.0.0.1'
end
default['openstack']['bind_service']['all']['placement-api']['port'] = '8778'
default['openstack']['bind_service']['all']['placement-api']['host'] = '127.0.0.1'

+ 20
- 0
attributes/placement_conf.rb View File

@ -0,0 +1,20 @@
default['openstack']['placement']['conf_secrets'] = {}
default['openstack']['placement']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['log_dir'] = '/var/log/placement'
conf['DEFAULT']['state_path'] = '/var/lib/placement'
if node['openstack']['placement']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
end
# [api]
conf['api']['auth_strategy'] = 'keystone'
# [keystone_authtoken]
conf['keystone_authtoken']['auth_type'] = 'password'
conf['keystone_authtoken']['username'] = 'placement'
conf['keystone_authtoken']['user_domain_name'] = 'Default'
conf['keystone_authtoken']['project_domain_name'] = 'Default'
conf['keystone_authtoken']['project_name'] = 'service'
end

+ 6
- 6
metadata.rb View File

@ -5,7 +5,7 @@ issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-compute'
license 'Apache-2.0'
description 'The OpenStack Compute service Nova.'
version '19.0.0'
version '20.0.0'
chef_version '>= 15.0'
@ -13,9 +13,9 @@ chef_version '>= 15.0'
supports os
end
depends 'apache2', '~> 8.0'
depends 'openstack-common', '>= 19.0.0'
depends 'openstack-identity', '>= 19.0.0'
depends 'openstack-image', '>= 19.0.0'
depends 'openstack-network', '>= 19.0.0'
depends 'apache2', '~> 8.1'
depends 'openstack-common', '>= 20.0.0'
depends 'openstack-identity', '>= 20.0.0'
depends 'openstack-image', '>= 20.0.0'
depends 'openstack-network', '>= 20.0.0'
depends 'openstackclient'

+ 10
- 9
recipes/_nova_cell.rb View File

@ -32,27 +32,28 @@ db_user = node['openstack']['db']['compute_cell0']['username']
db_password = get_password('db', 'nova_cell0')
uri = db_uri('compute_cell0', db_user, db_password)
execute 'map cell0' do
execute 'api db sync' do
timeout node['openstack']['compute']['dbsync_timeout']
user nova_user
group nova_group
command "nova-manage cell_v2 map_cell0 --database_connection #{uri}"
not_if 'nova-manage cell_v2 list_cells | grep -q cell0'
command 'nova-manage api_db sync'
action :run
end
execute 'create cell1' do
execute 'map cell0' 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'
command "nova-manage cell_v2 map_cell0 --database_connection #{uri}"
not_if 'nova-manage cell_v2 list_cells | grep -q cell0'
sensitive true
action :run
end
execute 'api db sync' do
timeout node['openstack']['compute']['dbsync_timeout']
execute 'create cell1' do
user nova_user
group nova_group
command 'nova-manage api_db sync'
command 'nova-manage cell_v2 create_cell --verbose --name cell1'
not_if 'nova-manage cell_v2 list_cells | grep -q cell1'
action :run
end


+ 0
- 7
recipes/nova-common.rb View File

@ -100,9 +100,6 @@ memcache_servers = memcached_servers.join ','
# internal/public. We'll stick with the general endpoint routine
# for those.
identity_endpoint = internal_endpoint 'identity'
xvpvnc_endpoint = public_endpoint 'compute-xvpvnc'
xvpvnc_bind = node['openstack']['bind_service']['all']['compute-xvpvnc']
xvpvnc_bind_address = bind_address xvpvnc_bind
novnc_endpoint = public_endpoint 'compute-novnc'
novnc_bind = node['openstack']['bind_service']['all']['compute-novnc']
novnc_bind_address = bind_address novnc_bind
@ -120,7 +117,6 @@ network_endpoint = internal_endpoint 'network'
image_endpoint = internal_endpoint 'image_api'
Chef::Log.debug("openstack-compute::nova-common:identity_endpoint|#{identity_endpoint}")
Chef::Log.debug("openstack-compute::nova-common:xvpvnc_endpoint|#{xvpvnc_endpoint}")
Chef::Log.debug("openstack-compute::nova-common:novnc_endpoint|#{novnc_endpoint}")
Chef::Log.debug("openstack-compute::nova-common:compute_api_endpoint|#{::URI.decode compute_api_endpoint.to_s}")
Chef::Log.debug("openstack-compute::nova-common:network_endpoint|#{network_endpoint}")
@ -152,9 +148,6 @@ node.default['openstack']['compute']['conf'].tap do |conf|
conf['DEFAULT']['metadata_listen'] = compute_metadata_api_bind_address
conf['DEFAULT']['metadata_listen_port'] = compute_metadata_api_bind['port']
conf['vnc']['novncproxy_base_url'] = novnc_endpoint.to_s
conf['vnc']['xvpvncproxy_base_url'] = xvpvnc_endpoint.to_s
conf['vnc']['xvpvncproxy_host'] = xvpvnc_bind_address
conf['vnc']['xvpvncproxy_port'] = xvpvnc_bind['port']
conf['vnc']['novncproxy_host'] = novnc_bind_address
conf['vnc']['novncproxy_port'] = novnc_bind['port']
conf['vnc']['server_listen'] = vnc_bind_address


+ 1
- 0
recipes/nova-setup.rb View File

@ -23,6 +23,7 @@ class ::Chef::Recipe
end
include_recipe 'openstack-compute::nova-common'
include_recipe 'openstack-compute::_nova_cell'
nova_user = node['openstack']['compute']['user']
nova_group = node['openstack']['compute']['group']


+ 83
- 32
recipes/placement_api.rb View File

@ -26,26 +26,80 @@ end
include_recipe 'openstack-compute::nova-common'
# Create valid apache site configuration file before installing package
bind_service = node['openstack']['bind_service']['all']['placement-api']
nova_user = node['openstack']['compute']['user']
nova_group = node['openstack']['compute']['group']
placement_user = node['openstack']['placement']['user']
placement_group = node['openstack']['placement']['group']
platform_options = node['openstack']['placement']['platform']
platform_options = node['openstack']['compute']['platform']
package platform_options['api_placement_packages'] do
package platform_options['placement_packages'] do
options platform_options['package_overrides']
action :upgrade
end
service platform_options['api_placement_service'] do
service platform_options['placement_service'] do
supports status: true, restart: true
action [:disable, :stop]
end
apache2_site 'nova-placement-api' do
action :disable
only_if { platform_family?('debian') }
db_user = node['openstack']['db']['placement']['username']
db_pass = get_password 'db', 'placement'
identity_endpoint = internal_endpoint 'identity'
auth_url = ::URI.decode identity_endpoint.to_s
node.default['openstack']['placement']['conf_secrets']
.[]('placement_database')['connection'] =
db_uri('placement', db_user, db_pass)
node.default['openstack']['placement']['conf_secrets']
.[]('keystone_authtoken')['password'] =
get_password 'service', 'openstack-placement'
if node['openstack']['endpoints']['db']['enabled_slave']
node.default['openstack']['placement']['conf_secrets']
.[]('placement_database')['slave_connection'] =
db_uri('placement', db_user, db_pass, true)
end
if node['openstack']['mq']['service_type'] == 'rabbit'
node.default['openstack']['placement']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'placement'
end
memcache_servers = memcached_servers.join ','
placement_api_endpoint = internal_endpoint 'placement-api'
Chef::Log.debug("openstack-compute::placement_api:placement_api_endpoint|#{::URI.decode placement_api_endpoint.to_s}")
node.default['openstack']['placement']['conf'].tap do |conf|
unless memcache_servers.empty?
# Need to set the backend explicitly, see LP bug #1572062
conf['cache']['backend'] = 'oslo_cache.memcache_pool'
conf['cache']['enabled'] = 'true'
conf['cache']['memcache_servers'] = memcache_servers
end
# [keystone_authtoken] section
conf['keystone_authtoken']['auth_url'] = auth_url
conf['keystone_authtoken']['www_authenticate_uri'] = auth_url
end
# merge all config options and secrets to be used in placement.conf
placement_conf_options = merge_config_options 'placement'
template '/etc/placement/placement.conf' do
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['placement']['user']
group node['openstack']['placement']['group']
mode '640'
sensitive true
variables(
service_config: placement_conf_options
)
notifies :restart, 'service[apache2]'
end
# delete all secrets saved in the attribute
# node['openstack']['placement']['conf_secrets'] after creating the placement.conf
ruby_block "delete all attributes in node['openstack']['placement']['conf_secrets']" do
block do
node.rm(:openstack, :placement, :conf_secrets)
end
end
# Finds and appends the listen port to the apache2_install[openstack]
@ -61,42 +115,39 @@ else
end
apache2_module 'wsgi'
apache2_module 'ssl' if node['openstack']['compute']['placement']['ssl']['enabled']
apache2_module 'ssl' if node['openstack']['placement']['ssl']['enabled']
template "#{apache_dir}/sites-available/nova-placement.conf" do
template "#{apache_dir}/sites-available/placement.conf" do
extend Apache2::Cookbook::Helpers
source 'wsgi-template.conf.erb'
variables(
daemon_process: 'placement-api',
server_host: bind_service['host'],
server_port: bind_service['port'],
server_entry: '/usr/bin/nova-placement-api',
server_entry: '/usr/bin/placement-api',
log_dir: default_log_dir,
run_dir: lock_dir,
user: nova_user,
group: nova_user,
processes: node['openstack']['compute']['placement']['processes'],
threads: node['openstack']['compute']['placement']['threads'],
use_ssl: node['openstack']['compute']['placement']['ssl']['enabled'],
cert_file: node['openstack']['compute']['placement']['ssl']['certfile'],
chain_file: node['openstack']['compute']['placement']['ssl']['chainfile'],
key_file: node['openstack']['compute']['placement']['ssl']['keyfile'],
ca_certs_path: node['openstack']['compute']['placement']['ssl']['ca_certs_path'],
cert_required: node['openstack']['compute']['placement']['ssl']['cert_required'],
protocol: node['openstack']['compute']['placement']['ssl']['protocol'],
ciphers: node['openstack']['compute']['placement']['ssl']['ciphers']
user: placement_user,
group: placement_user,
processes: node['openstack']['placement']['processes'],
threads: node['openstack']['placement']['threads'],
use_ssl: node['openstack']['placement']['ssl']['enabled'],
cert_file: node['openstack']['placement']['ssl']['certfile'],
chain_file: node['openstack']['placement']['ssl']['chainfile'],
key_file: node['openstack']['placement']['ssl']['keyfile'],
ca_certs_path: node['openstack']['placement']['ssl']['ca_certs_path'],
cert_required: node['openstack']['placement']['ssl']['cert_required'],
protocol: node['openstack']['placement']['ssl']['protocol'],
ciphers: node['openstack']['placement']['ssl']['ciphers']
)
notifies :restart, 'service[apache2]'
end
apache2_site 'nova-placement' do
apache2_site 'placement' do
notifies :restart, 'service[apache2]', :immediately
end
execute 'placement-api: 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
execute 'placement-manage db sync' do
user placement_user
group placement_group
end

+ 0
- 12
recipes/vncproxy.rb View File

@ -29,11 +29,6 @@ package platform_options['compute_vncproxy_packages'] do
action :upgrade
end
# required for vnc console authentication
package platform_options['compute_vncproxy_consoleauth_packages'] do
action :upgrade
end
proxy_service = platform_options['compute_vncproxy_service']
service proxy_service do
@ -42,10 +37,3 @@ service proxy_service do
action [:enable, :start]
subscribes :restart, 'template[/etc/nova/nova.conf]'
end
service 'nova-consoleauth' do
service_name platform_options['compute_vncproxy_consoleauth_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, 'template[/etc/nova/nova.conf]'
end

+ 15
- 3
spec/_nova_cell_spec.rb View File

@ -12,15 +12,27 @@ describe 'openstack-compute::_nova_cell' do
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')
expect(chef_run).to run_execute('map cell0').with(
user: 'nova',
group: 'nova',
command: 'nova-manage cell_v2 map_cell0 --database_connection mysql+pymysql://nova_cell0:nova_cell0_db_pass@127.0.0.1:3306/nova_cell0?charset=utf8'
)
end
it 'creates a new cell' do
expect(chef_run).to run_execute('create cell1').with(user: 'nova', group: 'nova')
expect(chef_run).to run_execute('create cell1').with(
user: 'nova',
group: 'nova',
command: 'nova-manage cell_v2 create_cell --verbose --name cell1'
)
end
it 'executes api_db sync' do
expect(chef_run).to run_execute('api db sync').with(user: 'nova', group: 'nova')
expect(chef_run).to run_execute('api db sync').with(
user: 'nova',
group: 'nova',
command: 'nova-manage api_db sync'
)
end
it 'executes db sync' do


+ 1
- 1
spec/api-metadata_spec.rb View File

@ -24,7 +24,7 @@ describe 'openstack-compute::api-metadata' do
end
it do
expect(chef_run).to install_apache2_install('openstack').with(listen: '127.0.0.1:8775')
expect(chef_run).to install_apache2_install('openstack').with(listen: %w(127.0.0.1:8775))
end
it do


+ 1
- 1
spec/api-os-compute_spec.rb View File

@ -33,7 +33,7 @@ describe 'openstack-compute::api-os-compute' do
expect(chef_run).to stop_service 'nova-api-os-compute'
end
it do
expect(chef_run).to install_apache2_install('openstack').with(listen: '127.0.0.1:8774')
expect(chef_run).to install_apache2_install('openstack').with(listen: %w(127.0.0.1:8774))
end
it do


+ 0
- 3
spec/nova-common_spec.rb View File

@ -249,9 +249,6 @@ describe 'openstack-compute::nova-common' do
it '[vnc]' do
[
%r{^novncproxy_base_url = http://127.0.0.1:6080/vnc_auto.html$},
%r{^xvpvncproxy_base_url = http://127.0.0.1:6081/console$},
/^xvpvncproxy_host = 127.0.0.1$/,
/^xvpvncproxy_port = 6081$/,
/^novncproxy_host = 127.0.0.1$/,
/^novncproxy_port = 6080$/,
/^server_listen = 127.0.0.1$/,


+ 3
- 7
spec/placement_api-redhat_spec.rb View File

@ -14,16 +14,12 @@ describe 'openstack-compute::placement_api' do
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades placement packages' do
expect(chef_run).to upgrade_package 'openstack-nova-placement-api'
expect(chef_run).to upgrade_package 'openstack-placement-api'
end
it do
expect(chef_run).to disable_service 'openstack-nova-placement-api'
expect(chef_run).to stop_service 'openstack-nova-placement-api'
end
it do
expect(chef_run).to_not disable_apache2_site('nova-placement-api')
expect(chef_run).to disable_service 'openstack-placement-api'
expect(chef_run).to stop_service 'openstack-placement-api'
end
end
end

+ 86
- 37
spec/placement_api_spec.rb View File

@ -15,29 +15,23 @@ describe 'openstack-compute::placement_api' do
end
it do
expect(chef_run).to upgrade_package %w(python3-nova libapache2-mod-wsgi-py3 nova-placement-api)
end
it 'executes placement-api: nova-manage api_db sync' do
expect(chef_run).to run_execute('placement-api: nova-manage api_db sync').with(
timeout: 3600,
user: 'nova',
group: 'nova',
command: 'nova-manage api_db sync'
)
expect(chef_run).to upgrade_package %w(python3-placement libapache2-mod-wsgi-py3)
end
it do
expect(chef_run).to disable_service 'nova-placement-api'
expect(chef_run).to stop_service 'nova-placement-api'
expect(chef_run).to run_execute('placement-manage db sync').with(
user: 'placement',
group: 'placement'
)
end
it do
expect(chef_run).to disable_apache2_site('nova-placement-api')
expect(chef_run).to disable_service 'placement-api'
expect(chef_run).to stop_service 'placement-api'
end
it do
expect(chef_run).to install_apache2_install('openstack').with(listen: '127.0.0.1:8778')
expect(chef_run).to install_apache2_install('openstack').with(listen: %w(127.0.0.1:8778))
end
it do
@ -48,8 +42,63 @@ describe 'openstack-compute::placement_api' do
expect(chef_run).to_not enable_apache2_module('ssl')
end
describe 'placement.conf' do
let(:file) { chef_run.template('/etc/placement/placement.conf') }
it do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
owner: 'placement',
group: 'placement',
mode: '640',
sensitive: true
)
end
it do
expect(chef_run.template('/etc/placement/placement.conf')).to notify('service[apache2]').to(:restart)
end
it '[DEFAULT]' do
[
%r{^log_dir = /var/log/placement$},
%r{^state_path = /var/lib/placement$},
%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
it '[placement_database]' do
[
%r{^connection = mysql\+pymysql://placement:placement_db_pass@127.0.0.1:3306/placement\?charset=utf8$},
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('placement_database', line)
end
end
it '[keystone_authtoken]' do
[
/^auth_type = password$/,
/^username = placement$/,
/^user_domain_name = Default$/,
/^project_domain_name = Default$/,
/^project_name = service$/,
%r{^auth_url = http://127.0.0.1:5000/v3$},
%r{^www_authenticate_uri = http://127.0.0.1:5000/v3$},
/^password = placement-pass$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line)
end
end
it '[api]' do
[
/^auth_strategy = keystone$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('api', line)
end
end
end
it do
expect(chef_run).to create_template('/etc/apache2/sites-available/nova-placement.conf').with(
expect(chef_run).to create_template('/etc/apache2/sites-available/placement.conf').with(
source: 'wsgi-template.conf.erb',
variables: {
ca_certs_path: '',
@ -58,33 +107,33 @@ describe 'openstack-compute::placement_api' do
chain_file: '',
ciphers: '',
daemon_process: 'placement-api',
group: 'nova',
group: 'placement',
key_file: '',
log_dir: '/var/log/apache2',
processes: 2,
protocol: '',
run_dir: '/var/lock/apache2',
server_entry: '/usr/bin/nova-placement-api',
server_entry: '/usr/bin/placement-api',
server_host: '127.0.0.1',
server_port: '8778',
threads: 10,
user: 'nova',
user: 'placement',
use_ssl: false,
}
)
end
[
/<VirtualHost 127.0.0.1:8778>$/,
/WSGIDaemonProcess placement-api processes=2 threads=10 user=nova group=nova display-name=%{GROUP}$/,
/WSGIDaemonProcess placement-api processes=2 threads=10 user=placement group=placement display-name=%{GROUP}$/,
/WSGIProcessGroup placement-api$/,
%r{WSGIScriptAlias / /usr/bin/nova-placement-api$},
%r{WSGIScriptAlias / /usr/bin/placement-api$},
/WSGIApplicationGroup %{GLOBAL}$/,
%r{ErrorLog /var/log/apache2/placement-api_error.log$},
%r{CustomLog /var/log/apache2/placement-api_access.log combined$},
%r{WSGISocketPrefix /var/lock/apache2$},
].each do |line|
it do
expect(chef_run).to render_file('/etc/apache2/sites-available/nova-placement.conf').with_content(line)
expect(chef_run).to render_file('/etc/apache2/sites-available/placement.conf').with_content(line)
end
end
@ -99,17 +148,17 @@ describe 'openstack-compute::placement_api' do
/SSLVerifyClient require/,
].each do |line|
it do
expect(chef_run).to_not render_file('/etc/apache2/sites-available/nova-placement.conf').with_content(line)
expect(chef_run).to_not render_file('/etc/apache2/sites-available/placement.conf').with_content(line)
end
end
context 'Enable SSL' do
cached(:chef_run) do
node.override['openstack']['compute']['placement']['ssl']['enabled'] = true
node.override['openstack']['compute']['placement']['ssl']['certfile'] = 'ssl.cert'
node.override['openstack']['compute']['placement']['ssl']['keyfile'] = 'ssl.key'
node.override['openstack']['compute']['placement']['ssl']['ca_certs_path'] = 'ca_certs_path'
node.override['openstack']['compute']['placement']['ssl']['protocol'] = 'ssl_protocol_value'
node.override['openstack']['placement']['ssl']['enabled'] = true
node.override['openstack']['placement']['ssl']['certfile'] = 'ssl.cert'
node.override['openstack']['placement']['ssl']['keyfile'] = 'ssl.key'
node.override['openstack']['placement']['ssl']['ca_certs_path'] = 'ca_certs_path'
node.override['openstack']['placement']['ssl']['protocol'] = 'ssl_protocol_value'
runner.converge(described_recipe)
end
@ -125,7 +174,7 @@ describe 'openstack-compute::placement_api' do
/SSLProtocol ssl_protocol_value$/,
].each do |line|
it do
expect(chef_run).to render_file('/etc/apache2/sites-available/nova-placement.conf').with_content(line)
expect(chef_run).to render_file('/etc/apache2/sites-available/placement.conf').with_content(line)
end
end
[
@ -134,15 +183,15 @@ describe 'openstack-compute::placement_api' do
/SSLVerifyClient require/,
].each do |line|
it do
expect(chef_run).to_not render_file('/etc/apache2/sites-available/nova-placement.conf').with_content(line)
expect(chef_run).to_not render_file('/etc/apache2/sites-available/placement.conf').with_content(line)
end
end
context 'Enable chainfile, ciphers & cert_required' do
cached(:chef_run) do
node.override['openstack']['compute']['placement']['ssl']['enabled'] = true
node.override['openstack']['compute']['placement']['ssl']['ciphers'] = 'ssl_ciphers_value'
node.override['openstack']['compute']['placement']['ssl']['chainfile'] = 'chainfile'
node.override['openstack']['compute']['placement']['ssl']['cert_required'] = true
node.override['openstack']['placement']['ssl']['enabled'] = true
node.override['openstack']['placement']['ssl']['ciphers'] = 'ssl_ciphers_value'
node.override['openstack']['placement']['ssl']['chainfile'] = 'chainfile'
node.override['openstack']['placement']['ssl']['cert_required'] = true
runner.converge(described_recipe)
end
[
@ -151,23 +200,23 @@ describe 'openstack-compute::placement_api' do
/SSLVerifyClient require/,
].each do |line|
it do
expect(chef_run).to render_file('/etc/apache2/sites-available/nova-placement.conf').with_content(line)
expect(chef_run).to render_file('/etc/apache2/sites-available/placement.conf').with_content(line)
end
end
end
end
it do
expect(chef_run.template('/etc/apache2/sites-available/nova-placement.conf')).to \
expect(chef_run.template('/etc/apache2/sites-available/placement.conf')).to \
notify('service[apache2]').to(:restart)
end
it do
expect(chef_run).to enable_apache2_site('nova-placement')
expect(chef_run).to enable_apache2_site('placement')
end
it do
expect(chef_run.apache2_site('nova-placement')).to notify('service[apache2]').to(:restart).immediately
expect(chef_run.apache2_site('placement')).to notify('service[apache2]').to(:restart).immediately
end
end
end

+ 6
- 0
spec/spec_helper.rb View File

@ -57,6 +57,9 @@ shared_context 'compute_stubs' do
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)
.with('db', 'placement')
.and_return('placement_db_pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'guest')
.and_return('mq-pass')
@ -75,6 +78,9 @@ shared_context 'compute_stubs' do
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
.with('compute')
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
.with('placement')
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
allow_any_instance_of(Chef::Recipe).to receive(:memcached_servers).and_return []
allow(Chef::Application).to receive(:fatal!)
allow(SecureRandom).to receive(:hex).and_return('ad3313264ea51d8c6a3d1c5b140b9883')


+ 0
- 12
spec/vncproxy-redhat_spec.rb View File

@ -17,10 +17,6 @@ describe 'openstack-compute::vncproxy' do
expect(chef_run).to upgrade_package('openstack-nova-novncproxy')
end
it 'upgrades nova consoleauth package' do
expect(chef_run).to upgrade_package('openstack-nova-console')
end
it 'starts nova vncproxy' do
expect(chef_run).to start_service('openstack-nova-novncproxy')
end
@ -28,13 +24,5 @@ describe 'openstack-compute::vncproxy' do
it 'starts nova vncproxy on boot' do
expect(chef_run).to enable_service('openstack-nova-novncproxy')
end
it 'starts nova consoleauth' do
expect(chef_run).to start_service('openstack-nova-consoleauth')
end
it 'starts nova consoleauth on boot' do
expect(chef_run).to enable_service('openstack-nova-consoleauth')
end
end
end

+ 0
- 12
spec/vncproxy_spec.rb View File

@ -17,10 +17,6 @@ describe 'openstack-compute::vncproxy' do
expect(chef_run).to upgrade_package %w(novnc websockify python3-nova nova-novncproxy)
end
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-consoleauth)
end
it 'starts nova vncproxy' do
expect(chef_run).to start_service('nova-novncproxy')
end
@ -28,13 +24,5 @@ describe 'openstack-compute::vncproxy' do
it 'starts nova vncproxy on boot' do
expect(chef_run).to enable_service('nova-novncproxy')
end
it 'starts nova consoleauth' do
expect(chef_run).to start_service('nova-consoleauth')
end
it 'starts nova consoleauth on boot' do
expect(chef_run).to enable_service('nova-consoleauth')
end
end
end

Loading…
Cancel
Save