summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2016-07-06 13:51:21 +0100
committerSteven Hardy <shardy@redhat.com>2016-07-25 09:41:51 +0000
commit1f1489b635d7e7a2fe5621354bc72d0775d69a94 (patch)
treec518f13e62141f350690462193275383532b25a0
parent393db0231fa4b3b61b65c0ac6f031950e415d58d (diff)
Convert Swift ringbuilder to composable services format
This moves the ringbuilder puppet code to puppet-tripleo and migrates to the composable services format. Closes-Bug: #1601857 Change-Id: I0ea2230072d3ff61a4047ffff1f4187951370f67 Depends-On: I427f0b5ee93a0870d43419009178e0690ac66bd6
-rw-r--r--overcloud-resource-registry-puppet.yaml1
-rw-r--r--overcloud.yaml20
-rw-r--r--puppet/controller-config-pacemaker.yaml1
-rw-r--r--puppet/controller-config.yaml1
-rw-r--r--puppet/controller.yaml24
-rw-r--r--puppet/manifests/ringbuilder.pp99
-rw-r--r--puppet/services/swift-ringbuilder.yaml40
-rw-r--r--puppet/swift-devices-and-proxy-config.yaml2
-rw-r--r--puppet/swift-storage-post.yaml1
-rw-r--r--puppet/swift-storage.yaml24
10 files changed, 44 insertions, 169 deletions
diff --git a/overcloud-resource-registry-puppet.yaml b/overcloud-resource-registry-puppet.yaml
index 14250720..e5b4297a 100644
--- a/overcloud-resource-registry-puppet.yaml
+++ b/overcloud-resource-registry-puppet.yaml
@@ -179,6 +179,7 @@ resource_registry:
OS::TripleO::Services::Ntp: puppet/services/time/ntp.yaml
OS::TripleO::Services::SwiftProxy: puppet/services/swift-proxy.yaml
OS::TripleO::Services::SwiftStorage: puppet/services/swift-storage.yaml
+ OS::TripleO::Services::SwiftRingBuilder: puppet/services/swift-ringbuilder.yaml
OS::TripleO::Services::Snmp: puppet/services/snmp.yaml
OS::TripleO::Services::Timezone: puppet/services/time/timezone.yaml
OS::TripleO::Services::CeilometerApi: puppet/services/ceilometer-api.yaml
diff --git a/overcloud.yaml b/overcloud.yaml
index 4e00b971..0e33ec1d 100644
--- a/overcloud.yaml
+++ b/overcloud.yaml
@@ -255,18 +255,6 @@ parameters:
description: A random string to be used as a salt when hashing to determine mappings in the ring.
type: string
hidden: true
- SwiftMinPartHours:
- type: number
- default: 1
- description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
- SwiftPartPower:
- default: 10
- description: Partition Power to use when building Swift rings
- type: number
- SwiftReplicas:
- type: number
- default: 3
- description: How many replicas to use in the swift rings.
# Compute-specific params
ComputeCount:
@@ -401,6 +389,7 @@ parameters:
- OS::TripleO::Services::Ntp
- OS::TripleO::Services::SwiftProxy
- OS::TripleO::Services::SwiftStorage
+ - OS::TripleO::Services::SwiftRingBuilder
- OS::TripleO::Services::Snmp
- OS::TripleO::Services::Timezone
- OS::TripleO::Services::CeilometerApi
@@ -499,6 +488,7 @@ parameters:
- OS::TripleO::Services::Kernel
- OS::TripleO::Services::Ntp
- OS::TripleO::Services::SwiftStorage
+ - OS::TripleO::Services::SwiftRingBuilder
- OS::TripleO::Services::Snmp
- OS::TripleO::Services::Timezone
description: A list of service resources (configured in the Heat
@@ -715,9 +705,6 @@ resources:
RedisVirtualIP: {get_attr: [RedisVirtualIP, ip_address]}
RedisVirtualIPUri: {get_attr: [RedisVirtualIP, ip_address_uri]}
SwiftHashSuffix: {get_param: SwiftHashSuffix}
- SwiftMinPartHours: {get_param: SwiftMinPartHours}
- SwiftPartPower: {get_param: SwiftPartPower}
- SwiftReplicas: { get_param: SwiftReplicas}
ServiceNetMap: {get_param: ServiceNetMap}
EndpointMap: {get_attr: [EndpointMap, endpoint_map]}
MysqlVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, MysqlNetwork]}]}
@@ -845,10 +832,7 @@ resources:
KeyName: {get_param: KeyName}
Flavor: {get_param: OvercloudSwiftStorageFlavor}
HashSuffix: {get_param: SwiftHashSuffix}
- MinPartHours: {get_param: SwiftMinPartHours}
- PartPower: {get_param: SwiftPartPower}
Image: {get_param: SwiftStorageImage}
- Replicas: { get_param: SwiftReplicas}
UpdateIdentifier: {get_param: UpdateIdentifier}
ServiceNetMap: {get_param: ServiceNetMap}
Hostname:
diff --git a/puppet/controller-config-pacemaker.yaml b/puppet/controller-config-pacemaker.yaml
index dfebcf82..5116cac7 100644
--- a/puppet/controller-config-pacemaker.yaml
+++ b/puppet/controller-config-pacemaker.yaml
@@ -29,7 +29,6 @@ resources:
list_join:
- ''
- - get_file: manifests/overcloud_controller_pacemaker.pp
- - get_file: manifests/ringbuilder.pp
- {get_param: StepConfig}
outputs:
diff --git a/puppet/controller-config.yaml b/puppet/controller-config.yaml
index 458aff32..cadba703 100644
--- a/puppet/controller-config.yaml
+++ b/puppet/controller-config.yaml
@@ -29,7 +29,6 @@ resources:
list_join:
- ''
- - get_file: manifests/overcloud_controller.pp
- - get_file: manifests/ringbuilder.pp
- {get_param: StepConfig}
outputs:
diff --git a/puppet/controller.yaml b/puppet/controller.yaml
index ee4311d6..10bcb67a 100644
--- a/puppet/controller.yaml
+++ b/puppet/controller.yaml
@@ -250,22 +250,6 @@ parameters:
in the ring.
hidden: true
type: string
- SwiftMinPartHours:
- type: number
- default: 1
- description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
- SwiftPartPower:
- default: 10
- description: Partition Power to use when building Swift rings
- type: number
- SwiftRingBuild:
- default: true
- description: Whether to manage Swift rings or not
- type: boolean
- SwiftReplicas:
- type: number
- default: 3
- description: How many replicas to use in the swift rings.
UpgradeLevelNovaCompute:
type: string
description: Nova Compute upgrade level
@@ -600,10 +584,6 @@ resources:
control_virtual_interface: {get_param: ControlVirtualInterface}
public_virtual_interface: {get_param: PublicVirtualInterface}
swift_hash_suffix: {get_param: SwiftHashSuffix}
- swift_part_power: {get_param: SwiftPartPower}
- swift_ring_build: {get_param: SwiftRingBuild}
- swift_replicas: {get_param: SwiftReplicas}
- swift_min_part_hours: {get_param: SwiftMinPartHours}
enable_package_install: {get_param: EnablePackageInstall}
enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
swift_proxy_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftProxyNetwork]}]}
@@ -724,10 +704,6 @@ resources:
swift::proxy::proxy_local_net_ip: {get_input: swift_proxy_network}
swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
swift::swift_hash_path_suffix: {get_input: swift_hash_suffix}
- tripleo::ringbuilder::build_ring: { get_input: swift_ring_build }
- tripleo::ringbuilder::part_power: {get_input: swift_part_power}
- tripleo::ringbuilder::replicas: {get_input: swift_replicas}
- tripleo::ringbuilder::min_part_hours: {get_input: swift_min_part_hours}
# Cinder
tripleo::profile::base::cinder::volume::iscsi::cinder_iscsi_address: {get_input: cinder_iscsi_network}
diff --git a/puppet/manifests/ringbuilder.pp b/puppet/manifests/ringbuilder.pp
deleted file mode 100644
index 2411ff84..00000000
--- a/puppet/manifests/ringbuilder.pp
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright 2015 Red Hat, Inc.
-# All Rights Reserved.
-#
-# 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.
-
-define add_devices(
- $swift_zones = '1'
-){
-
- # NOTE(dprince): Swift zones is not yet properly wired into the Heat
- # templates. See: https://review.openstack.org/#/c/97758/3
- # For now our regex supports the r1z1-192.0.2.6:%PORT%/d1 syntax or the
- # newer r1z%<controller or SwiftStorage><N>%-192.0.2.6:%PORT%/d1 syntax.
- $server_num_or_device = regsubst($name,'^r1z%+[A-Za-z]*([0-9]+)%+-(.*)$','\1')
- if (is_integer($server_num_or_device)) {
- $server_num = $server_num_or_device
- } else {
- $server_num = '1'
- }
- # Function to place server in its zone. Zone is calculated by
- # server number in heat template modulo the number of zones + 1.
- $zone = (($server_num%$swift_zones) + 1)
-
- # add the rings
- $base = regsubst($name,'^r1.*-(.*)$','\1')
- $object = regsubst($base, '%PORT%', '6000')
- ring_object_device { $object:
- zone => '1',
- weight => 100,
- }
- $container = regsubst($base, '%PORT%', '6001')
- ring_container_device { $container:
- zone => '1',
- weight => 100,
- }
- $account = regsubst($base, '%PORT%', '6002')
- ring_account_device { $account:
- zone => '1',
- weight => 100,
- }
-}
-
-class tripleo::ringbuilder (
- $swift_zones = '1',
- $devices = '',
- $build_ring = true,
- $part_power,
- $replicas,
- $min_part_hours,
-) {
-
- validate_bool($build_ring)
-
- if $build_ring {
-
- $device_array = strip(split(rstrip($devices), ','))
-
- # create local rings
- swift::ringbuilder::create{ ['object', 'account', 'container']:
- part_power => $part_power,
- replicas => min(count($device_array), $replicas),
- min_part_hours => $min_part_hours,
- } ->
-
- # add all other devices
- add_devices {$device_array:
- swift_zones => $swift_zones,
- } ->
-
- # rebalance
- swift::ringbuilder::rebalance{ ['object', 'account', 'container']:
- seed => 999,
- }
-
- Ring_object_device<| |> ~> Exec['rebalance_object']
- Ring_object_device<| |> ~> Exec['rebalance_account']
- Ring_object_device<| |> ~> Exec['rebalance_container']
-
- }
-}
-
-if hiera('step') >= 2 {
- # pre-install swift here so we can build rings
- include ::swift
-}
-
-if hiera('step') >= 3 {
- include ::tripleo::ringbuilder
-}
diff --git a/puppet/services/swift-ringbuilder.yaml b/puppet/services/swift-ringbuilder.yaml
new file mode 100644
index 00000000..b341b0fc
--- /dev/null
+++ b/puppet/services/swift-ringbuilder.yaml
@@ -0,0 +1,40 @@
+heat_template_version: 2016-04-08
+
+description: >
+ OpenStack Swift Ringbuilder
+
+parameters:
+ EndpointMap:
+ default: {}
+ description: Mapping of service endpoint -> protocol. Typically set
+ via parameter_defaults in the resource registry.
+ type: json
+ SwiftMinPartHours:
+ type: number
+ default: 1
+ description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
+ SwiftPartPower:
+ default: 10
+ description: Partition Power to use when building Swift rings
+ type: number
+ SwiftRingBuild:
+ default: true
+ description: Whether to manage Swift rings or not
+ type: boolean
+ SwiftReplicas:
+ type: number
+ default: 3
+ description: How many replicas to use in the swift rings.
+
+outputs:
+ role_data:
+ description: Role data for Swift Ringbuilder configuration.
+ value:
+ service_name: swift-ringbuilder
+ config_settings:
+ tripleo::profile::base::swift::ringbuilder::build_ring: {get_param: SwiftRingBuild}
+ tripleo::profile::base::swift::ringbuilder::replicas: {get_param: SwiftReplicas}
+ swift::ringbuilder::part_power: {get_param: SwiftPartPower}
+ swift::ringbuilder::min_part_hours: {get_param: SwiftMinPartHours}
+ step_config: |
+ include ::tripleo::profile::base::swift::ringbuilder
diff --git a/puppet/swift-devices-and-proxy-config.yaml b/puppet/swift-devices-and-proxy-config.yaml
index 92ef5c1c..14df831f 100644
--- a/puppet/swift-devices-and-proxy-config.yaml
+++ b/puppet/swift-devices-and-proxy-config.yaml
@@ -20,7 +20,7 @@ resources:
datafiles:
swift_devices_and_proxy:
mapped_data:
- tripleo::ringbuilder::devices:
+ tripleo::profile::base::swift::ringbuilder::devices:
list_join:
- ", "
- - list_join:
diff --git a/puppet/swift-storage-post.yaml b/puppet/swift-storage-post.yaml
index 1c36a047..306a4d6e 100644
--- a/puppet/swift-storage-post.yaml
+++ b/puppet/swift-storage-post.yaml
@@ -44,7 +44,6 @@ resources:
list_join:
- ''
- - get_file: manifests/overcloud_object.pp
- - get_file: manifests/ringbuilder.pp
- {get_param: [RoleData, step_config]}
StorageRingbuilderDeployment_Step2:
diff --git a/puppet/swift-storage.yaml b/puppet/swift-storage.yaml
index 9d049bd3..fd5e26ae 100644
--- a/puppet/swift-storage.yaml
+++ b/puppet/swift-storage.yaml
@@ -18,22 +18,6 @@ parameters:
default: default
description: Name of an existing Nova key pair to enable SSH access to the instances
type: string
- MinPartHours:
- type: number
- default: 1
- description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
- PartPower:
- default: 10
- description: Partition Power to use when building Swift rings
- type: number
- RingBuild:
- default: true
- description: Whether to manage Swift rings or not
- type: boolean
- Replicas:
- type: number
- default: 3
- description: How many replicas to use in the swift rings.
SnmpdReadonlyUserName:
default: ro_snmp_user
description: The user name for SNMPd with readonly rights running on all Overcloud nodes
@@ -281,11 +265,7 @@ resources:
raw_data: {get_file: hieradata/object.yaml}
mapped_data: # data supplied directly to this deployment configuration, etc
swift::swift_hash_path_suffix: { get_input: swift_hash_suffix }
- tripleo::ringbuilder::build_ring: { get_input: swift_ring_build }
- tripleo::ringbuilder::part_power: { get_input: swift_part_power }
- tripleo::ringbuilder::replicas: {get_input: swift_replicas }
swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
- tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
tripleo::packages::enable_install: {get_input: enable_package_install}
@@ -304,10 +284,6 @@ resources:
snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
swift_hash_suffix: {get_param: HashSuffix}
- swift_min_part_hours: {get_param: MinPartHours}
- swift_ring_build: {get_param: RingBuild}
- swift_part_power: {get_param: PartPower}
- swift_replicas: { get_param: Replicas}
enable_package_install: {get_param: EnablePackageInstall}
enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}