From 03d1627e1ca1fac8f4929930d18af52c6750ee20 Mon Sep 17 00:00:00 2001 From: danehans Date: Mon, 15 Jul 2013 21:51:12 +0000 Subject: [PATCH] Adds support for Nova Memcached Previously, the openstack::nova::controller class could only use Nova's in-process cache for storing information such as nova-consoleauth session tokens. This patch adds a new parameter called memcached_servers that allows Nova to use memcached instead of the in-process cache. Defaults to false to continue having Nova use the in-process cache for backwards compatibility. Change-Id: Ic61962e6ebf588e5724d238954ec611b0bbcbd05 --- manifests/nova/controller.pp | 7 +++++++ .../classes/openstack_nova_controller_spec.rb | 21 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/manifests/nova/controller.pp b/manifests/nova/controller.pp index 7bc86f5..f38b0d5 100644 --- a/manifests/nova/controller.pp +++ b/manifests/nova/controller.pp @@ -6,6 +6,11 @@ # # === Parameters # +# [memcached_servers] +# Use memcached instead of in-process cache. +# Supply a list of memcached server IP's:Memcached Port. +# (optional) Defaults to false. +# # [quantum] # Specifies if nova should be configured to use quantum. # (optional) Defaults to false (indicating nova-networks should be used) @@ -61,6 +66,7 @@ class openstack::nova::controller ( $nova_db_user = 'nova', $nova_db_dbname = 'nova', $enabled_apis = 'ec2,osapi_compute,metadata', + $memcached_servers = false, # Rabbit $rabbit_user = 'openstack', $rabbit_virtual_host = '/', @@ -119,6 +125,7 @@ class openstack::nova::controller ( rabbit_virtual_host => $rabbit_virtual_host, image_service => 'nova.image.glance.GlanceImageService', glance_api_servers => $glance_connection, + memcached_servers => $memcached_servers, debug => $debug, verbose => $verbose, rabbit_host => $rabbit_connection, diff --git a/spec/classes/openstack_nova_controller_spec.rb b/spec/classes/openstack_nova_controller_spec.rb index 14729c0..34f30b6 100644 --- a/spec/classes/openstack_nova_controller_spec.rb +++ b/spec/classes/openstack_nova_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'openstack::nova::controller' do - let :params do + let :default_params do { :public_address => '127.0.0.1', :db_host => '127.0.0.1', @@ -11,6 +11,7 @@ describe 'openstack::nova::controller' do :quantum_user_password => 'quantum_user_pass', :nova_db_password => 'nova_db_pass', :quantum => true, + :memcached_servers => false, :metadata_shared_secret => 'secret' } end @@ -19,6 +20,10 @@ describe 'openstack::nova::controller' do {:osfamily => 'Debian' } end + let :params do + default_params + end + it { should contain_class('openstack::nova::controller') } context 'when configuring quantum' do @@ -70,9 +75,19 @@ describe 'openstack::nova::controller' do :host => '127.0.0.1', :enabled => true ) - - end end + context 'when configuring memcached' do + let :params do + default_params.merge( + :memcached_servers => ['memcached01:11211', 'memcached02:11211'] + ) + end + it 'should configure nova with memcached' do + should contain_class('nova').with( + :memcached_servers => ['memcached01:11211', 'memcached02:11211'] + ) + end + end end