Files
puppet-nova/manifests/db.pp
Emilien Macchi 30b6a9c4c7 Configure database parameters on the right nodes
Since Grizzly, nova-compute does not need database access anymore.
Currently, only nova-api, nova-scheduler and nova-conductor really need
database access.

* Keep original nova parameters with backward compatibility
* Create nova::db with database parameters
* Import nova::db in nova::init for backward compatibility
* Import nova::db in nova::{api,conductor,scheduler}
* Refactorize unit tests for conductor & scheduler

Change-Id: I42b9d2b1efb5856fed6550c25ac3142952690df1
Implements: blueprint move-db-params
2014-11-26 16:37:28 -05:00

57 lines
1.8 KiB
ObjectPascal

#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: nova::db
# Configures the nova database.
#
# == Parameters
#
# [*database_connection*]
# (optional) Connection url to connect to nova database.
# Defaults to undef
#
# [*database_idle_timeout*]
# (optional) Timeout before idle db connections are reaped.
# Defaults to undef
#
class nova::db (
$database_connection = undef,
$database_idle_timeout = undef,
) {
$database_connection_real = pick($database_connection, $::nova::database_connection, false)
$database_idle_timeout_real = pick($database_idle_timeout, $::nova::database_idle_timeout, false)
if $database_connection_real {
if($database_connection_real =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
require 'mysql::bindings'
require 'mysql::bindings::python'
} elsif($database_connection_real =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
} elsif($database_connection_real =~ /sqlite:\/\//) {
} else {
fail("Invalid db connection ${database_connection_real}")
}
nova_config {
'database/connection': value => $database_connection_real, secret => true;
'database/idle_timeout': value => $database_idle_timeout_real;
}
}
}