update cinder config in controller/compute
update the cinder configuration in the controller and compute classes to use the new openstack::cinder::controller class. unset cinder password defaults. Change-Id: I85e188e787a3495b7c3657a57707d0d08669293c
This commit is contained in:
		@@ -548,6 +548,14 @@ The process for contributing code is as follows:
 | 
			
		||||
* Please visit http://wiki.openstack.org/GerritWorkflow and follow the instructions there to upload your change to Gerrit.
 | 
			
		||||
* Please add rspec tests for your code if applicable
 | 
			
		||||
 | 
			
		||||
## Upgrade warning
 | 
			
		||||
 | 
			
		||||
The current version of the code is intended for the 2.0 release of the openstack modules and
 | 
			
		||||
has the following know backwards incompatible breaking changes from 1.x.
 | 
			
		||||
 | 
			
		||||
* the cinder parameter has been removed (b/c support for nova-volumes has been removed).
 | 
			
		||||
  The manage_volumes parameter indicates is cinder volumes should be managed.
 | 
			
		||||
 | 
			
		||||
## Future features:
 | 
			
		||||
 | 
			
		||||
  efforts are underway to implement the following additional features:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
class openstack::cinder::controller(
 | 
			
		||||
  $rabbit_password,
 | 
			
		||||
  $keystone_password,
 | 
			
		||||
  $db_password,
 | 
			
		||||
  $rpc_backend              = 'cinder.openstack.common.rpc.impl_kombu',
 | 
			
		||||
  $keystone_tenant          = 'services',
 | 
			
		||||
  $keystone_enabled         = true,
 | 
			
		||||
@@ -17,7 +18,6 @@ class openstack::cinder::controller(
 | 
			
		||||
  # Database. Currently mysql is the only option.
 | 
			
		||||
  $db_type                  = 'mysql',
 | 
			
		||||
  $db_user                  = 'cinder',
 | 
			
		||||
  $db_password              = 'cinder_pass',
 | 
			
		||||
  $db_host                  = '127.0.0.1',
 | 
			
		||||
  $db_dbname                = 'cinder',
 | 
			
		||||
  $package_ensure           = present,
 | 
			
		||||
@@ -34,7 +34,9 @@ class openstack::cinder::controller(
 | 
			
		||||
  ####### DATABASE SETUP ######
 | 
			
		||||
  # set up mysql server
 | 
			
		||||
  if ($db_type == 'mysql') {
 | 
			
		||||
      $sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_dbname}?charset=utf8"
 | 
			
		||||
    $sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_dbname}?charset=utf8"
 | 
			
		||||
  } else {
 | 
			
		||||
    fail("Unsupported db_type ${db_type}")
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  class {'::cinder':
 | 
			
		||||
 
 | 
			
		||||
@@ -54,14 +54,14 @@ class openstack::compute (
 | 
			
		||||
  $vncproxy_host                 = undef,
 | 
			
		||||
  $vncserver_listen              = false,
 | 
			
		||||
  # cinder / volumes
 | 
			
		||||
  $cinder                        = true,
 | 
			
		||||
  $cinder_sql_connection         = undef,
 | 
			
		||||
  $manage_volumes                = true,
 | 
			
		||||
  $cinder_sql_connection         = false,
 | 
			
		||||
  $volume_group                  = 'cinder-volumes',
 | 
			
		||||
  $iscsi_ip_address              = '127.0.0.1',
 | 
			
		||||
  $setup_test_volume             = false,
 | 
			
		||||
  # General
 | 
			
		||||
  $migration_support             = false,
 | 
			
		||||
  $verbose                       = 'False',
 | 
			
		||||
  $verbose                       = false,
 | 
			
		||||
  $enabled                       = true
 | 
			
		||||
) {
 | 
			
		||||
 | 
			
		||||
@@ -199,25 +199,30 @@ class openstack::compute (
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if ($cinder) {
 | 
			
		||||
    class { 'cinder::base':
 | 
			
		||||
      rabbit_password => $rabbit_password,
 | 
			
		||||
      rabbit_host     => $rabbit_host,
 | 
			
		||||
      sql_connection  => $cinder_sql_connection,
 | 
			
		||||
      verbose         => $verbose,
 | 
			
		||||
  if $manage_volumes {
 | 
			
		||||
 | 
			
		||||
    if ! $cinder_sql_connection {
 | 
			
		||||
      fail('cinder sql connection must be set when cinder is being configured by openstack::compute')
 | 
			
		||||
    }
 | 
			
		||||
    class { 'cinder::volume': }
 | 
			
		||||
    class { 'cinder::volume::iscsi':
 | 
			
		||||
      iscsi_ip_address => $iscsi_ip_address,
 | 
			
		||||
      volume_group     => $volume_group,
 | 
			
		||||
 | 
			
		||||
    class { 'openstack::cinder::storage':
 | 
			
		||||
      sql_connection      => $cinder_sql_connection,
 | 
			
		||||
      rabbit_password     => $rabbit_password,
 | 
			
		||||
      rabbit_userid       => $rabbit_user,
 | 
			
		||||
      rabbit_host         => $rabbit_host,
 | 
			
		||||
      rabbit_virtual_host => $rabbit_virtual_host,
 | 
			
		||||
      volume_group        => $volume_group,
 | 
			
		||||
      iscsi_ip_address    => $iscsi_ip_address,
 | 
			
		||||
      enabled             => $enabled,
 | 
			
		||||
      verbose             => $verbose,
 | 
			
		||||
      setup_test_volume   => $setup_test_volume,
 | 
			
		||||
      volume_driver       => 'iscsi',
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # set in nova::api
 | 
			
		||||
    if ! defined(Nova_config['DEFAULT/volume_api_class']) {
 | 
			
		||||
      nova_config { 'DEFAULT/volume_api_class': value => 'nova.volume.cinder.API' }
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    # Set up nova-volume
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -82,10 +82,10 @@ class openstack::controller (
 | 
			
		||||
  $secret_key,
 | 
			
		||||
  # cinder and quantum password are not required b/c they are
 | 
			
		||||
  # optional. Not sure what to do about this.
 | 
			
		||||
  $cinder_user_password    = 'cinder_pass',
 | 
			
		||||
  $cinder_db_password      = 'cinder_pass',
 | 
			
		||||
  $quantum_user_password   = 'quantum_pass',
 | 
			
		||||
  $quantum_db_password     = 'quantum_pass',
 | 
			
		||||
  $cinder_user_password    = false,
 | 
			
		||||
  $cinder_db_password      = false,
 | 
			
		||||
  # Database
 | 
			
		||||
  $db_host                 = '127.0.0.1',
 | 
			
		||||
  $db_type                 = 'mysql',
 | 
			
		||||
@@ -306,24 +306,32 @@ class openstack::controller (
 | 
			
		||||
 | 
			
		||||
  ######### Cinder Controller Services ########
 | 
			
		||||
  if ($cinder) {
 | 
			
		||||
    class { "cinder::base":
 | 
			
		||||
      verbose         => $verbose,
 | 
			
		||||
      sql_connection  => "mysql://${cinder_db_user}:${cinder_db_password}@${db_host}/${cinder_db_dbname}?charset=utf8",
 | 
			
		||||
      rabbit_password => $rabbit_password,
 | 
			
		||||
      rabbit_userid   => $rabbit_user,
 | 
			
		||||
 | 
			
		||||
    if ! $cinder_db_password {
 | 
			
		||||
      fail('Must set cinder db password when setting up a cinder controller')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    class { 'cinder::api':
 | 
			
		||||
      keystone_password => $cinder_user_password,
 | 
			
		||||
    if ! $cinder_user_password {
 | 
			
		||||
      fail('Must set cinder user password when setting up a cinder controller')
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    class { 'cinder::scheduler': }
 | 
			
		||||
  } else {
 | 
			
		||||
    # Set up nova-volume
 | 
			
		||||
    class{ 'nova::volume': }
 | 
			
		||||
    class { 'openstack::cinder::controller':
 | 
			
		||||
      bind_host          => $bind_host,
 | 
			
		||||
      keystone_auth_host => $keystone_host,
 | 
			
		||||
      keystone_password  => $cinder_user_password,
 | 
			
		||||
      rabbit_password    => $rabbit_password,
 | 
			
		||||
      rabbit_host        => $rabbit_host,
 | 
			
		||||
      db_password        => $cinder_db_password,
 | 
			
		||||
      db_dbname          => $cinder_db_dbname,
 | 
			
		||||
      db_user            => $cinder_db_user,
 | 
			
		||||
      db_type            => $db_type,
 | 
			
		||||
      db_host            => $db_host,
 | 
			
		||||
      api_enabled        => $enabled,
 | 
			
		||||
      scheduler_enabled  => $enabled,
 | 
			
		||||
      verbose            => $verbose
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  ######## Horizon ########
 | 
			
		||||
  if ($horizon) {
 | 
			
		||||
    class { 'openstack::horizon':
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
describe 'openstack::cinder::controller' do
 | 
			
		||||
 | 
			
		||||
  let :required_params do
 | 
			
		||||
  let :params do
 | 
			
		||||
    {
 | 
			
		||||
      :db_password      => 'db_password',
 | 
			
		||||
      :rabbit_password   => 'rabpass',
 | 
			
		||||
@@ -14,16 +14,12 @@ describe 'openstack::cinder::controller' do
 | 
			
		||||
    { :osfamily => 'Redhat' }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  let :params do
 | 
			
		||||
    required_params
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'should configure using the default values' do
 | 
			
		||||
    should contain_class('cinder').with(
 | 
			
		||||
      :sql_connection      => "mysql://cinder:#{required_params[:db_password]}@127.0.0.1/cinder?charset=utf8",
 | 
			
		||||
      :sql_connection      => "mysql://cinder:#{params[:db_password]}@127.0.0.1/cinder?charset=utf8",
 | 
			
		||||
      :rpc_backend         => 'cinder.openstack.common.rpc.impl_kombu',
 | 
			
		||||
      :rabbit_userid       => 'guest',
 | 
			
		||||
      :rabbit_password     => required_params[:rabbit_password],
 | 
			
		||||
      :rabbit_password     => params[:rabbit_password],
 | 
			
		||||
      :rabbit_host         => '127.0.0.1',
 | 
			
		||||
      :rabbit_port         => '5672',
 | 
			
		||||
      :rabbit_hosts        => nil,
 | 
			
		||||
@@ -33,7 +29,7 @@ describe 'openstack::cinder::controller' do
 | 
			
		||||
      :verbose             => false
 | 
			
		||||
    )
 | 
			
		||||
    should contain_class('cinder::api').with(
 | 
			
		||||
      :keystone_password       => required_params[:keystone_password],
 | 
			
		||||
      :keystone_password       => params[:keystone_password],
 | 
			
		||||
      :keystone_enabled        => true,
 | 
			
		||||
      :keystone_user           => 'cinder',
 | 
			
		||||
      :keystone_auth_host      => 'localhost',
 | 
			
		||||
@@ -51,4 +47,15 @@ describe 'openstack::cinder::controller' do
 | 
			
		||||
    )
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with unsupported db type' do
 | 
			
		||||
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!({:db_type => 'sqlite'})
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it do
 | 
			
		||||
      expect { subject }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ describe 'openstack::compute' do
 | 
			
		||||
  let :params do
 | 
			
		||||
    {
 | 
			
		||||
      :private_interface         => 'eth0',
 | 
			
		||||
      :internal_address          => '0.0.0.0',
 | 
			
		||||
      :internal_address          => '127.0.0.2',
 | 
			
		||||
      :nova_user_password        => 'nova_pass',
 | 
			
		||||
      :rabbit_password           => 'rabbit_pw',
 | 
			
		||||
      :rabbit_host               => '127.0.0.1',
 | 
			
		||||
@@ -37,17 +37,17 @@ describe 'openstack::compute' do
 | 
			
		||||
        :rabbit_virtual_host => '/',
 | 
			
		||||
        :image_service       => 'nova.image.glance.GlanceImageService',
 | 
			
		||||
        :glance_api_servers  => false,
 | 
			
		||||
        :verbose             => 'False'
 | 
			
		||||
        :verbose             => false
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('nova::compute').with(
 | 
			
		||||
        :enabled                        => true,
 | 
			
		||||
        :vnc_enabled                    => true,
 | 
			
		||||
        :vncserver_proxyclient_address  => '0.0.0.0',
 | 
			
		||||
        :vncserver_proxyclient_address  => '127.0.0.2',
 | 
			
		||||
        :vncproxy_host                  => false
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('nova::compute::libvirt').with(
 | 
			
		||||
        :libvirt_type     => 'kvm',
 | 
			
		||||
        :vncserver_listen => '0.0.0.0'
 | 
			
		||||
        :vncserver_listen => '127.0.0.2'
 | 
			
		||||
      )
 | 
			
		||||
      should contain_nova_config('DEFAULT/multi_host').with( :value => 'False' )
 | 
			
		||||
      should contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => 'False' )
 | 
			
		||||
@@ -65,6 +65,19 @@ describe 'openstack::compute' do
 | 
			
		||||
        :enabled           => false,
 | 
			
		||||
        :install_service   => false
 | 
			
		||||
      })
 | 
			
		||||
      should contain_class('openstack::cinder::storage').with(
 | 
			
		||||
        :sql_connection      => 'mysql://user:pass@host/dbcinder',
 | 
			
		||||
        :rabbit_password     => 'rabbit_pw',
 | 
			
		||||
        :rabbit_userid       => 'nova',
 | 
			
		||||
        :rabbit_host         => '127.0.0.1',
 | 
			
		||||
        :rabbit_virtual_host => '/',
 | 
			
		||||
        :volume_group        => 'cinder-volumes',
 | 
			
		||||
        :iscsi_ip_address    => '127.0.0.1',
 | 
			
		||||
        :enabled             => true,
 | 
			
		||||
        :verbose             => false,
 | 
			
		||||
        :setup_test_volume   => false,
 | 
			
		||||
        :volume_driver       => 'iscsi'
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -123,44 +136,14 @@ describe 'openstack::compute' do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "when enabling volume management" do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!( :manage_volumes => true )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it do
 | 
			
		||||
      should contain_nova_config('DEFAULT/multi_host').with({ 'value' => 'False'})
 | 
			
		||||
      should_not contain_class('nova::api')
 | 
			
		||||
      should contain_class('nova::network').with({
 | 
			
		||||
        'enabled' => false,
 | 
			
		||||
        'install_service' => false
 | 
			
		||||
      })
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with cinder' do
 | 
			
		||||
    before do
 | 
			
		||||
      params.merge!(
 | 
			
		||||
        :cinder => true
 | 
			
		||||
        :manage_volumes => false
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
    it { should_not contain_class('openstack::cinder::storage') }
 | 
			
		||||
 | 
			
		||||
    it 'configures cinder' do
 | 
			
		||||
      should contain_class('cinder::base').with(
 | 
			
		||||
        :rabbit_password => 'rabbit_pw',
 | 
			
		||||
        :rabbit_host     => '127.0.0.1',
 | 
			
		||||
        :sql_connection  => 'mysql://user:pass@host/dbcinder',
 | 
			
		||||
        :verbose         => 'False'
 | 
			
		||||
      )
 | 
			
		||||
      should contain_class('cinder::volume')
 | 
			
		||||
      should contain_class('cinder::volume::iscsi').with(
 | 
			
		||||
        :iscsi_ip_address => '127.0.0.1',
 | 
			
		||||
        :volume_group     => 'cinder-volumes'
 | 
			
		||||
      )
 | 
			
		||||
      should contain_nova_config('DEFAULT/volume_api_class').with(
 | 
			
		||||
        :value => 'nova.volume.cinder.API'
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'when quantum is false' do
 | 
			
		||||
@@ -266,8 +249,8 @@ describe 'openstack::compute' do
 | 
			
		||||
 | 
			
		||||
    it 'should configure quantum' do
 | 
			
		||||
      should contain_class('quantum').with(
 | 
			
		||||
        :verbose         => 'False',
 | 
			
		||||
        :debug           => 'False',
 | 
			
		||||
        :verbose         => false,
 | 
			
		||||
        :debug           => false,
 | 
			
		||||
        :rabbit_host     => params[:rabbit_host],
 | 
			
		||||
        :rabbit_password => params[:rabbit_password]
 | 
			
		||||
      )
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,8 @@ describe 'openstack::controller' do
 | 
			
		||||
      :glance_user_password    => 'glance_pass',
 | 
			
		||||
      :nova_db_password        => 'nova_pass',
 | 
			
		||||
      :nova_user_password      => 'nova_pass',
 | 
			
		||||
      :cinder_db_password      => 'cinder_pass',
 | 
			
		||||
      :cinder_user_password    => 'cinder_pass',
 | 
			
		||||
      :secret_key              => 'secret_key',
 | 
			
		||||
      :quantum                 => false,
 | 
			
		||||
      :vncproxy_host           => '10.0.0.1',
 | 
			
		||||
@@ -123,7 +125,6 @@ describe 'openstack::controller' do
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
      it do
 | 
			
		||||
        should contain_class('nova::volume')
 | 
			
		||||
        should_not contain_class('quantum::db::mysql')
 | 
			
		||||
        should_not contain_class('cinder::db::mysql')
 | 
			
		||||
      end
 | 
			
		||||
@@ -424,7 +425,7 @@ describe 'openstack::controller' do
 | 
			
		||||
        default_params.merge(:cinder => false)
 | 
			
		||||
      end
 | 
			
		||||
      it 'should not contain cinder classes' do
 | 
			
		||||
        should_not contain_class('cinder::base')
 | 
			
		||||
        should_not contain_class('cinder')
 | 
			
		||||
        should_not contain_class('cinder::api')
 | 
			
		||||
        should_not contain_class('cinder:"scheduler')
 | 
			
		||||
      end
 | 
			
		||||
@@ -435,7 +436,7 @@ describe 'openstack::controller' do
 | 
			
		||||
        default_params
 | 
			
		||||
      end
 | 
			
		||||
      it 'should configure cinder using defaults' do
 | 
			
		||||
        should contain_class('cinder::base').with(
 | 
			
		||||
        should contain_class('cinder').with(
 | 
			
		||||
          :verbose         => 'False',
 | 
			
		||||
          :sql_connection  => 'mysql://cinder:cinder_pass@127.0.0.1/cinder?charset=utf8',
 | 
			
		||||
          :rabbit_password => 'rabbit_pw'
 | 
			
		||||
@@ -458,7 +459,7 @@ describe 'openstack::controller' do
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
      it 'should configure cinder using defaults' do
 | 
			
		||||
        should contain_class('cinder::base').with(
 | 
			
		||||
        should contain_class('cinder').with(
 | 
			
		||||
          :verbose         => 'True',
 | 
			
		||||
          :sql_connection  => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8',
 | 
			
		||||
          :rabbit_password => 'rabbit_pw2'
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user