fix manifests for cinder-vmware role

1. Fix dependency graph for granular deployment.
2. Simplification of the code and removing useless things.
3. Correct working with multiple vCenter. Not needed yet
(in Fuel 6.1), but will be better do it right from the start.
4. Add copyright's info.

Change-Id: I194d2ee7a9d9908703297f836104860f81cef495
Implements: blueprint cinder-vmdk-role
Closes-bug: 1433201
This commit is contained in:
Igor Gajsin 2015-03-17 17:05:24 +03:00
parent 553cb0cffa
commit 45f1159b4c
16 changed files with 82 additions and 95 deletions

View File

@ -0,0 +1,14 @@
module Puppet::Parser::Functions
newfunction(:get_cinder_vmware_data, :type => :rvalue,
:doc => <<-EOS
Transform data to suitable form for cinder-vmware: rebuild array of hashes
to hash of hashes with availability_zone_name as a key and add debug value.
EOS
) do |args|
raise(Puppet::ParseError, 'Empty array provided!') if args.size < 1
volumes = args[0]
debug = args[1] || "false"
volumes.each {|h| h.store("debug", debug)}
Hash[volumes.collect {|h| [h["availability_zone_name"], h]}]
end
end

View File

@ -10,7 +10,7 @@
- id: dns-client
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [netconfig]
parameters:

View File

@ -1,6 +1,6 @@
- id: firewall
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [netconfig]
parameters:

View File

