Merge "prevent to execute unnecessary tasks when redeploy"

This commit is contained in:
Jenkins 2016-09-27 09:56:15 +00:00 committed by Gerrit Code Review
commit ad6836a978
7 changed files with 87 additions and 36 deletions

View File

@ -0,0 +1,27 @@
# 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 {'MODULAR: fuel-plugin-manila/db-sync': }
$manila = hiera_hash('manila', {})
$db_pass = $manila['db_password']
$db_host = hiera('database_vip')
$req = 'select name from availability_zones\G'
exec { 'manual_db_sync':
command => 'manila-manage db sync',
path => '/usr/bin:/bin',
user => 'manila',
unless => "mysql -u manila -p${db_pass} -h ${db_host} -e \"${req}\" manila | grep nova"
}

View File

@ -25,21 +25,19 @@ $inits = {
create_resources('::manila_auxiliary::initd', $inits)
exec { 'manual_db_sync':
command => 'manila-manage db sync',
path => '/usr/bin',
user => 'manila',
}->
notify {'Restart manila-api':
}~>
service { 'manila-api':
ensure => 'running',
name => 'manila-api',
enable => true,
hasstatus => true,
}->
service { 'manila-scheduler':
ensure => 'running',
name => 'manila-scheduler',
enable => true,
hasstatus => true,
}
notify {' Restart manila-scheduler':
}~>
service { 'manila-scheduler':
ensure => 'running',
name => 'manila-scheduler',
enable => true,
hasstatus => true,
}

View File

@ -23,10 +23,11 @@ $inits = {
create_resources('::manila_auxiliary::initd', $inits)
service { 'manila-data':
ensure => 'running',
name => 'manila-data',
enable => true,
hasstatus => true,
}
notify {'Restart manila-data':
}~>
service { 'manila-data':
ensure => 'running',
name => 'manila-data',
enable => true,
hasstatus => true,
}

View File

@ -61,10 +61,11 @@ $inits = {
create_resources('::manila_auxiliary::initd', $inits)
service { 'manila-share':
ensure => 'running',
name => 'manila-share',
enable => true,
hasstatus => true,
}
notify {'Restart manila-share':
}~>
service { 'manila-share':
ensure => 'running',
name => 'manila-share',
enable => true,
hasstatus => true,
}

View File

@ -4,7 +4,7 @@
- id: manila-share
type: group
role: [manila-share]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, firewall, hosts, ntp-client, dns-client, cgroups, deploy_start]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, firewall, hosts, ntp-client, dns-client, cgroups, manila-hiera, deploy_start]
required_for: [deploy_end]
requires: [deploy_start, primary-controller]
parameters:
@ -16,7 +16,7 @@
- id: manila-data
type: group
role: [manila-data]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, firewall, hosts, ntp-client, dns-client, cgroups, deploy_start]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, firewall, hosts, ntp-client, dns-client, cgroups, manila-hiera, deploy_start]
required_for: [deploy_end]
requires: [deploy_start, primary-controller]
parameters:
@ -32,7 +32,7 @@
requires: [pre_deployment_start]
required_for: [manila-copy_keys]
parameters:
cmd: sh /etc/puppet/modules/osnailyfacter/modular/astute/generate_keys.sh -p /var/lib/fuel/keys/ -i {CLUSTER_ID} -s 'manila'
cmd: sh /var/www/nailgun/plugins/fuel-plugin-manila-1.0/gen_keys.sh {CLUSTER_ID}
timeout: 180
- id: manila-copy_keys
@ -200,11 +200,24 @@
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-db-sync
type: puppet
groups: [primary-controller]
version: 2.1.0
requires: [manila-main, manila-db]
required_for: [manila-controller-start]
parameters:
puppet_manifest: "puppet/manifests/db-sync.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-controller-start
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
requires: [manila-main]
cross-depends:
- name: manila-db-sync
parameters:
puppet_manifest: "puppet/manifests/start_controller.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"

7
gen_keys.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
CLUSTER_ID=$1
if [ ! -d /var/lib/fuel/keys/$CLUSTER_ID/manila ]; then
sh /etc/puppet/modules/osnailyfacter/modular/astute/generate_keys.sh -p /var/lib/fuel/keys/ -i $CLUSTER_ID -s 'manila'
fi

View File

@ -1,15 +1,18 @@
#!/bin/sh
CLUSTER_ID=$1
PLUGIN_YAML=/etc/fuel/cluster/$CLUSTER_ID/fuel-plugin-manila.yaml
gen_pass() {
openssl rand -base64 32|tr -d '='
}
if [ ! -f $PLUGIN_YAML ]; then
user_pass=$(gen_pass)
maniladb_pass=$(gen_pass)
gen_pass() {
openssl rand -base64 32|tr -d '='
}
echo "
user_pass=$(gen_pass)
maniladb_pass=$(gen_pass)
echo "
---
manila:
user_password: $user_pass
@ -23,4 +26,5 @@ echo "
min_ram: \"256\"
os_name: ubuntu
public: \"true\"
" > /etc/fuel/cluster/$CLUSTER_ID/fuel-plugin-manila.yaml
" > $PLUGIN_YAML
fi