Add Ironic support into nova puppet modules

Ironic needs to make some additions to the nova config
file in order to run.  The remaining configuraitons will
be added to the nova plugin in packstack.

Change-Id: I34c7c8a6001b0433aee9017ac571e3bd4f2f02b2
This commit is contained in:
Ryan Hallisey 2014-12-18 12:37:14 -05:00
parent e5934ce389
commit 5662cac10e
4 changed files with 91 additions and 5 deletions

View File

@ -73,6 +73,16 @@
# (optional) Force backing images to raw format.
# Defaults to true
#
# [*reserved_host_memory*]
# Reserved host memory
# The amount of memory in MB reserved for the host.
# Defaults to '512'
#
# [*compute_manager*]
# Compute manager
# The driver that will manage the running instances.
# Defaults to nova.compute.manager.ComputeManager
#
class nova::compute (
$enabled = false,
$manage_service = true,
@ -91,10 +101,17 @@ class nova::compute (
$instance_usage_audit = false,
$instance_usage_audit_period = 'month',
$force_raw_images = true,
$reserved_host_memory = '512',
$compute_manager = 'nova.compute.manager.ComputeManager',
) {
include nova::params
nova_config {
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
'DEFAULT/compute_manager': value => $compute_manager;
}
if ($vnc_enabled) {
if ($vncproxy_host) {
$vncproxy_base_url = "${vncproxy_protocol}://${vncproxy_host}:${vncproxy_port}${vncproxy_path}"

View File

@ -0,0 +1,49 @@
# == Class: nova::compute::ironic
#
# Configures Nova compute service to use Ironic.
#
# === Parameters:
#
# [*admin_user*]
# Admin username
# The admin username for Ironic to connect to Nova.
# Defaults to 'admin'
#
# [*admin_passwd*]
# Admin password
# The admin password for Ironic to connect to Nova.
# Defaults to 'ironic'
#
# [*admin_url*]
# Admin url
# The address of the Keystone api endpoint.
# Defaults to 'http://127.0.0.1:35357/v2.0'
#
# [*admin_tenant_name*]
# Admin tenant name
# The Ironic Keystone tenant name.
# Defaults to 'services'
#
# [*api_endpoint*]
# Api endpoint
# The url for Ironic api endpoint.
# Defaults to 'http://127.0.0.1:6385/v1'
#
class nova::compute::ironic (
$admin_user = 'admin',
$admin_passwd = 'ironic',
$admin_url = 'http://127.0.0.1:35357/v2.0',
$admin_tenant_name = 'services',
$api_endpoint = 'http://127.0.0.1:6385/v1',
) {
nova_config {
'ironic/admin_username': value => $admin_user;
'ironic/admin_password': value => $admin_passwd;
'ironic/admin_url': value => $admin_url;
'ironic/admin_tenant_name': value => $admin_tenant_name;
'ironic/api_endpoint': value => $api_endpoint;
'DEFAULT/compute_driver': value => 'nova.virt.ironic.IronicDriver';
}
}

View File

@ -0,0 +1,13 @@
require 'spec_helper'
describe 'nova::compute::ironic' do
it 'configures ironic in nova.conf' do
should contain_nova_config('ironic/admin_username').with_value('admin')
should contain_nova_config('ironic/admin_password').with_value('ironic')
should contain_nova_config('ironic/admin_url').with_value('http://127.0.0.1:35357/v2.0')
should contain_nova_config('ironic/admin_tenant_name').with_value('services')
should contain_nova_config('ironic/api_endpoint').with_value('http://127.0.0.1:6385/v1')
should contain_nova_config('DEFAULT/compute_driver').with_value('nova.virt.ironic.IronicDriver')
end
end

View File

@ -40,11 +40,13 @@ describe 'nova::compute' do
context 'with overridden parameters' do
let :params do
{ :enabled => true,
:ensure_package => '2012.1-2',
:vncproxy_host => '127.0.0.1',
:network_device_mtu => 9999,
:force_raw_images => false }
{ :enabled => true,
:ensure_package => '2012.1-2',
:vncproxy_host => '127.0.0.1',
:network_device_mtu => 9999,
:force_raw_images => false,
:reserved_host_memory => '0',
:compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager'}
end
it 'installs nova-compute package and service' do
@ -61,6 +63,11 @@ describe 'nova::compute' do
})
end
it 'configures ironic in nova.conf' do
should contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('0')
should contain_nova_config('DEFAULT/compute_manager').with_value('ironic.nova.compute.manager.ClusteredComputeManager')
end
it 'configures network_device_mtu' do
should contain_nova_config('DEFAULT/network_device_mtu').with_value('9999')
end