Add recipe for serial console proxy

This recipe is used to setup nova-serialproxy service.

Closes-bug: #1472152

Change-Id: I044bb6d65dad849fdc0612e197c5e33b26ddddd0
This commit is contained in:
Zhe Jiang 2015-07-10 15:00:06 +08:00
parent e8c02f84f3
commit 139dfc8375
6 changed files with 106 additions and 1 deletions

View File

@ -87,6 +87,11 @@ vncproxy
- Includes recipe `nova-common`
- Installs and configures the vncproxy service for console access to VMs
serialproxy
----
- Includes recipe `nova-common`
- Installs and configures the serialproxy service for serial console access to VMs
Attributes
==========

View File

@ -521,6 +521,8 @@ when 'fedora', 'rhel', 'suse' # :pragma-foodcritic: ~FC024 - won't fix this
'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' => ['libvirt', 'device-mapper', 'python-libguestfs'],
'libvirt_service' => 'libvirtd',
'libvirt_ceph_packages' => ['ceph-common'],
@ -573,6 +575,8 @@ when 'debian'
'compute_vncproxy_service' => 'nova-novncproxy',
'compute_vncproxy_consoleauth_packages' => ['nova-consoleauth'],
'compute_vncproxy_consoleauth_service' => 'nova-consoleauth',
'compute_serialproxy_packages' => ['nova-serialproxy'],
'compute_serialproxy_service' => 'nova-serialproxy',
'libvirt_packages' => ['libvirt-bin', 'python-guestfs'],
'libvirt_service' => 'libvirt-bin',
'libvirt_ceph_packages' => ['ceph-common'],

View File

@ -4,7 +4,7 @@ maintainer_email 'opscode-chef-openstack@googlegroups.com'
license 'Apache 2.0'
description 'The OpenStack Compute service Nova.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
version '11.1.0'
recipe 'openstack-compute::api-ec2', 'Installs AWS EC2 compatible API'
recipe 'openstack-compute::api-metadata', 'Installs the nova metadata package'
@ -21,6 +21,7 @@ recipe 'openstack-compute::nova-common', 'Builds the basic nova.conf config file
recipe 'openstack-compute::nova-setup', 'Sets up the nova database on the mysql server, including the initial schema and subsequent creation of the appropriate networks'
recipe 'openstack-compute::scheduler', 'Installs nova scheduler service'
recipe 'openstack-compute::vncproxy', 'Installs and configures the vncproxy service for console access to VMs'
recipe 'openstack-compute::serialproxy', 'Installs and configures the serialproxy service for serial console access to VMs'
%w(ubuntu fedora redhat centos suse).each do |os|
supports os

39
recipes/serialproxy.rb Normal file
View File

@ -0,0 +1,39 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-compute
# Recipe:: serialproxy
#
# 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.
#
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
end
proxy_service = platform_options['compute_serialproxy_service']
service proxy_service do
service_name proxy_service
supports status: true, restart: true
subscribes :restart, resources('template[/etc/nova/nova.conf]')
action [:enable, :start]
end

View File

@ -0,0 +1,28 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-compute::serialproxy' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
include_context 'compute_stubs'
include_examples 'expect_runs_nova_common_recipe'
include_examples 'expect_creates_nova_state_dir'
include_examples 'expect_creates_nova_lock_dir'
it 'upgrades nova serialproxy package' do
expect(chef_run).to upgrade_package('openstack-nova-serialproxy')
end
it 'starts nova serialproxy' do
expect(chef_run).to start_service('openstack-nova-serialproxy')
end
it 'starts nova serialproxy on boot' do
expect(chef_run).to enable_service('openstack-nova-serialproxy')
end
end
end

28
spec/serialproxy_spec.rb Normal file
View File

@ -0,0 +1,28 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-compute::serialproxy' 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_common_recipe'
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')
end
it 'starts nova serialproxy' do
expect(chef_run).to start_service('nova-serialproxy')
end
it 'starts nova serialproxy on boot' do
expect(chef_run).to enable_service('nova-serialproxy')
end
end
end