From 8e61232d09289ecf05c60bd24f3fc9240027ef33 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Fri, 21 Feb 2014 12:30:51 +0100 Subject: [PATCH 1/2] [image] Expose image location to trusted clients This enables the qcow cloning while creating a volume from an image. Closes: #81 --- manifests/image.pp | 33 ++++----- spec/classes/cloud_image_spec.rb | 112 ++++++++++++++++++------------- 2 files changed, 78 insertions(+), 67 deletions(-) diff --git a/manifests/image.pp b/manifests/image.pp index e09324d7..54568ff8 100644 --- a/manifests/image.pp +++ b/manifests/image.pp @@ -92,25 +92,20 @@ class cloud::image( $encoded_glance_password = uriescape($glance_db_password) class { 'glance::api': - sql_connection => "mysql://${encoded_glance_user}:${encoded_glance_password}@${glance_db_host}/glance", - registry_host => $openstack_vip, - registry_port => $ks_glance_registry_internal_port, - verbose => $verbose, - debug => $debug, - auth_host => $ks_keystone_internal_host, - keystone_password => $ks_glance_password, - keystone_tenant => 'services', - keystone_user => 'glance', - log_facility => $log_facility, - bind_host => $api_eth, - bind_port => $ks_glance_api_internal_port, - use_syslog => $use_syslog, - } - - #TODO(sbadia): Wait https://review.openstack.org/69688 - #See branch bug/81/sbadia and https://github.com/enovance/puppet-cloud/issues/81 - glance_api_config { - 'DEFAULT/show_image_direct_url': value => true; + sql_connection => "mysql://${encoded_glance_user}:${encoded_glance_password}@${glance_db_host}/glance", + registry_host => $openstack_vip, + registry_port => $ks_glance_registry_internal_port, + verbose => $verbose, + debug => $debug, + auth_host => $ks_keystone_internal_host, + keystone_password => $ks_glance_password, + keystone_tenant => 'services', + keystone_user => 'glance', + show_image_direct_url => true, + log_facility => $log_facility, + bind_host => $api_eth, + bind_port => $ks_glance_api_internal_port, + use_syslog => $use_syslog, } class { 'glance::registry': diff --git a/spec/classes/cloud_image_spec.rb b/spec/classes/cloud_image_spec.rb index 0bd4b5f8..dcb0e62e 100644 --- a/spec/classes/cloud_image_spec.rb +++ b/spec/classes/cloud_image_spec.rb @@ -19,61 +19,77 @@ require 'spec_helper' describe 'cloud::image' do - shared_examples_for 'openstack image' do - - let :params do - { :glance_db_host => '10.0.0.1', - :glance_db_user => 'glance', - :glance_db_password => 'secrete', - :ks_keystone_internal_host => '10.0.0.1', - :ks_glance_internal_host => '10.0.0.1', - :openstack_vip => '10.0.0.42', - :ks_glance_api_internal_port => '9292', - :ks_glance_registry_internal_port => '9191', - :ks_glance_password => 'secrete', - :rabbit_host => '10.0.0.1', - :rabbit_password => 'secrete', - :rbd_store_user => 'glance', - :rbd_store_pool => 'images', - :debug => true, - :verbose => true, - :use_syslog => true, - :log_facility => 'LOG_LOCAL0', - :api_eth => '10.0.0.1' } - end + let :params do + { :glance_db_host => '10.0.0.1', + :glance_db_user => 'glance', + :glance_db_password => 'secrete', + :ks_keystone_internal_host => '10.0.0.1', + :ks_glance_internal_host => '10.0.0.1', + :openstack_vip => '10.0.0.42', + :ks_glance_api_internal_port => '9292', + :ks_glance_registry_internal_port => '9191', + :ks_glance_password => 'secrete', + :rabbit_host => '10.0.0.1', + :rabbit_password => 'secrete', + :rbd_store_user => 'glance', + :rbd_store_pool => 'images', + :debug => true, + :verbose => true, + :use_syslog => true, + :log_facility => 'LOG_LOCAL0', + :api_eth => '10.0.0.1' + } + end + shared_examples_for 'a glance api server' do it 'configure glance-api' do should contain_class('glance::api').with( - :sql_connection => 'mysql://glance:secrete@10.0.0.1/glance', - :keystone_password => 'secrete', - :registry_host => '10.0.0.42', - :registry_port => '9191', - :keystone_tenant => 'services', - :keystone_user => 'glance', - :verbose => true, - :debug => true, - :auth_host => '10.0.0.1', - :log_facility => 'LOG_LOCAL0', - :bind_host => '10.0.0.1', - :bind_port => '9292', - :use_syslog => true - ) + :sql_connection => 'mysql://glance:secrete@10.0.0.1/glance', + :keystone_password => 'secrete', + :registry_host => '10.0.0.42', + :registry_port => '9191', + :keystone_tenant => 'services', + :keystone_user => 'glance', + :show_image_direct_url => true, + :verbose => true, + :debug => true, + :auth_host => '10.0.0.1', + :log_facility => 'LOG_LOCAL0', + :bind_host => '10.0.0.1', + :bind_port => '9292', + :use_syslog => true + ) end + end + shared_examples_for 'a glance registry server' do it 'configure glance-registry' do should contain_class('glance::registry').with( - :sql_connection => 'mysql://glance:secrete@10.0.0.1/glance', - :keystone_password => 'secrete', - :keystone_tenant => 'services', - :keystone_user => 'glance', - :verbose => true, - :debug => true, - :auth_host => '10.0.0.1', - :log_facility => 'LOG_LOCAL0', - :bind_host => '10.0.0.1', - :bind_port => '9191', - :use_syslog => true - ) + :sql_connection => 'mysql://glance:secrete@10.0.0.1/glance', + :keystone_password => 'secrete', + :keystone_tenant => 'services', + :keystone_user => 'glance', + :verbose => true, + :debug => true, + :auth_host => '10.0.0.1', + :log_facility => 'LOG_LOCAL0', + :bind_host => '10.0.0.1', + :bind_port => '9191', + :use_syslog => true + ) + end + end + + shared_examples_for 'openstack image' do + + context 'configure glance-api' do + before { params.merge!(:show_image_direct_url => true)} + it_configures 'a glance api server' + end + + context 'configure glance-registry' do + before { params.delete(:show_image_direct_url) } + it_configures 'a glance registry server' end # TODO(EmilienM) Disabled for now From 5748ec1c95da7339688fc707fa7558bedabddbf2 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Fri, 21 Feb 2014 14:20:58 +0100 Subject: [PATCH 2/2] [spec] Fix cloud::image specs (refs: #81) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks « el Grand matador » ! --- spec/classes/cloud_image_spec.rb | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/spec/classes/cloud_image_spec.rb b/spec/classes/cloud_image_spec.rb index dcb0e62e..804bf282 100644 --- a/spec/classes/cloud_image_spec.rb +++ b/spec/classes/cloud_image_spec.rb @@ -41,7 +41,8 @@ describe 'cloud::image' do } end - shared_examples_for 'a glance api server' do + shared_examples_for 'openstack image' do + it 'configure glance-api' do should contain_class('glance::api').with( :sql_connection => 'mysql://glance:secrete@10.0.0.1/glance', @@ -60,9 +61,7 @@ describe 'cloud::image' do :use_syslog => true ) end - end - shared_examples_for 'a glance registry server' do it 'configure glance-registry' do should contain_class('glance::registry').with( :sql_connection => 'mysql://glance:secrete@10.0.0.1/glance', @@ -78,19 +77,6 @@ describe 'cloud::image' do :use_syslog => true ) end - end - - shared_examples_for 'openstack image' do - - context 'configure glance-api' do - before { params.merge!(:show_image_direct_url => true)} - it_configures 'a glance api server' - end - - context 'configure glance-registry' do - before { params.delete(:show_image_direct_url) } - it_configures 'a glance registry server' - end # TODO(EmilienM) Disabled for now # Follow-up https://github.com/enovance/puppet-cloud/issues/160