Stein fixes

- Cookstyle fixes
- Refactor Berksfile to use groups so we can exclude integration testing
  cookbooks
- Update documentation
- Cleanup line wraps
- Enable sensitive resources for the template[/etc/nova/nova.conf] to
  resources improve security.
- Update delivery configuration to exclude integration cookbooks
- Fix ChefSpec output.
- Switch package installations to send packages as arrays instead of individual
  package resources. This generally speeds up chef runs.
- Cleanup array syntax using %w() instead of []
- Add metadata to enabled_apis as that is the default upstream
- Switch to user resource for managing shell for nova user
- Switch to libvirtd instead of libvirt-bin for Ubuntu service name

Depends-On: https://review.opendev.org/701027
Depends-On: https://review.opendev.org/706151
Depends-On: https://review.opendev.org/708059
Depends-On: https://review.opendev.org/706157
Change-Id: I7e03fb9dace6e288a3b21f33106245b30b52ce9d
This commit is contained in:
Lance Albertson 2020-03-15 22:53:38 -07:00
parent 868900d090
commit 2961ebabee
33 changed files with 319 additions and 350 deletions

View File

@ -1 +1,9 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml"
[local_phases]
unit = 'rspec spec/'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "berks install -e integration"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

View File

@ -14,17 +14,3 @@ AllCops:
- .cookbooks/**/*
- berks-cookbooks/**/*
- .bundle/**/*
Encoding:
Exclude:
- metadata.rb
- Gemfile
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3

View File

@ -2,21 +2,21 @@ source 'https://supermarket.chef.io'
solver :ruby, :required
%w(
client
-common
-dns
-identity
-image
-integration-test
-network
-ops-database
-ops-messaging
).each do |cookbook|
[
%w(client dep),
%w(-common dep),
%w(-dns integration),
%w(-identity dep),
%w(-image dep),
%w(-integration-test integration),
%w(-network dep),
%w(-ops-database integration),
%w(-ops-messaging integration)
].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}"
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}"
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
end
end

View File

