fuel-library/deployment/puppet/vmware/manifests/compute/ha.pp
Igor Zinovik 0f6abf96c3 Add 'compute-vmware' granular deployment task
'compute-vmware' deployment task deploys nova-compute (VCDriver) on node
that got assigned 'compute-vmware' role:
- it installs nova-compute package
- prepares /etc/nova/nova-compute.conf file
- launches nova-compute service

It happens only if current node name (e.g. node-3) matches 'target_node'
attribute, it means that particuliar vSphere cluster was mapped to
current 'compute-vmware' node.

Change the way how nova-compute gets deployed on controller nodes
(vmware/manifests/compute/ha.pp): nova-compute deploys on controllers
only if 'target_node' attribute in contains 'controllers' value.

Diminish technical debt:
- remove references to 'common.libvirt_type.value'
- remove 'compute_driver' from manifests parameter list, it is inlined
  into configuration templates
- Remove useless vmware_index() invocation

Implements: blueprint compute-vmware-role
DocImpact: document new role in User Guide (VMware integration notes),
           update screenshots with VMware tab
Change-Id: I42ed40d86c5d43289fc210d426be523da545d268
2015-07-27 21:02:26 +03:00

99 lines
3.1 KiB
Puppet

# 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.
#
# This type creates nova-compute service for provided vSphere
# cluster (cluster that is formed of ESXi hosts and is managed by vCenter
# server).
define vmware::compute::ha(
$availability_zone_name,
$vc_cluster,
$vc_host,
$vc_user,
$vc_password,
$service_name,
$target_node,
$datastore_regex = undef,
$amqp_port = '5673',
$api_retry_count = 5,
$maximum_objects = 100,
$nova_conf = '/etc/nova/nova.conf',
$nova_conf_dir = '/etc/nova/nova-compute.d',
$task_poll_interval = 5.0,
$use_linked_clone = true,
$wsdl_location = undef
)
{
# We deploy nova-compute on controller node only if
# $target_node contains 'controllers' otherwise
# service will be deployed on separate node
if ($target_node == 'controllers') {
$nova_compute_conf = "${nova_conf_dir}/vmware-${availability_zone_name}_${service_name}.conf"
if ! defined(File[$nova_conf_dir]) {
file { $nova_conf_dir:
ensure => directory,
owner => nova,
group => nova,
mode => '0750'
}
}
if ! defined(File[$nova_compute_conf]) {
# $cluster is used inside template
$cluster = $name
file { $nova_compute_conf:
ensure => present,
content => template('vmware/nova-compute.conf.erb'),
mode => '0600',
owner => nova,
group => nova,
}
}
cs_resource { "p_nova_compute_vmware_${availability_zone_name}-${service_name}":
ensure => present,
primitive_class => 'ocf',
provided_by => 'fuel',
primitive_type => 'nova-compute',
metadata => {
resource-stickiness => '1'
},
parameters => {
amqp_server_port => $amqp_port,
config => $nova_conf,
pid => "/var/run/nova/nova-compute-${availability_zone_name}-${service_name}.pid",
additional_parameters => "--config-file=${nova_compute_conf}",
},
operations => {
monitor => { timeout => '10', interval => '20' },
start => { timeout => '30' },
stop => { timeout => '30' }
}
}
service { "p_nova_compute_vmware_${availability_zone_name}-${service_name}":
ensure => running,
enable => true,
provider => 'pacemaker',
}
File["${nova_conf_dir}"]->
File["${nova_compute_conf}"]->
Cs_resource["p_nova_compute_vmware_${availability_zone_name}-${service_name}"]->
Service["p_nova_compute_vmware_${availability_zone_name}-${service_name}"]
}
}