Merge pull request #145 from enovance/bug/142/emilien
[WIP] Ensure OpenStack DB are populated
This commit is contained in:
@@ -91,4 +91,15 @@ class cloud::compute(
|
||||
'DEFAULT/resume_guests_state_on_host_boot': value => true;
|
||||
}
|
||||
|
||||
# Note(EmilienM):
|
||||
# We check if DB tables are created, if not we populate Nova DB.
|
||||
# It's a hack to fit with our setup where we run MySQL/Galera
|
||||
# TODO(Gonéri)
|
||||
# We have to do this only on the primary node of the galera cluster to avoid race condition
|
||||
# https://github.com/enovance/puppet-cloud/issues/156
|
||||
exec {'nova_db_sync':
|
||||
command => '/usr/bin/nova-manage db sync',
|
||||
unless => "/usr/bin/mysql nova -h ${nova_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -225,6 +225,11 @@ class cloud::database::sql (
|
||||
privileges => ['all']
|
||||
}
|
||||
|
||||
|
||||
# TODO(Gonéri):
|
||||
# Here we should do the db_sync.
|
||||
# https://github.com/enovance/puppet-cloud/issues/156
|
||||
|
||||
Database_user<<| |>>
|
||||
} # if $::hostname == $galera_master
|
||||
|
||||
|
||||
@@ -525,6 +525,16 @@ class cloud::identity (
|
||||
password => $ks_heat_password
|
||||
}
|
||||
|
||||
# Note(EmilienM):
|
||||
# We check if DB tables are created, if not we populate Keystone DB.
|
||||
# It's a hack to fit with our setup where we run MySQL/Galera
|
||||
# TODO(Gonéri)
|
||||
# We have to do this only on the primary node of the galera cluster to avoid race condition
|
||||
# https://github.com/enovance/puppet-cloud/issues/156
|
||||
exec {'keystone_db_sync':
|
||||
command => '/usr/bin/keystone-manage db_sync',
|
||||
unless => "/usr/bin/mysql keystone -h ${keystone_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables"
|
||||
}
|
||||
|
||||
@@haproxy::balancermember{"${::fqdn}-keystone_api":
|
||||
listening_service => 'keystone_api_cluster',
|
||||
|
||||
@@ -126,6 +126,17 @@ class cloud::image(
|
||||
class { 'glance::cache::cleaner': }
|
||||
class { 'glance::cache::pruner': }
|
||||
|
||||
# Note(EmilienM):
|
||||
# We check if DB tables are created, if not we populate Glance DB.
|
||||
# It's a hack to fit with our setup where we run MySQL/Galera
|
||||
# TODO(Gonéri)
|
||||
# We have to do this only on the primary node of the galera cluster to avoid race condition
|
||||
# https://github.com/enovance/puppet-cloud/issues/156
|
||||
exec {'glance_db_sync':
|
||||
command => '/usr/bin/glance-manage db_sync',
|
||||
unless => "/usr/bin/mysql glance -h ${glance_db_host} -u ${encoded_glance_user} -p${encoded_glance_password} -e \"show tables\" | /bin/grep Tables"
|
||||
}
|
||||
|
||||
# TODO(EmilienM) For later, I'll also add internal network support in HAproxy for all OpenStack API, to optimize North / South network traffic
|
||||
@@haproxy::balancermember{"${::fqdn}-glance_api":
|
||||
listening_service => 'glance_api_cluster',
|
||||
|
||||
@@ -38,10 +38,21 @@ class cloud::network::controller(
|
||||
auth_password => $ks_neutron_password,
|
||||
auth_host => $ks_keystone_admin_host,
|
||||
auth_port => $ks_keystone_public_port,
|
||||
# TODO(EmilienM) This one should work, but it's the case now. Don't drop it.
|
||||
connection => "mysql://${encoded_user}:${encoded_password}@${neutron_db_host}/neutron?charset=utf8",
|
||||
# TODO(EmilienM) Should be deprecated - bug GH#152
|
||||
sql_connection => "mysql://${encoded_user}:${encoded_password}@${neutron_db_host}/neutron?charset=utf8",
|
||||
api_workers => $::processorcount
|
||||
}
|
||||
|
||||
# Note(EmilienM):
|
||||
# We check if DB tables are created, if not we populate Neutron DB.
|
||||
# It's a hack to fit with our setup where we run MySQL/Galera
|
||||
exec {'neutron_db_sync':
|
||||
command => '/usr/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head',
|
||||
unless => "/usr/bin/mysql neutron -h ${neutron_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables"
|
||||
}
|
||||
|
||||
@@haproxy::balancermember{"${::fqdn}-neutron_api":
|
||||
listening_service => 'neutron_api_cluster',
|
||||
server_names => $::hostname,
|
||||
|
||||
@@ -52,4 +52,15 @@ class cloud::orchestration(
|
||||
debug => $debug,
|
||||
}
|
||||
|
||||
# Note(EmilienM):
|
||||
# We check if DB tables are created, if not we populate Heat DB.
|
||||
# It's a hack to fit with our setup where we run MySQL/Galera
|
||||
# TODO(Gonéri)
|
||||
# We have to do this only on the primary node of the galera cluster to avoid race condition
|
||||
# https://github.com/enovance/puppet-cloud/issues/156
|
||||
exec {'heat_db_sync':
|
||||
command => '/usr/bin/heat-manage --config-file /etc/heat/heat.conf db_sync',
|
||||
unless => "/usr/bin/mysql heat -h ${heat_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,4 +46,15 @@ class cloud::volume(
|
||||
|
||||
class { 'cinder::ceilometer': }
|
||||
|
||||
# Note(EmilienM):
|
||||
# We check if DB tables are created, if not we populate Cinder DB.
|
||||
# It's a hack to fit with our setup where we run MySQL/Galera
|
||||
# TODO(Gonéri)
|
||||
# We have to do this only on the primary node of the galera cluster to avoid race condition
|
||||
# https://github.com/enovance/puppet-cloud/issues/156
|
||||
exec {'cinder_db_sync':
|
||||
command => '/usr/bin/cinder-manage db sync',
|
||||
unless => "/usr/bin/mysql cinder -h ${cinder_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,13 @@ describe 'cloud::compute::controller' do
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => '/usr/bin/nova-manage db sync',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure nova-scheduler' do
|
||||
should contain_class('nova::scheduler').with(:enabled => true)
|
||||
end
|
||||
|
||||
@@ -59,6 +59,13 @@ describe 'cloud::compute::hypervisor' do
|
||||
should contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with('value' => true)
|
||||
end
|
||||
|
||||
it 'checks if Nova DB is populated' do
|
||||
should contain_exec('nova_db_sync').with(
|
||||
:command => '/usr/bin/nova-manage db sync',
|
||||
:unless => '/usr/bin/mysql nova -h 10.0.0.1 -u nova -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'insert and activate nbd module' do
|
||||
should contain_exec('insert_module_nbd').with('command' => '/bin/echo "nbd" > /etc/modules', 'unless' => '/bin/grep "nbd" /etc/modules')
|
||||
should contain_exec('/sbin/modprobe nbd').with('unless' => '/bin/grep -q "^nbd " "/proc/modules"')
|
||||
|
||||
@@ -110,6 +110,13 @@ describe 'cloud::identity' do
|
||||
should contain_keystone_config('ec2/driver').with('value' => 'keystone.contrib.ec2.backends.sql.Ec2')
|
||||
end
|
||||
|
||||
it 'checks if Keystone DB is populated' do
|
||||
should contain_exec('keystone_db_sync').with(
|
||||
:command => '/usr/bin/keystone-manage db_sync',
|
||||
:unless => '/usr/bin/mysql keystone -h 10.0.0.1 -u keystone -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure keystone admin role' do
|
||||
should contain_class('keystone::roles::admin').with(
|
||||
:email => 'admin@openstack.org',
|
||||
|
||||
@@ -95,6 +95,12 @@ describe 'cloud::image' do
|
||||
should contain_class('glance::cache::pruner')
|
||||
end
|
||||
|
||||
it 'checks if Glance DB is populated' do
|
||||
should contain_exec('glance_db_sync').with(
|
||||
:command => '/usr/bin/glance-manage db_sync',
|
||||
:unless => '/usr/bin/mysql glance -h 10.0.0.1 -u glance -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
|
||||
@@ -76,9 +76,18 @@ describe 'cloud::network::controller' do
|
||||
:auth_host => '10.0.0.1',
|
||||
:auth_port => '5000',
|
||||
:connection => 'mysql://neutron:secrete@10.0.0.1/neutron?charset=utf8',
|
||||
:sql_connection => 'mysql://neutron:secrete@10.0.0.1/neutron?charset=utf8',
|
||||
:api_workers => '2'
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Neutron DB is populated' do
|
||||
should contain_exec('neutron_db_sync').with(
|
||||
:command => '/usr/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head',
|
||||
:unless => '/usr/bin/mysql neutron -h 10.0.0.1 -u neutron -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
|
||||
@@ -80,6 +80,13 @@ describe 'cloud::orchestration::api' do
|
||||
)
|
||||
end
|
||||
|
||||
it 'checks if Heat DB is populated' do
|
||||
should contain_exec('heat_db_sync').with(
|
||||
:command => '/usr/bin/heat-manage --config-file /etc/heat/heat.conf db_sync',
|
||||
:unless => '/usr/bin/mysql heat -h 10.0.0.1 -u heat -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
|
||||
@@ -60,6 +60,13 @@ describe 'cloud::volume::controller' do
|
||||
should contain_class('cinder::ceilometer')
|
||||
end
|
||||
|
||||
it 'checks if Cinder DB is populated' do
|
||||
should contain_exec('cinder_db_sync').with(
|
||||
:command => '/usr/bin/cinder-manage db sync',
|
||||
:unless => '/usr/bin/mysql cinder -h 10.0.0.1 -u cinder -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure cinder scheduler' do
|
||||
should contain_class('cinder::scheduler')
|
||||
end
|
||||
|
||||
@@ -58,6 +58,13 @@ describe 'cloud::volume::storage' do
|
||||
|
||||
end
|
||||
|
||||
it 'checks if Cinder DB is populated' do
|
||||
should contain_exec('cinder_db_sync').with(
|
||||
:command => '/usr/bin/cinder-manage db sync',
|
||||
:unless => '/usr/bin/mysql cinder -h 10.0.0.1 -u cinder -psecrete -e "show tables" | /bin/grep Tables'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configure cinder volume with rbd backend' do
|
||||
|
||||
should include_class('cinder::volume')
|
||||
|
||||
Reference in New Issue
Block a user