The refactoring

Change-Id: Iec735a7a4107770c490d904dc31754defa5409bf
This commit is contained in:
Igor Gajsin 2016-08-25 16:54:04 +03:00
parent ab780644fc
commit 2751b141bd
17 changed files with 281 additions and 343 deletions

View File

@ -0,0 +1,33 @@
# 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/generic': }
$manila = hiera_hash('manila', {})
$image = $manila['service_vm_image']['img_name']
$share_driver = 'manila.share.drivers.generic.GenericShareDriver'
$backends = {'generic' =>
{'share_backend_name' => 'generic',
'driver_handles_share_servers' => 'true',
'share_driver' => $share_driver,
'service_instance_user' => 'manila',
'service_instance_password' => 'manila',
'service_image_name' => $image,
'path_to_private_key' => '/var/lib/astute/manila/manila',
'path_to_public_key' => '/var/lib/astute/manila/manila.pub',
}
}
create_resources('::manila_auxiliary::backend::generic', $backends)

View File

@ -4,6 +4,13 @@ package {'python-pip':
ensure => 'installed'
}
package {'python-pymysql':
ensure => 'installed'
}
package {'python-dev':
ensure => 'installed'
}
package {'pycrypto':
ensure => 'installed',
provider => 'pip',
@ -23,4 +30,10 @@ package {'python-manila-ui':
class {'::manila_auxiliary::fs': }
Package['python-pip']->Package['pycrypto']->Package['python-manila']->Package['python-manilaclient']->Package['python-manila-ui']
Package['python-pip']->
Package['python-dev']->
Package['python-pymysql']->
Package['pycrypto']->
Package['python-manila']->
Package['python-manilaclient']->
Package['python-manila-ui']

View File

@ -1,43 +0,0 @@
notify {'MODULAR: fuel-plugin-manila/install': }
$inits = {
'manila-api' => {
desc => 'manila-api init',
srv => 'manila-api',},
'manila-share' => {
desc => 'manila-share init',
srv => 'manila-share',},
'manila-data' =>{
desc => 'manila-data init',
srv => 'manila-data',},
'manila-scheduler' => {
desc => 'manila-scheduler init',
srv => 'manila-scheduler',},
}
package {'python-pymysql':
ensure => 'installed'
}
package {'python-pip':
ensure => 'installed'
}
package {'python-dev':
ensure => 'installed'
}
package {'pycrypto':
ensure => 'installed',
provider => 'pip',
}
package {'python-manila':
ensure => 'installed'
}
class {'::manila_auxiliary::fs': }
create_resources('::manila_auxiliary::initd', $inits)
Package['python-pip']->Package['python-dev']->Package['pycrypto']->Package['python-manila']

View File

@ -1,6 +0,0 @@
notify {'MODULAR: fuel-plugin-manila/master2': }
file {'/tmp/manila_master2':
ensure => file,
content => 'I am the file2',
}

View File

@ -0,0 +1,17 @@
# 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/meta': }
class {'::manila_auxiliary::meta': }

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
notify {'MODULAR: fuel-plugin-manila/site': }
notify {'MODULAR: fuel-plugin-manila/main': }
$manila = hiera_hash('manila', {})
$db_user = 'manila'
@ -20,7 +20,6 @@ $db_pass = $manila['db_password']
$manila_pass = $manila['user_password']
$db_host = hiera('database_vip')
$sql_conn = "mysql+pymysql://${db_user}:${db_pass}@${db_host}/manila?charset=utf8"
$image = $manila['service_vm_image']['img_name']
$rabbit_hash = hiera_hash('rabbit', {})
$amqp_user = $rabbit_hash['user']
@ -50,8 +49,6 @@ $debug = hiera('debug')
$use_syslog = hiera('use_syslog')
class {'::manila_auxiliary':
sql_connection => $sql_conn,
shared_backends => 'generic', #should be array of backends
@ -69,15 +66,4 @@ class {'::manila_auxiliary':
nova_pass => $nova_pass,
verbose => $verbose,
debug => $debug,
}->
class {'::manila_auxiliary::services': }
class {'::manila_auxiliary::ui': }
class {'::manila_auxiliary::meta': }
Class['::manila_auxiliary']->
Class['::manila_auxiliary::services']->
Class['::manila_auxiliary::meta']
}

View File

@ -1,92 +0,0 @@
# 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/site_data': }
$manila = hiera_hash('manila', {})
$db_user = 'manila'
$db_pass = $manila['db_password']
$manila_pass = $manila['user_password']
$db_host = hiera('database_vip')
$sql_conn = "mysql+pymysql://${db_user}:${db_pass}@${db_host}/manila?charset=utf8"
$image = $manila['service_vm_image']['img_name']
$rabbit_hash = hiera_hash('rabbit', {})
$amqp_user = $rabbit_hash['user']
$amqp_password = $rabbit_hash['password']
$amqp_hosts = split(hiera('amqp_hosts', ''), ',')
$network_metadata = hiera_hash('network_metadata', {})
$ns = hiera_hash('network_scheme', {})
$mgmt_ip = $network_metadata['vips']['management']['ipaddr']
$br_mgmt = split($ns['endpoints']['br-mgmt']['IP'][0], '/')
$br_mgmt_ip = $br_mgmt[0]
$neutron = hiera_hash('quantum_settings', {})
$neutron_pass = $neutron['keystone']['admin_password']
$auth_url = "http://${mgmt_ip}:35357/"
$auth_uri = "http://${mgmt_ip}:5000/"
$cinder = hiera_hash('cinder', {})
$cinder_pass = $cinder['user_password']
$nova = hiera_hash('nova', {})
$nova_pass = $nova['user_password']
$verbose = hiera('verbose')
$debug = hiera('debug')
$use_syslog = hiera('use_syslog')
$backends = {'generic' =>
{'share_backend_name' => 'generic',
'driver_handles_share_servers' => 'true',
'share_driver' => 'manila.share.drivers.generic.GenericShareDriver',
'service_instance_user' => 'manila',
'service_instance_password' => 'manila',
'service_image_name' => $image,
'path_to_private_key' => '/var/lib/astute/manila/manila',
'path_to_public_key' => '/var/lib/astute/manila/manila.pub',
}
}
class {'::manila_auxiliary':
sql_connection => $sql_conn,
shared_backends => 'generic', #should be array of backends
amqp_durable_queues => 'False',
rabbit_userid => $amqp_user,
rabbit_hosts => $amqp_hosts,
rabbit_use_ssl => 'False',
rabbit_password => $amqp_password,
auth_url => $auth_url,
auth_uri => $auth_uri,
br_mgmt_ip => $br_mgmt_ip,
cinder_pass => $cinder_pass,
manila_pass => $manila_pass,
neutron_pass => $neutron_pass,
nova_pass => $nova_pass,
verbose => $verbose,
debug => $debug,
}->
class {'::manila_auxiliary::services': }
Class['::manila_auxiliary']->
Class['::manila_auxiliary::services']
#create_resources('::manila_auxiliary::backend::generic', $backends)

View File

@ -1,92 +0,0 @@
# 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/site_share': }
$manila = hiera_hash('manila', {})
$db_user = 'manila'
$db_pass = $manila['db_password']
$manila_pass = $manila['user_password']
$db_host = hiera('database_vip')
$sql_conn = "mysql+pymysql://${db_user}:${db_pass}@${db_host}/manila?charset=utf8"
$image = $manila['service_vm_image']['img_name']
$rabbit_hash = hiera_hash('rabbit', {})
$amqp_user = $rabbit_hash['user']
$amqp_password = $rabbit_hash['password']
$amqp_hosts = split(hiera('amqp_hosts', ''), ',')
$network_metadata = hiera_hash('network_metadata', {})
$ns = hiera_hash('network_scheme', {})
$mgmt_ip = $network_metadata['vips']['management']['ipaddr']
$br_mgmt = split($ns['endpoints']['br-mgmt']['IP'][0], '/')
$br_mgmt_ip = $br_mgmt[0]
$neutron = hiera_hash('quantum_settings', {})
$neutron_pass = $neutron['keystone']['admin_password']
$auth_url = "http://${mgmt_ip}:35357/"
$auth_uri = "http://${mgmt_ip}:5000/"
$cinder = hiera_hash('cinder', {})
$cinder_pass = $cinder['user_password']
$nova = hiera_hash('nova', {})
$nova_pass = $nova['user_password']
$verbose = hiera('verbose')
$debug = hiera('debug')
$use_syslog = hiera('use_syslog')
$backends = {'generic' =>
{'share_backend_name' => 'generic',
'driver_handles_share_servers' => 'true',
'share_driver' => 'manila.share.drivers.generic.GenericShareDriver',
'service_instance_user' => 'manila',
'service_instance_password' => 'manila',
'service_image_name' => $image,
'path_to_private_key' => '/var/lib/astute/manila/manila',
'path_to_public_key' => '/var/lib/astute/manila/manila.pub',
}
}
class {'::manila_auxiliary':
sql_connection => $sql_conn,
shared_backends => 'generic', #should be array of backends
amqp_durable_queues => 'False',
rabbit_userid => $amqp_user,
rabbit_hosts => $amqp_hosts,
rabbit_use_ssl => 'False',
rabbit_password => $amqp_password,
auth_url => $auth_url,
auth_uri => $auth_uri,
br_mgmt_ip => $br_mgmt_ip,
cinder_pass => $cinder_pass,
manila_pass => $manila_pass,
neutron_pass => $neutron_pass,
nova_pass => $nova_pass,
verbose => $verbose,
debug => $debug,
}->
class {'::manila_auxiliary::services': }
Class['::manila_auxiliary']->
Class['::manila_auxiliary::services']
create_resources('::manila_auxiliary::backend::generic', $backends)

View File

@ -0,0 +1,45 @@
# 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/start_controller': }
$inits = {
'manila-api' => {
desc => 'manila-api init script',
srv => 'manila-api',},
'manila-scheduler' => {
desc => 'manila-scheduler init script',
srv => 'manila-scheduler',},
}
create_resources('::manila_auxiliary::initd', $inits)
exec { 'manual_db_sync':
command => 'manila-manage db sync',
path => '/usr/bin',
user => 'manila',
}->
service { 'manila-api':
ensure => 'running',
name => 'manila-api',
enable => true,
hasstatus => true,
}->
service { 'manila-scheduler':
ensure => 'running',
name => 'manila-scheduler',
enable => true,
hasstatus => true,
}

View File

@ -0,0 +1,32 @@
# 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/start_data': }
$inits = {
'manila-data' => {
desc => 'manila-data init script',
srv => 'manila-data',},
}
create_resources('::manila_auxiliary::initd', $inits)
service { 'manila-data':
ensure => 'running',
name => 'manila-data',
enable => true,
hasstatus => true,
}

View File

@ -0,0 +1,51 @@
# 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/start_share': }
$srv = 'manila-share'
$desc = 'manila-share service'
$manila = hiera_hash('manila', {})
$image = $manila['service_vm_image']['img_name']
$share_driver = 'manila.share.drivers.generic.GenericShareDriver'
$backends = {'generic' =>
{'share_backend_name' => 'generic',
'driver_handles_share_servers' => 'true',
'share_driver' => $share_driver,
'service_instance_user' => 'manila',
'service_instance_password' => 'manila',
'service_image_name' => $image,
'path_to_private_key' => '/var/lib/astute/manila/manila',
'path_to_public_key' => '/var/lib/astute/manila/manila.pub',
}
}
$inits = {
'manila-share' => {
desc => 'manila-share init script',
srv => 'manila-share',},
}
create_resources('::manila_auxiliary::initd', $inits)
create_resources('::manila_auxiliary::backend::generic', $backends)
service { 'manila-share':
ensure => 'running',
name => 'manila-share',
enable => true,
hasstatus => true,
}

View File

@ -0,0 +1,28 @@
# 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/ui': }
include ::apache::params
include ::apache::service
$adm_shares = '/usr/lib/python2.7/dist-packages/manila_ui/enabled'
$hor_enabled = '/usr/share/openstack-dashboard/openstack_dashboard/enabled/'
exec {'add_share_panel':
command => "cp ${adm_shares}/_90*.py ${hor_enabled}",
path => '/bin:/usr/bin',
}
Exec['add_share_panel'] ~> Service['httpd']

View File

@ -7,7 +7,8 @@ define manila_auxiliary::backend::generic (
$path_to_private_key = '/root/.ssh/id_rsa',
$path_to_public_key = '/root/.ssh/id_rsa.pub',
$share_backend_name = $name,
) {
) {
manila_config {
"${name}/share_driver": value => $share_driver;
"${name}/driver_handles_share_servers": value => $driver_handles_share_servers;
@ -17,5 +18,5 @@ define manila_auxiliary::backend::generic (
"${name}/path_to_private_key": value => $path_to_private_key;
"${name}/path_to_public_key": value => $path_to_public_key;
"${name}/share_backend_name": value => $share_backend_name;
}~>Service['manila-share']
}
}~>Service['manila-share']
}

View File

@ -17,7 +17,8 @@ define manila_auxiliary::initd(
$srv = 'manila-something',
){
file {"/etc/init/${srv}.conf":
ensure => present,
content => template('manila_auxiliary/init.erb')
ensure => present,
content => template('manila_auxiliary/init.erb'),
notify => Service[$srv],
}
}

View File

@ -1,15 +0,0 @@
class manila_auxiliary::ui () {
include ::apache::params
include ::apache::service
$adm_shares = '/usr/lib/python2.7/dist-packages/manila_ui/enabled'
$hor_enabled = '/usr/share/openstack-dashboard/openstack_dashboard/enabled/'
exec {'add_share_panel':
command => "cp ${adm_shares}/_90*.py ${hor_enabled}",
path => '/bin:/usr/bin',
}
Exec['add_share_panel'] ~> Service['httpd']
}

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, openstack-network-common-config, openstack-network-plugins-l2]
tasks: [hiera, globals, setup_repositories, tools, logging, netconfig, firewall, hosts, ntp-client, dns-client, cgroups, deploy_start]
required_for: [deploy_end]
requires: [deploy_start, primary-controller]
parameters:
@ -112,19 +112,6 @@
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-install-controller
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
required_for: [manila-main]
requires: [manila-db]
cross-depends:
- name: manila-db
parameters:
puppet_manifest: "puppet/manifests/install.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-share-network-common-config
type: puppet
version: 2.1.0
@ -149,12 +136,11 @@
puppet_modules: /etc/puppet/modules
timeout: 1800
- id: manila-share-network-plugins-l2
type: puppet
version: 2.1.0
groups: [manila-share]
required_for: [manila-install-share-data]
required_for: [manila-install]
requires: [manila-share-network-common-config]
refresh_on: [neutron_agent_ovs]
cross-depends:
@ -165,58 +151,25 @@
puppet_modules: /etc/puppet/modules
timeout: 1800
- id: manila-install-share-data
- id: manila-install
type: puppet
groups: [manila-share, manila-data]
version: 2.1.0
required_for: [deploy_end]
requires: [hosts]
parameters:
puppet_manifest: "puppet/manifests/install_sd.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-init-controller
type: puppet
groups: [primary-controller, controller]
groups: [primary-controller, controller, manila-share, manila-data]
version: 2.1.0
required_for: [manila-main]
requires: [manila-install-controller]
requires: [manila-db]
cross-depends:
- name: manila-db
parameters:
puppet_manifest: "puppet/manifests/init_controller.pp"
puppet_manifest: "puppet/manifests/install.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-init-share
type: puppet
groups: [manila-share]
version: 2.1.0
required_for: [deploy_end]
requires: [manila-install-share-data]
parameters:
puppet_manifest: "puppet/manifests/init_share.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-init-data
type: puppet
groups: [manila-data]
version: 2.1.0
required_for: [deploy_end]
requires: [manila-install-share-data]
parameters:
puppet_manifest: "puppet/manifests/init_data.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-image_upload
type: puppet
groups: [primary-controller]
version: 2.1.0
required_for: [manila-main]
requires: [manila-install-controller]
requires: [manila-install]
parameters:
puppet_manifest: "puppet/manifests/image_upload.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
@ -226,7 +179,8 @@
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
requires: [manila-install-controller]
requires: [manila-install]
required_for: [manila-main]
parameters:
puppet_manifest: "puppet/manifests/haproxy.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
@ -234,40 +188,65 @@
- id: manila-main
type: puppet
groups: [primary-controller, controller]
groups: [primary-controller, controller, manila-share, manila-data]
version: 2.1.0
cross-depends:
- name: manila-db
cross-depended-by:
- name: deploy_end
requires: [manila-install-controller, manila-haproxy]
requires: [manila-install, manila-haproxy]
parameters:
puppet_manifest: "puppet/manifests/site.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-main_share
- id: manila-controller-start
type: puppet
groups: [manila-share]
groups: [primary-controller, controller]
version: 2.1.0
cross-depends:
- name: manila-main
required_for: [deploy_end]
requires: [manila-init-share]
requires: [manila-main]
parameters:
puppet_manifest: "puppet/manifests/site_share.pp"
puppet_manifest: "puppet/manifests/start_controller.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-main_data
- id: manila-data-start
type: puppet
groups: [manila-data]
version: 2.1.0
cross-depends:
- name: manila-main
required_for: [deploy_end]
requires: [manila-init-data]
requires: [manila-main]
parameters:
puppet_manifest: "puppet/manifests/site_data.pp"
puppet_manifest: "puppet/manifests/start_data.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-share-start
type: puppet
groups: [manila-share]
version: 2.1.0
requires: [manila-main]
parameters:
puppet_manifest: "puppet/manifests/start_share.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-ui
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
requires: [manila-main]
parameters:
puppet_manifest: "puppet/manifests/ui.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-meta
type: puppet
groups: [primary-controller]
version: 2.1.0
requires: [manila-controller-start]
parameters:
puppet_manifest: "puppet/manifests/meta.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600

View File

@ -3,7 +3,7 @@ name: fuel-plugin-manila
# Human-readable name for your plugin
title: enable Manila service
# Plugin version
version: '1.0.1'
version: '1.0.0'
# Description
description: Manila is the File Storage as a Service OpenStack project
# Required fuel version