@ -1,7 +1,7 @@
- id: globals
type: puppet
groups: [primary-controller, controller,
cinder, compute, ceph-osd,
cinder, cinder-vmware, compute, ceph-osd,
zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [hiera]

View File

@ -1,6 +1,6 @@
- id: hiera
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
requires: [deploy_start]
required_for: [deploy_end]
parameters:

View File

@ -1,6 +1,6 @@
- id: hosts
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder,cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [netconfig]
parameters:

View File

@ -1,6 +1,6 @@
- id: logging
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [globals]
parameters:

View File

@ -1,6 +1,6 @@
- id: netconfig
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [tools]
parameters:

View File

@ -10,7 +10,7 @@
- id: ntp-client
type: puppet
groups: [cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [netconfig]
parameters:
@ -20,11 +20,10 @@
- id: sync-time
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [firewall]
requires: [netconfig]
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/ntp/timesync.pp
puppet_modules: /etc/puppet/modules
timeout: 180

View File

@ -19,7 +19,7 @@
- id: top-role-cinder
type: puppet
groups: [cinder]
groups: [cinder, cinder-vmware]
required_for: [deploy_end]
requires: [hosts, firewall]
parameters:

View File

@ -1,6 +1,6 @@
- id: tools
type: puppet
groups: [primary-controller, controller, cinder, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
groups: [primary-controller, controller, cinder, cinder-vmware, compute, ceph-osd, zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [logging]
parameters:

View File

@ -1,27 +1,11 @@
notice('MODULAR: cinder-vmware.pp')
$vcenter_hash = hiera('vcenter', {})
# TODO Now $vcenter_hash['computes'] has only one value. This condition may be
# changed in 7.0 release. After that generalization of processing may be
# required.
$cmp = $vcenter_hash['computes'][0]
$vmware_host_ip = $cmp['vc_host']
$vmware_host_username = $cmp['vc_user']
$vmware_host_password = $cmp['vc_password']
$vmware_availability_zone = $cmp['availability_zone_name']
$vmware_clusters = $cmp['vc_cluster']
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
if (member($roles, 'cinder-vmware')) {
class {'vmware::cinder':
vmware_host_ip => $vmware_host_ip,
vmware_host_username => $vmware_host_username,
vmware_host_password => $vmware_host_password,
vmware_cluster => $vmware_clusters,
storage_availability_zone => $vmware_availabiilty_zone,
default_availability_zone => $vmware_availabiilty_zone,
debug => hiera('debug', true)
}
$cinder = hiera('cinder', {})
$debug = hiera('debug', true)
$volumes = get_cinder_vmware_data($cinder['instances'], $debug)
create_resources(vmware::cinder::vmdk, $volumes)
}

View File

@ -1,7 +1,7 @@
- id: zabbix
type: puppet
groups: [primary-controller, controller,
cinder, compute, ceph-osd,
cinder, cinder-vmware, compute, ceph-osd,
zabbix-server, primary-mongo, mongo]
required_for: [deploy_end]
requires: [hosts, firewall]

View File

@ -1,36 +0,0 @@
# Copyright 2014 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.
class vmware::cinder(
$vmware_host_ip = '1.2.3.4',
$vmware_host_username = 'administrator@vsphere.local',
$vmware_host_password = '',
$vmware_volume_folder = 'cinder-volumes',
$vmware_wsdl_location = '',
$vmware_api_retry_count = 10,
$vmware_host_version = '',
$vmware_image_transfer_timeout_secs = 7200,
$vmware_max_objects_retrieval = 100,
$vmware_task_poll_interval = 5,
$vmware_tmp_dir = '/tmp',
$storage_availability_zone = 'vcenter',
$default_availability_zone = 'vcenter',
$vmware_cluster = '',
$init_package = 'cinder-vmware-init',
$debug = false,
)
{
$vsphere_clusters = vmware_index($vmware_cluster)
create_resources(vmware::cinder::vmdk, $vsphere_clusters)
}

View File

@ -1,15 +1,41 @@
# This type creates cinder-volume service for provided vSphere cluster (cluster
# that is formed of ESXi hosts and is managed by vCenter server).
# Copyright 2015 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.
# This type creates cinder-volume service with VMDK backend, which provides
# block storage solution for vSphere's virtual machine instances.
define vmware::cinder::vmdk(
$index = '0',
$vc_host = '1.2.3.4',
$vc_user = 'administrator@vsphere.local',
$vc_password = '',
$availability_zone_name = 'non-nova',
$vc_volume_folder = 'cinder-volumes',
$vc_wsdl_location = '',
$vc_api_retry_count = 10,
$vc_host_version = '',
$vc_image_transfer_timeout_secs = 7200,
$vc_max_objects_retrieval = 100,
$vc_task_poll_interval = 5,
$vc_tmp_dir = '/tmp',
$cinder_conf_dir = '/etc/cinder/cinder.d',
$cinder_log_dir = '/var/log/cinder',
$debug = false,
)
{
include cinder::params
$index = $availability_zone_name
$cinder_volume_conf = "${cinder_conf_dir}/vmware-${index}.conf"
$cinder_volume_log = "${cinder_log_dir}/vmware-${index}.log"
$cinder_conf = $::cinder::params::cinder_conf

View File

@ -1,21 +1,21 @@
[DEFAULT]
host=<%= @index %>
storage_availability_zone=<%= scope.lookupvar('vmware::cinder::storage_availability_zone')%>
default_availability_zone=<%= scope.lookupvar('vmware::cinder::default_availability_zone')%>
storage_availability_zone=<%= @availability_zone_name %>-cinder
default_availability_zone=<%= @availability_zone_name %>-cinder
volume_driver=cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver
debug=<%= scope.lookupvar('vmware::cinder::debug')%>
vmware_host_ip=<%= scope.lookupvar('vmware::cinder::vmware_host_ip')%>
vmware_host_password=<%= scope.lookupvar('vmware::cinder::vmware_host_password')%>
vmware_host_username=<%= scope.lookupvar('vmware::cinder::vmware_host_username')%>
vmware_volume_folder=<%= scope.lookupvar('vmware::cinder::vmware_volume_folder')%>
<% if !scope.lookupvar('vmware::cinder::vmware_wsdl_location').empty? -%>
vmware_wsdl_location=<%= scope.lookupvar('vmware::cinder::vmware_wsdl_location')%>
<% end -%>
vmware_api_retry_count=<%= scope.lookupvar('vmware::cinder::vmware_api_retry_count')%>
<% if !scope.lookupvar('vmware::cinder::vmware_host_version').empty? -%>
vmware_host_version=<%= scope.lookupvar('vmware::cinder::vmware_host_version')%>
<% end -%>
vmware_image_transfer_timeout_secs=<%= scope.lookupvar('vmware::cinder::vmware_image_transfer_timeout_secs')%>
vmware_max_objects_retrieval=<%= scope.lookupvar('vmware::cinder::vmware_max_objects_retrieval')%>
vmware_task_poll_interval=<%= scope.lookupvar('vmware::cinder::vmware_task_poll_interval')%>
vmware_tmp_dir=<%= scope.lookupvar('vmware::cinder::vmware_tmp_dir')%>
debug=<%= @debug %>
vmware_host_ip=<%= @vc_host %>
vmware_host_username=<%= @vc_user %>
vmware_host_password=<%= @vc_password %>
vmware_volume_folder=<%= @vc_volume_folder %>
<% if !@vc_wsdl_location.empty? %>
vmware_wsdl_location=<%= @vc_wsdl_location %>
<% end %>
vmware_api_retry_count=<%= @vc_api_retry_count %>
<% if !@vc_host_version.empty? %>
vmware_host_version=<%= @vc_host_version %>
<% end %>
vmware_image_transfer_timeout_secs=<%= @vc_image_transfer_timeout_secs %>
vmware_max_objects_retrieval=<%= @vc_max_objects_retrieval %>
vmware_task_poll_interval=<%= @vc_task_poll_interval %>
vmware_tmp_dir=<%= @vc_tmp_dir %>