@ -20,9 +20,9 @@ https://docs.openstack.org/nova/latest/
Requirements
============
- Chef 14 or higher
- ChefDK 3.2.30 for testing (also includes Berkshelf for cookbook
dependency resolution)
- Chef 15 or higher
- Chef Workstation 0.15.18 for testing (also includes Berkshelf for
cookbook dependency resolution)
Platform
========
@ -38,10 +38,10 @@ The following cookbooks are dependencies:
- 'apache2', '~> 8.0'
- 'openstackclient', '>= 0.1.0'
- 'openstack-common', '>= 18.0.0'
- 'openstack-identity', '>= 18.0.0'
- 'openstack-image', '>= 18.0.0'
- 'openstack-network', '>= 18.0.0'
- 'openstack-common', '>= 19.0.0'
- 'openstack-identity', '>= 19.0.0'
- 'openstack-image', '>= 19.0.0'
- 'openstack-network', '>= 19.0.0'
Attributes
==========
@ -192,7 +192,7 @@ License and Author
+-----------------+---------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, IBM, Corp. |
+-----------------+---------------------------------------------------+
| **Copyright** | Copyright (c) 2019, Oregon State University |
| **Copyright** | Copyright (c) 2019-2020, Oregon State University |
+-----------------+---------------------------------------------------+
Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -66,48 +66,48 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'compute_vncproxy_consoleauth_service' => 'openstack-nova-consoleauth',
'compute_serialproxy_packages' => ['openstack-nova-serialproxy'],
'compute_serialproxy_service' => 'openstack-nova-serialproxy',
'libvirt_packages' => ['libvirt', 'device-mapper', 'python-libguestfs'],
'libvirt_packages' => %w(libvirt device-mapper python-libguestfs),
'libvirt_service' => 'libvirtd',
'dbus_service' => 'messagebus',
'compute_cert_packages' => ['openstack-nova-cert'],
'compute_cert_service' => 'openstack-nova-cert',
'mysql_service' => 'mysqld',
'common_packages' => ['openstack-nova-common', 'mod_wsgi'],
'common_packages' => %w(openstack-nova-common mod_wsgi),
'iscsi_helper' => 'ietadm',
'volume_packages' => ['sysfsutils', 'sg3_utils', 'device-mapper-multipath'],
'volume_packages' => %w(sysfsutils sg3_utils device-mapper-multipath),
'package_overrides' => '',
}
when 'debian'
default['openstack']['compute']['platform'] = {
'api_os_compute_packages' => ['python3-nova', 'nova-api'],
'api_os_compute_packages' => %w(python3-nova nova-api),
'api_os_compute_service' => 'nova-api',
'api_placement_packages' => ['python3-nova', 'libapache2-mod-wsgi-py3', 'nova-placement-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' => ['python3-nova', 'nova-api-metadata'],
'compute_api_metadata_packages' => %w(python3-nova nova-api-metadata),
'compute_api_metadata_service' => 'nova-api-metadata',
'compute_compute_packages' => ['python3-nova', 'nova-compute'],
'qemu_compute_packages' => ['python3-nova', 'nova-compute-qemu'],
'kvm_compute_packages' => ['python3-nova', 'nova-compute-kvm'],
'compute_compute_packages' => %w(python3-nova nova-compute),
'qemu_compute_packages' => %w(python3-nova nova-compute-qemu),
'kvm_compute_packages' => %w(python3-nova nova-compute-kvm),
'compute_compute_service' => 'nova-compute',
'compute_scheduler_packages' => ['python3-nova', 'nova-scheduler'],
'compute_scheduler_packages' => %w(python3-nova nova-scheduler),
'compute_scheduler_service' => 'nova-scheduler',
'compute_conductor_packages' => ['python3-nova', 'nova-conductor'],
'compute_conductor_packages' => %w(python3-nova nova-conductor),
'compute_conductor_service' => 'nova-conductor',
# Websockify is needed due to https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1076442
'compute_vncproxy_packages' => ['novnc', 'websockify', 'python3-nova', 'nova-novncproxy'],
'compute_vncproxy_packages' => %w(novnc websockify python3-nova nova-novncproxy),
'compute_vncproxy_service' => 'nova-novncproxy',
'compute_vncproxy_consoleauth_packages' => ['python3-nova', 'nova-consoleauth'],
'compute_vncproxy_consoleauth_packages' => %w(python3-nova nova-consoleauth),
'compute_vncproxy_consoleauth_service' => 'nova-consoleauth',
'compute_serialproxy_packages' => ['python3-nova', 'nova-serialproxy'],
'compute_serialproxy_packages' => %w(python3-nova nova-serialproxy),
'compute_serialproxy_service' => 'nova-serialproxy',
'libvirt_packages' => ['libvirt-bin', 'python3-guestfs'],
'libvirt_service' => 'libvirt-bin',
'libvirt_packages' => %w(libvirt-bin python3-guestfs),
'libvirt_service' => 'libvirtd',
'dbus_service' => 'dbus',
'mysql_service' => 'mysql',
'common_packages' => ['nova-common', 'python3-nova'],
'common_packages' => %w(nova-common python3-nova),
'iscsi_helper' => 'tgtadm',
'volume_packages' => ['sysfsutils', 'sg3-utils', 'multipath-tools'],
'volume_packages' => %w(sysfsutils sg3-utils multipath-tools),
'package_overrides' => '',
}
end

View File

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

View File

@ -5,31 +5,17 @@ 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 '18.0.0'
version '19.0.0'
chef_version '>= 14.0'
recipe 'openstack-compute::api-metadata', 'Installs/Configures nova api metadata service'
recipe 'openstack-compute::api-os-compute', 'Installs/Configures nova api service'
recipe 'openstack-compute::compute', 'Installs/Configures nova compute service'
recipe 'openstack-compute::conductor', 'Installs/configures nova conductor service'
recipe 'openstack-compute::identity_registration', 'Identity registration'
recipe 'openstack-compute::libvirt', 'Installs/Configures libvirt'
recipe 'openstack-compute::nova-common', 'Common recipe for nova'
recipe 'openstack-compute::_nova_cell', 'Helper recipe for configuring nova cells'
recipe 'openstack-compute::nova-setup.rb', 'Nova setup recipe'
recipe 'openstack-compute::placement_api', 'Installs/Configures nova placement api'
recipe 'openstack-compute::scheduler', 'Installs/Configures nova scheduler service'
recipe 'openstack-compute::serialproxy', 'Installs/Configures nova serial proxy'
recipe 'openstack-compute::vncproxy', 'Installs/Configures nova vnc proxy'
chef_version '>= 15.0'
%w(ubuntu redhat centos).each do |os|
supports os
end
depends 'apache2', '~> 8.0'
depends 'openstack-common', '>= 18.0.0'
depends 'openstack-identity', '>= 18.0.0'
depends 'openstack-image', '>= 18.0.0'
depends 'openstack-network', '>= 18.0.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 'openstackclient'

View File

@ -1,9 +1,9 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: _nova_cell
#
# Copyright 2017, Workday, Inc.
# 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.

View File

@ -1,11 +1,12 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: api-metadata
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright 2018, Workday, Inc.
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2018, Workday, Inc.
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -31,18 +32,16 @@ include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['compute_api_metadata_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['compute_api_metadata_packages'] do
options platform_options['package_overrides']
action :upgrade
end
template '/etc/nova/api-paste.ini' do
source 'api-paste.ini.erb'
owner node['openstack']['compute']['user']
group node['openstack']['compute']['group']
mode 0o0644
mode '644'
notifies :restart, 'service[apache2]'
end

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: api-os-compute
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2018, Workday, Inc.
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2018, Workday, Inc.
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -28,11 +29,9 @@ include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['api_os_compute_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['api_os_compute_packages'] do
options platform_options['package_overrides']
action :upgrade
end
nova_user = node['openstack']['compute']['user']
@ -42,7 +41,7 @@ template '/etc/nova/api-paste.ini' do
source 'api-paste.ini.erb'
owner nova_user
group nova_group
mode 0o0644
mode '644'
notifies :restart, 'service[apache2]'
end

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: compute
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -26,41 +27,35 @@ end
include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['compute_compute_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['compute_compute_packages'] do
options platform_options['package_overrides']
action :upgrade
end
virt_type = node['openstack']['compute']['conf']['libvirt']['virt_type']
platform_options["#{virt_type}_compute_packages"].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options["#{virt_type}_compute_packages"] do
options platform_options['package_overrides']
action :upgrade
end
# More volume attach packages
platform_options['volume_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['volume_packages'] do
options platform_options['package_overrides']
action :upgrade
end
# TODO: (jklare) this has to be refactored!!!
cookbook_file '/etc/nova/nova-compute.conf' do
source 'nova-compute.conf'
mode 0o0644
mode '644'
action :create
end
directory node['openstack']['compute']['conf']['DEFAULT']['instances_path'] do
owner node['openstack']['compute']['user']
group node['openstack']['compute']['group']
mode 0o0755
mode '755'
recursive true
end

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: nova
# Cookbook:: nova
# Recipe:: conductor
#
# Copyright 2012, Rackspace US, Inc.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -23,11 +24,9 @@ include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['compute_conductor_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['compute_conductor_packages'] do
options platform_options['package_overrides']
action :upgrade
end
service 'nova-conductor' do

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: identity_registration
#
# Copyright 2013, AT&T
# Copyright 2013, IBM Corp.
# Copyright:: 2013, AT&T
# Copyright:: 2013, IBM Corp.
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -53,11 +54,11 @@ admin_domain = node['openstack']['identity']['admin_domain_name']
# endpoint_type = node['openstack']['identity']['endpoint_type']
connection_params = {
openstack_auth_url: auth_url,
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain,
openstack_auth_url: auth_url,
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain,
# openstack_endpoint_type: endpoint_type,
}

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: libvirt
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -23,11 +24,9 @@ require 'mixlib/shellout'
platform_options = node['openstack']['compute']['platform']
platform_options['libvirt_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['libvirt_packages'] do
options platform_options['package_overrides']
action :upgrade
end
# TODO: (jklare) methods do not belong in recipes, this has to be moved!
@ -129,7 +128,7 @@ template '/etc/libvirt/libvirtd.conf' do
source 'libvirtd.conf.erb'
owner 'root'
group 'root'
mode 0o0644
mode '644'
variables(
service_config: node['openstack']['compute']['libvirt']['conf']
)
@ -144,7 +143,7 @@ template '/etc/default/libvirtd' do
source 'libvirt-bin.erb'
owner 'root'
group 'root'
mode 0o0644
mode '644'
notifies :restart, 'service[libvirt-bin]', :immediately
only_if { platform_family? 'debian' }
end
@ -153,7 +152,7 @@ template '/etc/sysconfig/libvirtd' do
source 'libvirtd.erb'
owner 'root'
group 'root'
mode 0o0644
mode '644'
notifies :restart, 'service[libvirt-bin]', :immediately
only_if { platform_family? %w(rhel) }
end

View File

@ -1,11 +1,12 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: nova-common
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright 2014, SUSE Linux, GmbH.
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2014, SUSE Linux, GmbH.
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -30,47 +31,41 @@ include_recipe 'openstack-common::logging' if node['openstack']['compute']['sysl
platform_options = node['openstack']['compute']['platform']
platform_options['common_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['common_packages'] do
options platform_options['package_overrides']
action :upgrade
end
db_type = node['openstack']['db']['compute']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package node['openstack']['db']['python_packages'][db_type] do
options platform_options['package_overrides']
action :upgrade
end
# required to run more than one consoleauth process
platform_options['memcache_python_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['memcache_python_packages'] do
options platform_options['package_overrides']
action :upgrade
end
directory '/etc/nova' do
owner node['openstack']['compute']['user']
group node['openstack']['compute']['group']
mode 0o0750
mode '750'
action :create
end
directory node['openstack']['compute']['conf']['DEFAULT']['state_path'] do
owner node['openstack']['compute']['user']
group node['openstack']['compute']['group']
mode 0o0755
mode '755'
recursive true
end
directory node['openstack']['compute']['conf']['oslo_concurrency']['lock_path'] do
owner node['openstack']['compute']['user']
group node['openstack']['compute']['group']
mode 0o0755
mode '755'
recursive true
end
@ -208,7 +203,8 @@ template '/etc/nova/nova.conf' do
cookbook 'openstack-common'
owner node['openstack']['compute']['user']
group node['openstack']['compute']['group']
mode 0o0640
mode '640'
sensitive true
variables(
# TODO(jaypipes): No support here for >1 image API servers
# with the glance_api_servers configuration option...
@ -230,9 +226,10 @@ template '/etc/nova/rootwrap.conf' do
# Must be root!
owner 'root'
group 'root'
mode 0o0644
mode '644'
end
execute 'enable nova login' do
command "usermod -s /bin/sh #{node['openstack']['compute']['user']}"
user node['openstack']['compute']['user'] do
shell '/bin/sh'
action :modify
end

View File

@ -1,9 +1,9 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: nova-setup
#
# Copyright 2012, Rackspace US, Inc.
# Copyright:: 2012, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@ -1,9 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: placement-api
#
# Copyright 2017, OpenStack Foundation
# Copyright:: 2017, OpenStack Foundation
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -32,11 +33,9 @@ nova_group = node['openstack']['compute']['group']
platform_options = node['openstack']['compute']['platform']
platform_options['api_placement_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['api_placement_packages'] do
options platform_options['package_overrides']
action :upgrade
end
service platform_options['api_placement_service'] do

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: scheduler
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
#
# Copyright 2012, Rackspace US, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -23,11 +24,9 @@ include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['compute_scheduler_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['compute_scheduler_packages'] do
options platform_options['package_overrides']
action :upgrade
end
service 'nova-scheduler' do

View File

@ -1,8 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: serialproxy
#
# Copyright:: 2020, Oregon State University
#
# 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
@ -20,11 +22,9 @@ include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['compute_serialproxy_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['compute_serialproxy_packages'] do
options platform_options['package_overrides']
action :upgrade
end
proxy_service = platform_options['compute_serialproxy_service']

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Cookbook:: openstack-compute
# Recipe:: vncproxy
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2012, Rackspace US, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -23,18 +24,14 @@ include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['compute_vncproxy_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
package platform_options['compute_vncproxy_packages'] do
options platform_options['package_overrides']
action :upgrade
end
# required for vnc console authentication
platform_options['compute_vncproxy_consoleauth_packages'].each do |pkg|
package pkg do
action :upgrade
end
package platform_options['compute_vncproxy_consoleauth_packages'] do
action :upgrade
end
proxy_service = platform_options['compute_vncproxy_service']

View File

@ -14,9 +14,8 @@ describe 'openstack-compute::api-metadata' do
include_examples 'expect_creates_nova_lock_dir'
include_examples 'expect_creates_api_paste_template'
it 'upgrades metadata api packages' do
expect(chef_run).to upgrade_package 'nova-api-metadata'
expect(chef_run).to upgrade_package 'python3-nova'
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-api-metadata)
end
it do

View File

@ -24,9 +24,8 @@ describe 'openstack-compute::api-os-compute' do
)
end
it 'upgrades openstack api packages' do
expect(chef_run).to upgrade_package 'nova-api'
expect(chef_run).to upgrade_package 'python3-nova'
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-api)
end
it do

View File

@ -14,10 +14,8 @@ describe 'openstack-compute::compute' do
include_examples 'expect_creates_nova_lock_dir'
include_examples 'expect_creates_nova_instances_dir'
it 'upgrades volume utils packages' do
%w(sysfsutils sg3-utils multipath-tools).each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
it do
expect(chef_run).to upgrade_package %w(sysfsutils sg3-utils multipath-tools)
end
it 'does not include the api-metadata recipe' do
@ -28,8 +26,8 @@ describe 'openstack-compute::compute' do
expect(chef_run).not_to include_recipe 'openstack-compute::api-metadata'
end
it 'upgrades nova compute package' do
expect(chef_run).to upgrade_package 'nova-compute'
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-compute)
end
context "upgrades kvm when virt_type is 'kvm'" do
@ -38,8 +36,8 @@ describe 'openstack-compute::compute' do
runner.converge(described_recipe)
end
it do
expect(chef_run).to upgrade_package 'nova-compute-kvm'
expect(chef_run).not_to upgrade_package 'nova-compute-qemu'
expect(chef_run).to upgrade_package %w(python3-nova nova-compute-kvm)
expect(chef_run).not_to upgrade_package %w(python3-nova nova-compute-qemu)
end
end
@ -49,8 +47,8 @@ describe 'openstack-compute::compute' do
runner.converge(described_recipe)
end
it do
expect(chef_run).to upgrade_package 'nova-compute-qemu'
expect(chef_run).not_to upgrade_package 'nova-compute-kvm'
expect(chef_run).to upgrade_package %w(python3-nova nova-compute-qemu)
expect(chef_run).not_to upgrade_package %w(python3-nova nova-compute-kvm)
end
end
@ -73,7 +71,7 @@ describe 'openstack-compute::compute' do
it 'creates the file' do
expect(chef_run).to create_cookbook_file(file.name).with(
source: 'nova-compute.conf',
mode: 0o0644
mode: '644'
)
end
end

View File

@ -13,8 +13,8 @@ describe 'openstack-compute::conductor' do
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades conductor package' do
expect(chef_run).to upgrade_package 'nova-conductor'
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-conductor)
end
it 'starts nova-conductor on boot' do

View File

@ -10,10 +10,8 @@ describe 'openstack-compute::libvirt' do
include_context 'compute_stubs'
it 'upgrades libvirt packages' do
%w(libvirt device-mapper python-libguestfs).each do |pkg|
expect(chef_run).to upgrade_package pkg
end
it do
expect(chef_run).to upgrade_package %w(libvirt device-mapper python-libguestfs)
end
it 'creates libvirt group and adds nova as a member' do
@ -43,7 +41,7 @@ describe 'openstack-compute::libvirt' do
expect(chef_run).to create_template(file.name).with(
owner: 'root',
group: 'root',
mode: 0o644
mode: '644'
)
end

View File

@ -10,10 +10,8 @@ describe 'openstack-compute::libvirt' do
include_context 'compute_stubs'
it 'upgrades libvirt packages' do
%w(libvirt-bin python3-guestfs).each do |pkg|
expect(chef_run).to upgrade_package pkg
end
it do
expect(chef_run).to upgrade_package %w(libvirt-bin python3-guestfs)
end
it 'does not create libvirt group and add to nova' do
@ -49,9 +47,10 @@ describe 'openstack-compute::libvirt' do
it 'creates the /etc/libvirt/libvirtd.conf file' do
expect(chef_run).to create_template(file.name).with(
source: 'libvirtd.conf.erb',
owner: 'root',
group: 'root',
mode: 0o644
mode: '644'
)
end
@ -82,7 +81,7 @@ describe 'openstack-compute::libvirt' do
expect(chef_run).to create_template(file.name).with(
owner: 'root',
group: 'root',
mode: 0o644
mode: '644'
)
end

View File

@ -12,15 +12,15 @@ describe 'openstack-compute::nova-common' do
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades nova common package' do
expect(chef_run).to upgrade_package 'openstack-nova-common'
it do
expect(chef_run).to upgrade_package %w(openstack-nova-common mod_wsgi)
end
it 'upgrades mysql python package' do
it do
expect(chef_run).to upgrade_package 'MySQL-python'
end
it 'upgrades memcache python packages' do
it do
expect(chef_run).to upgrade_package 'python-memcached'
end
end

View File

@ -16,15 +16,15 @@ describe 'openstack-compute::nova-common' do
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades mysql python3 package' do
it do
expect(chef_run).to upgrade_package 'python3-mysqldb'
end
it 'upgrades nova common package' do
expect(chef_run).to upgrade_package 'nova-common'
it do
expect(chef_run).to upgrade_package %w(nova-common python3-nova)
end
it 'upgrades memcache python3 package' do
it do
expect(chef_run).to upgrade_package 'python3-memcache'
end
@ -32,7 +32,7 @@ describe 'openstack-compute::nova-common' do
expect(chef_run).to create_directory('/etc/nova').with(
owner: 'nova',
group: 'nova',
mode: 0o750
mode: '750'
)
end
@ -61,28 +61,42 @@ describe 'openstack-compute::nova-common' do
describe 'nova.conf' do
let(:file) { chef_run.template('/etc/nova/nova.conf') }
it 'creates the file' do
it do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
owner: 'nova',
group: 'nova',
mode: 0o640
mode: '640',
sensitive: true
)
end
it 'has default *_path options set' do
it do
expect(chef_run.template('/etc/nova/nova.conf')).to notify('service[apache2]').to(:restart)
end
it '[DEFAULT]' do
[
%r{^log_dir = /var/log/nova$},
%r{^state_path = /var/lib/nova$},
/^compute_driver = libvirt.LibvirtDriver$/,
%r{^instances_path = /var/lib/nova/instances$},
%r{^lock_path = /var/lib/nova/lock$},
/^enabled_apis = osapi_compute,metadata$/,
/^iscsi_helper = tgtadm$/,
/^metadata_listen = 127.0.0.1$/,
/^metadata_listen_port = 8775$/,
%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
it 'has compute driver attributes defaults set' do
[/^compute_driver = libvirt.LibvirtDriver$/].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
it '[oslo_concurrency]' do
[
%r{^lock_path = /var/lib/nova/lock$},
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', line)
end
end
@ -95,80 +109,88 @@ describe 'openstack-compute::nova-common' do
end
end
it 'has default transport_url/AMQP options set' do
[%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
end
end
it 'has default metadata ip and port options set' do
[/^metadata_listen = 127.0.0.1$/,
/^metadata_listen_port = 8775$/].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
end
end
it 'confirms default min value for workers' do
[/^osapi_compute_workers = /,
/^metadata_workers = /,
/^workers = /].each do |line|
[
/^osapi_compute_workers = /,
/^metadata_workers = /,
/^workers = /,
].each do |line|
expect(chef_run).to_not render_file(file.name).with_content(line)
end
end
context 'keystone_authtoken' do
it 'has correct auth_token settings' do
[
'auth_url = http://127.0.0.1:5000/v3',
'password = nova-pass',
'username = nova',
'project_name = service',
'user_domain_name = Default',
'project_domain_name = Default',
'service_token_roles_required = true',
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('keystone_authtoken', /^#{Regexp.quote(line)}$/)
end
it '[keystone_authtoken]' do
[
/^auth_type = v3password$/,
/^region_name = RegionOne$/,
/^username = nova$/,
/^user_domain_name = Default$/,
/^project_domain_name = Default$/,
/^project_name = service$/,
/^auth_version = v3$/,
/^service_token_roles_required = true$/,
%r{^auth_url = http://127.0.0.1:5000/v3$},
%r{^www_authenticate_uri = http://127.0.0.1:5000/v3$},
/^password = nova-pass$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line)
end
end
context 'placement' do
it 'has correct authentication settings' do
[
'auth_type = password',
'region_name = RegionOne',
'password = placement-pass',
'username = placement',
'project_name = service',
'user_domain_name = Default',
'project_domain_name = Default',
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('placement', /^#{Regexp.quote(line)}$/)
end
it '[libvirt]' do
[
/^virt_type = kvm$/,
/^images_type = default$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('libvirt', line)
end
end
it 'uses default values for attributes' do
it '[neutron]' do
[
/^auth_type = v3password$/,
/^region_name = RegionOne$/,
/^username = neutron$/,
/^user_domain_name = Default$/,
/^service_metadata_proxy = true$/,
/^project_name = service$/,
/^project_domain_name = Default$/,
%r{^auth_url = http://127.0.0.1:5000/v3$},
/^password = neutron-pass$/,
/^metadata_proxy_shared_secret = metadata-secret$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('neutron', line)
end
end
it '[placement]' do
[
/^auth_type = password$/,
/^region_name = RegionOne$/,
/^username = placement$/,
/^user_domain_name = Default$/,
/^project_domain_name = Default$/,
/^project_name = service$/,
%r{^auth_url = 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('placement', line)
end
end
it '[scheduler]' do
[
/^discover_hosts_in_cells_interval = 300$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('scheduler', line)
end
end
it '[glance]' do
[
%r{^api_servers = http://127.0.0.1:9292$},
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('glance', line)
end
end
it do
[
/^username = neutron$/,
/^project_name = service$/,
/^user_domain_name = Default/,
/^project_domain_name = Default/,
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('neutron', line)
expect(chef_run).to render_config_file(file.name).with_section_content('glance', line)
end
end
@ -203,7 +225,7 @@ describe 'openstack-compute::nova-common' do
/^server_listen = 127.0.0.1$/,
/^server_proxyclient_address = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
expect(chef_run).to render_config_file(file.name).with_section_content('vnc', line)
end
end
end
@ -219,19 +241,23 @@ describe 'openstack-compute::nova-common' do
/^server_listen = 1.1.1.1$/,
/^server_proxyclient_address = 2.2.2.2$/,
].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
expect(chef_run).to render_config_file(file.name).with_section_content('vnc', line)
end
end
end
it 'has default *vncproxy_* options set' 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$/,
/^server_proxyclient_address = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
expect(chef_run).to render_config_file(file.name).with_section_content('vnc', line)
end
end
@ -295,13 +321,10 @@ describe 'openstack-compute::nova-common' do
context 'serial console' do
it 'sets default serial console options set' do
[
# /^enabled = False$/,
%r{base_url = ws://127.0.0.1:6083$},
# /^port_range = 10000:20000$/,
/^proxyclient_address = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('serial_console', line)
expect(chef_run).to render_config_file(file.name).with_section_content('serial_console', line)
end
end
@ -311,19 +334,14 @@ describe 'openstack-compute::nova-common' do
node.override['openstack']['endpoints']['public']['compute-serial-proxy']['scheme'] = 'wss'
node.override['openstack']['endpoints']['public']['compute-serial-proxy']['host'] = '1.1.1.1'
node.override['openstack']['endpoints']['public']['compute-serial-proxy']['port'] = '6082'
# node.override['openstack']['compute']['serial_console']['enable'] = 'True'
# node.override['openstack']['compute']['serial_console']['port_range'] = '11000:15000'
runner.converge(described_recipe)
end
it do
[
# /^enabled = True$/,
%r{base_url = wss://1.1.1.1:6082$},
# /^port_range = 11000:15000$/,
/^proxyclient_address = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('serial_console', line)
expect(chef_run).to render_config_file(file.name).with_section_content('serial_console', line)
end
end
end
@ -385,7 +403,7 @@ describe 'openstack-compute::nova-common' do
expect(chef_run).to create_template(file.name).with(
user: 'root',
group: 'root',
mode: 0o644
mode: '644'
)
end
@ -412,8 +430,8 @@ describe 'openstack-compute::nova-common' do
end
end
it 'enables nova login' do
expect(chef_run).to run_execute('usermod -s /bin/sh nova')
it do
expect(chef_run).to modify_user('nova').with(shell: '/bin/sh')
end
it 'cleans up conf_secrets' do

View File

@ -14,10 +14,8 @@ describe 'openstack-compute::placement_api' do
expect(chef_run).to include_recipe 'openstack-compute::nova-common'
end
it 'upgrades placement packages' do
expect(chef_run).to upgrade_package 'nova-placement-api'
expect(chef_run).to upgrade_package 'python3-nova'
expect(chef_run).to upgrade_package 'libapache2-mod-wsgi-py3'
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

View File

@ -13,8 +13,8 @@ describe 'openstack-compute::scheduler' do
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades nova scheduler package' do
expect(chef_run).to upgrade_package('nova-scheduler')
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-scheduler)
end
it 'starts nova scheduler' do

View File

@ -13,8 +13,8 @@ describe 'openstack-compute::serialproxy' do
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades nova serialproxy packages' do
expect(chef_run).to upgrade_package('nova-serialproxy')
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-serialproxy)
end
it 'starts nova serialproxy' do

View File

@ -129,10 +129,8 @@ shared_context 'compute_stubs' do
end
shared_examples 'expect_volume_packages' do
it 'upgrades volume utils packages' do
%w(sysfsutils sg3_utils device-mapper-multipath).each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
it do
expect(chef_run).to upgrade_package %w(sysfsutils sg3_utils device-mapper-multipath)
end
end
@ -153,7 +151,7 @@ shared_examples 'expect_creates_nova_state_dir' do
expect(chef_run).to create_directory('/var/lib/nova').with(
user: 'nova',
group: 'nova',
mode: 0o755
mode: '755'
)
end
end
@ -163,7 +161,7 @@ shared_examples 'expect_creates_nova_lock_dir' do
expect(chef_run).to create_directory('/var/lib/nova/lock').with(
user: 'nova',
group: 'nova',
mode: 0o755
mode: '755'
)
end
end
@ -173,7 +171,7 @@ shared_examples 'expect_creates_nova_instances_dir' do
expect(chef_run).to create_directory('/var/lib/nova/instances').with(
user: 'nova',
group: 'nova',
mode: 0o755
mode: '755'
)
end
end
@ -184,7 +182,7 @@ shared_examples 'expect_creates_api_paste_template' do
expect(chef_run).to create_template('/etc/nova/api-paste.ini').with(
user: 'nova',
group: 'nova',
mode: 0o644
mode: '644'
)
end

View File

@ -13,14 +13,12 @@ describe 'openstack-compute::vncproxy' do
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades nova vncproxy packages' do
expect(chef_run).to upgrade_package('novnc')
expect(chef_run).to upgrade_package('websockify')
expect(chef_run).to upgrade_package('nova-novncproxy')
it do
expect(chef_run).to upgrade_package %w(novnc websockify python3-nova nova-novncproxy)
end
it 'upgrades nova consoleauth package' do
expect(chef_run).to upgrade_package('nova-consoleauth')
it do
expect(chef_run).to upgrade_package %w(python3-nova nova-consoleauth)
end
it 'starts nova vncproxy' do