From 8b53020c7a5cbd0ec52a391ef55135aa9e88288b Mon Sep 17 00:00:00 2001 From: Igor Gajsin Date: Mon, 25 Jul 2016 19:11:51 +0300 Subject: [PATCH] initial database support Create the manila user, database and grant permission to it. Change-Id: I36cbbdbb75ee346d8268faa45505813675f46331 --- deployment_scripts/puppet/manifests/db.pp | 53 +++++++++++++++++++ .../puppet/manifests/keystone.pp | 2 +- .../puppet/manifests/populate_hiera.pp | 4 +- deployment_scripts/puppet/modules/manila | 2 +- deployment_tasks.yaml | 24 ++++++++- metadata.yaml | 2 +- 6 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 deployment_scripts/puppet/manifests/db.pp diff --git a/deployment_scripts/puppet/manifests/db.pp b/deployment_scripts/puppet/manifests/db.pp new file mode 100644 index 0000000..02803fd --- /dev/null +++ b/deployment_scripts/puppet/manifests/db.pp @@ -0,0 +1,53 @@ +# Copyright 2016 Mirantis, Inc. +# +# 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. + +notify {'MOUDULAR: fuel-plugin-manila/db': } + +$mysql = hiera_hash('mysql', {}) +$manila = hiera_hash('manila', {}) + +$db_host = hiera('database_vip') +$db_root_user = pick($mysql['root_user'], 'root') +$db_root_password = $mysql['root_password'] + +$db_user = 'manila' +$db_password = $manila['db_password'] +$db_name = 'manila' +$allowed_hosts = [ 'localhost', '127.0.0.1', '%' ] + +class { '::openstack::galera::client': + custom_setup_class => hiera('mysql_custom_setup_class', 'galera'), +} + +class { '::osnailyfacter::mysql_access': + db_host => $db_host, + db_user => $db_root_user, + db_password => $db_root_password, +} + +class { '::manila::db::mysql': + user => $db_user, + password => $db_password, + dbname => $db_name, + allowed_hosts => $allowed_hosts, +} + +class mysql::config {} +include mysql::config +class mysql::server {} +include mysql::server + +Class['::openstack::galera::client'] -> + Class['::osnailyfacter::mysql_access'] + -> Class['::manila::db::mysql'] diff --git a/deployment_scripts/puppet/manifests/keystone.pp b/deployment_scripts/puppet/manifests/keystone.pp index 6cae92f..5fde88a 100644 --- a/deployment_scripts/puppet/manifests/keystone.pp +++ b/deployment_scripts/puppet/manifests/keystone.pp @@ -1,4 +1,4 @@ -notify {'MODULAR manila/keystone': } +notify {'MODULAR fuel-plugin-manila/keystone': } $manila = hiera_hash('manila', {}) $pass = $manila['user_password'] diff --git a/deployment_scripts/puppet/manifests/populate_hiera.pp b/deployment_scripts/puppet/manifests/populate_hiera.pp index ab2a83b..f9aa34b 100644 --- a/deployment_scripts/puppet/manifests/populate_hiera.pp +++ b/deployment_scripts/puppet/manifests/populate_hiera.pp @@ -1,9 +1,11 @@ -notify {'MODULAR: manila/populate_hiera': } +notify {'MODULAR: fuel-plugin-manila/populate_hiera': } $manila = hiera_hash('manila', false) $file = '/etc/hiera/plugins/fuel-plugin-manila.yaml' $new_password = generate("/bin/bash", "-c", "/bin/date +%s | sha256sum | base64 | head -c 32 ; echo -n") +$db_password = generate("/bin/bash", "-c", "/bin/date +%s | sha256sum | base64 | head -c 32 ; echo -n") if ! $manila { populate_hiera($file, 'user_password', $new_password) + populate_hiera($file, 'db_password', $db_password) } diff --git a/deployment_scripts/puppet/modules/manila b/deployment_scripts/puppet/modules/manila index 3d8244d..110a0b4 160000 --- a/deployment_scripts/puppet/modules/manila +++ b/deployment_scripts/puppet/modules/manila @@ -1 +1 @@ -Subproject commit 3d8244db11cb603f89980b8fbefc5dc228f0a7d8 +Subproject commit 110a0b4d02d7038ec2ed1fecc635543b42d7f0bd diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index 9781d0f..85e5f50 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -15,6 +15,8 @@ type: puppet groups: [primary-controller, controller] version: 2.1.0 + requires: [hiera] + required_for: [manila-keystone] cross-depends: - name: manila-start cross-depended-by: @@ -28,6 +30,8 @@ type: puppet groups: [primary-controller, controller] version: 2.1.0 + requires: [manila-hiera] + required_for: [manila-db] cross-depends: - name: manila-hiera cross-depended-by: @@ -37,12 +41,30 @@ puppet_modules: "puppet/modules:/etc/puppet/modules" timeout: 3600 +- id: manila-db + type: puppet + groups: [primary-controller] + version: 2.1.0 + required_for: [manila-main] + requires: [primary-database, database, manila-hiera] + condition: + yaql_exp: > + changedAny($.mysql, $.network_metadata.vips, $.get('database_vip')) + cross-depends: + - name: /^(primary-)?database$/ + cross-depended-by: + - name: deploy_end + parameters: + puppet_manifest: "puppet/manifests/db.pp" + puppet_modules: "puppet/modules:/etc/puppet/modules" + timeout: 3600 + - id: manila-main type: puppet groups: [primary-controller, controller] version: 2.1.0 cross-depends: - - name: manila-kestone + - name: manila-db cross-depended-by: - name: deploy_end parameters: diff --git a/metadata.yaml b/metadata.yaml index 0893b7e..92d02e0 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -3,7 +3,7 @@ name: fuel-plugin-manila # Human-readable name for your plugin title: Title for fuel-plugin-manila plugin # Plugin version -version: '1.0.1' +version: '1.0.2' # Description description: Please describe your plugin here # Required fuel version