From c83d0ff273759c268b48c745f4a3aeb1fdebad44 Mon Sep 17 00:00:00 2001 From: Igor Gajsin Date: Fri, 19 Aug 2016 16:36:32 +0300 Subject: [PATCH] add manila-share and manila-data roles Change-Id: I2a08ba0b74edd76f71771531f3617a8bfec6d50f --- .../puppet/manifests/init_controller.pp | 12 ++ .../puppet/manifests/init_data.pp | 9 ++ .../puppet/manifests/init_share.pp | 9 ++ .../puppet/manifests/install.pp | 17 -- .../puppet/manifests/install_sd.pp | 43 +++++ deployment_scripts/puppet/manifests/site.pp | 13 -- .../puppet/manifests/site_data.pp | 92 +++++++++++ .../puppet/manifests/site_share.pp | 92 +++++++++++ .../modules/manila_auxiliary/files/meta.sh | 10 +- .../manila_auxiliary/manifests/services.pp | 47 +++--- deployment_tasks.yaml | 147 +++++++++++++++++- docs/todo.org | 2 + metadata.yaml | 2 +- node_roles.yaml | 20 ++- 14 files changed, 453 insertions(+), 62 deletions(-) create mode 100644 deployment_scripts/puppet/manifests/init_controller.pp create mode 100644 deployment_scripts/puppet/manifests/init_data.pp create mode 100644 deployment_scripts/puppet/manifests/init_share.pp create mode 100644 deployment_scripts/puppet/manifests/install_sd.pp create mode 100644 deployment_scripts/puppet/manifests/site_data.pp create mode 100644 deployment_scripts/puppet/manifests/site_share.pp create mode 100644 docs/todo.org diff --git a/deployment_scripts/puppet/manifests/init_controller.pp b/deployment_scripts/puppet/manifests/init_controller.pp new file mode 100644 index 0000000..9b0db8e --- /dev/null +++ b/deployment_scripts/puppet/manifests/init_controller.pp @@ -0,0 +1,12 @@ +notify {'MODULAR: fuel-plugin-manila/init_controller': } + +$inits = { + 'manila-api' => { + desc => 'manila-api init', + srv => 'manila-api',}, + 'manila-scheduler' => { + desc => 'manila-scheduler init', + srv => 'manila-scheduler',}, +} + +create_resources('::manila_auxiliary::initd', $inits) diff --git a/deployment_scripts/puppet/manifests/init_data.pp b/deployment_scripts/puppet/manifests/init_data.pp new file mode 100644 index 0000000..c7276c6 --- /dev/null +++ b/deployment_scripts/puppet/manifests/init_data.pp @@ -0,0 +1,9 @@ +notify {'MODULAR: fuel-plugin-manila/init_data': } + +$inits = { + 'manila-data' =>{ + desc => 'manila-data init', + srv => 'manila-data',}, +} + +create_resources('::manila_auxiliary::initd', $inits) diff --git a/deployment_scripts/puppet/manifests/init_share.pp b/deployment_scripts/puppet/manifests/init_share.pp new file mode 100644 index 0000000..e8dcfdf --- /dev/null +++ b/deployment_scripts/puppet/manifests/init_share.pp @@ -0,0 +1,9 @@ +notify {'MODULAR: fuel-plugin-manila/init_share': } + +$inits = { + 'manila-share' => { + desc => 'manila-share init', + srv => 'manila-share',}, +} + +create_resources('::manila_auxiliary::initd', $inits) diff --git a/deployment_scripts/puppet/manifests/install.pp b/deployment_scripts/puppet/manifests/install.pp index d44a136..bb65709 100644 --- a/deployment_scripts/puppet/manifests/install.pp +++ b/deployment_scripts/puppet/manifests/install.pp @@ -1,20 +1,5 @@ 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-pip': ensure => 'installed' } @@ -38,6 +23,4 @@ package {'python-manila-ui': class {'::manila_auxiliary::fs': } -create_resources('::manila_auxiliary::initd', $inits) - Package['python-pip']->Package['pycrypto']->Package['python-manila']->Package['python-manilaclient']->Package['python-manila-ui'] diff --git a/deployment_scripts/puppet/manifests/install_sd.pp b/deployment_scripts/puppet/manifests/install_sd.pp new file mode 100644 index 0000000..c0e993b --- /dev/null +++ b/deployment_scripts/puppet/manifests/install_sd.pp @@ -0,0 +1,43 @@ +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'] diff --git a/deployment_scripts/puppet/manifests/site.pp b/deployment_scripts/puppet/manifests/site.pp index 6a9519a..c70defc 100644 --- a/deployment_scripts/puppet/manifests/site.pp +++ b/deployment_scripts/puppet/manifests/site.pp @@ -50,17 +50,6 @@ $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': @@ -92,5 +81,3 @@ class {'::manila_auxiliary::meta': } Class['::manila_auxiliary']-> Class['::manila_auxiliary::services']-> Class['::manila_auxiliary::meta'] - -create_resources('::manila_auxiliary::backend::generic', $backends) diff --git a/deployment_scripts/puppet/manifests/site_data.pp b/deployment_scripts/puppet/manifests/site_data.pp new file mode 100644 index 0000000..1347732 --- /dev/null +++ b/deployment_scripts/puppet/manifests/site_data.pp @@ -0,0 +1,92 @@ +# 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) diff --git a/deployment_scripts/puppet/manifests/site_share.pp b/deployment_scripts/puppet/manifests/site_share.pp new file mode 100644 index 0000000..e45ff86 --- /dev/null +++ b/deployment_scripts/puppet/manifests/site_share.pp @@ -0,0 +1,92 @@ +# 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) diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh b/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh index 9f67748..65ee9d7 100755 --- a/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh +++ b/deployment_scripts/puppet/modules/manila_auxiliary/files/meta.sh @@ -2,22 +2,22 @@ . /root/openrc -if manila type-list | grep -q 'default_share_type'; then +if ! manila type-list | grep -q 'default_share_type'; then echo 'add default_share_type' manila type-create default_share_type True fi -if manila share-network-list | grep -q 'test_share_network'; then +if ! manila share-network-list | grep -q 'test_share_network'; then echo 'add test_share_network' - net_uid=$(neutron net-list | grep -q 'internal' | cut -f2 -d' ') - subnet_uid=$(neutron net-list | grep -q 'internal' | cut -f6 -d' ') + net_uid=$(neutron net-list | grep 'internal' | cut -f2 -d' ') + subnet_uid=$(neutron net-list | grep 'internal' | cut -f6 -d' ') manila share-network-create \ --name test_share_network \ --neutron-net-id $net_uid \ --neutron-subnet-id $subnet_uid fi -if openstack flavor list | grep -q 'manila-service-flavor'; then +if ! openstack flavor list | grep -q 'manila-service-flavor'; then echo 'add manila-service-flavor' openstack flavor create manila-service-flavor \ --id 100 \ diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp index e988b1b..cf1c2ea 100644 --- a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/services.pp @@ -1,29 +1,38 @@ -class manila_auxiliary::services () { - 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, +class manila_auxiliary::services ( + ) { + if roles_include(['controller', 'primary-controller']) { + exec { 'manual_db_sync': + command => 'manila-manage db sync', + path => '/usr/bin', + user => 'manila', }-> - service { 'manila-scheduler': + service { 'manila-api': ensure => 'running', - name => 'manila-scheduler', + name => 'manila-api', enable => true, hasstatus => true, }-> + service { 'manila-scheduler': + ensure => 'running', + name => 'manila-scheduler', + enable => true, + hasstatus => true, + } + + } elsif roles_include(['manila-share']) { service { 'manila-share': ensure => 'running', name => 'manila-share', enable => true, hasstatus => true, - }-> - service {'manila-data': - ensure => 'running', - name => 'manila-data', - } -} + } + + } elsif roles_include(['manila-data']) { + service {'manila-data': + ensure => 'running', + name => 'manila-data', + enable => true, + hasstatus => true, + } + } + } diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index 3e09f47..a1ab816 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -1,3 +1,30 @@ +# Groups + +# Manila - Share +- 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] + required_for: [deploy_end] + requires: [deploy_start, primary-controller] + parameters: + strategy: + type: one_by_one + +# Manila - Data + +- 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] + required_for: [deploy_end] + requires: [deploy_start, primary-controller] + parameters: + strategy: + type: one_by_one + +# Tasks + - id: manila-generate_keys type: shell groups: [master] @@ -85,7 +112,7 @@ puppet_modules: "puppet/modules:/etc/puppet/modules" timeout: 3600 -- id: manila-install +- id: manila-install-controller type: puppet groups: [primary-controller, controller] version: 2.1.0 @@ -98,12 +125,98 @@ puppet_modules: "puppet/modules:/etc/puppet/modules" timeout: 3600 +- id: manila-share-network-common-config + type: puppet + version: 2.1.0 + groups: [manila-share] + required_for: [openstack-network-end] + requires: [hosts, firewall] + condition: + yaql_exp: > + changedAny($.get('openstack_network'), $.get('verbose'), $.debug, + $.quantum_settings, $.neutron_advanced_configuration, $.rabbit, + $.ceilometer, $.network_scheme, $.get('use_syslog'), + $.get('use_stderr'), $.get('syslog_log_facility_neutron'), + $.network_metadata.nodes.values().where( + $.node_roles.any($.matches('controller'))).network_roles.select( + $.get('mgmt/messaging')), + $.get('amqp_hosts'), $.get('kombu_compression')) + cross-depends: + - name: /^openstack-network-common-config$/ + role: primary-controller + parameters: + puppet_manifest: /etc/puppet/modules/openstack_tasks/examples/openstack-network/common-config.pp + 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] + requires: [manila-share-network-common-config] + refresh_on: [neutron_agent_ovs] + cross-depends: + - name: primary-openstack-network-plugins-l2 + role: primary-controller + parameters: + puppet_manifest: /etc/puppet/modules/openstack_tasks/examples/openstack-network/plugins/ml2.pp + puppet_modules: /etc/puppet/modules + timeout: 1800 + + +- id: manila-install-share-data + 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] + version: 2.1.0 + required_for: [manila-main] + requires: [manila-install-controller] + parameters: + puppet_manifest: "puppet/manifests/init_controller.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] + requires: [manila-install-controller] parameters: puppet_manifest: "puppet/manifests/image_upload.pp" puppet_modules: "puppet/modules:/etc/puppet/modules" @@ -113,7 +226,7 @@ type: puppet groups: [primary-controller, controller] version: 2.1.0 - requires: [manila-install] + requires: [manila-install-controller] parameters: puppet_manifest: "puppet/manifests/haproxy.pp" puppet_modules: "puppet/modules:/etc/puppet/modules" @@ -127,8 +240,34 @@ - name: manila-db cross-depended-by: - name: deploy_end - requires: [manila-install, manila-haproxy] + requires: [manila-install-controller, manila-haproxy] parameters: puppet_manifest: "puppet/manifests/site.pp" puppet_modules: "puppet/modules:/etc/puppet/modules" timeout: 3600 + +- id: manila-main_share + type: puppet + groups: [manila-share] + version: 2.1.0 + cross-depends: + - name: manila-main + required_for: [deploy_end] + requires: [manila-init-share] + parameters: + puppet_manifest: "puppet/manifests/site_share.pp" + puppet_modules: "puppet/modules:/etc/puppet/modules" + timeout: 3600 + +- id: manila-main_data + type: puppet + groups: [manila-data] + version: 2.1.0 + cross-depends: + - name: manila-main + required_for: [deploy_end] + requires: [manila-init-data] + parameters: + puppet_manifest: "puppet/manifests/site_data.pp" + puppet_modules: "puppet/modules:/etc/puppet/modules" + timeout: 3600 diff --git a/docs/todo.org b/docs/todo.org new file mode 100644 index 0000000..b1357d4 --- /dev/null +++ b/docs/todo.org @@ -0,0 +1,2 @@ +* fix installation of pycrypto. Now it installs via pip. Build deb within the plugin +* remove dirty hack from haproxy.pp diff --git a/metadata.yaml b/metadata.yaml index 5aa000b..059fe64 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -3,7 +3,7 @@ name: fuel-plugin-manila # Human-readable name for your plugin title: enable Manila service # Plugin version -version: '1.0.0' +version: '1.0.1' # Description description: Manila is the File Storage as a Service OpenStack project # Required fuel version diff --git a/node_roles.yaml b/node_roles.yaml index f5a7c20..b74bc1b 100644 --- a/node_roles.yaml +++ b/node_roles.yaml @@ -1,8 +1,8 @@ -fuel-plugin-manila_role: +manila-share: # Role name - name: "Manila pomanila" + name: "Manila share" # Role description - description: "Desc of the manila role" + description: "The node that contains manila-share process" # If primary then during orchestration this role will be # separated into primary-role and role has_primary: false @@ -11,3 +11,17 @@ fuel-plugin-manila_role: # Weight that will be used to sort out the # roles on the Fuel web UI weight: 1000 + +manila-data: + # Role name + name: "Manila data" + # Role description + description: "The node that contains manila-data process" + # If primary then during orchestration this role will be + # separated into primary-role and role + has_primary: false + # Assign public IP to node if true + public_ip_required: false + # Weight that will be used to sort out the + # roles on the Fuel web UI + weight: 1001