Merge "Add a boolean to allow disk overrides through NodeDataLookup"

This commit is contained in:
Zuul 2021-04-27 16:50:11 +00:00 committed by Gerrit Code Review
commit b2b29b8013
3 changed files with 50 additions and 20 deletions

View File

@ -54,6 +54,10 @@ parameters:
default: true default: true
description: 'Use a local directory for Swift storage services when building rings' description: 'Use a local directory for Swift storage services when building rings'
type: boolean type: boolean
SwiftUseNodeDataLookup:
default: false
description: Use NodeDataLookup for disk devices in order to use persistent naming
type: boolean
SwiftRingGetTempurl: SwiftRingGetTempurl:
default: '' default: ''
description: A temporary Swift URL to download rings from. description: A temporary Swift URL to download rings from.
@ -85,24 +89,27 @@ outputs:
value: value:
service_name: swift_ringbuilder service_name: swift_ringbuilder
config_settings: config_settings:
tripleo::profile::base::swift::ringbuilder::skip_consistency_check: true map_merge:
tripleo::profile::base::swift::ringbuilder::swift_ring_get_tempurl: {get_param: SwiftRingGetTempurl} - tripleo::profile::base::swift::ringbuilder::skip_consistency_check: true
tripleo::profile::base::swift::ringbuilder::swift_ring_put_tempurl: {get_param: SwiftRingPutTempurl} tripleo::profile::base::swift::ringbuilder::swift_ring_get_tempurl: {get_param: SwiftRingGetTempurl}
tripleo::profile::base::swift::ringbuilder::build_ring: {get_param: SwiftRingBuild} tripleo::profile::base::swift::ringbuilder::swift_ring_put_tempurl: {get_param: SwiftRingPutTempurl}
tripleo::profile::base::swift::ringbuilder::replicas: {get_param: SwiftReplicas} tripleo::profile::base::swift::ringbuilder::build_ring: {get_param: SwiftRingBuild}
tripleo::profile::base::swift::ringbuilder::part_power: {get_param: SwiftPartPower} tripleo::profile::base::swift::ringbuilder::replicas: {get_param: SwiftReplicas}
tripleo::profile::base::swift::ringbuilder::min_part_hours: {get_param: SwiftMinPartHours} tripleo::profile::base::swift::ringbuilder::part_power: {get_param: SwiftPartPower}
tripleo::profile::base::swift::ringbuilder::raw_disk_prefix: 'r1z1-' tripleo::profile::base::swift::ringbuilder::min_part_hours: {get_param: SwiftMinPartHours}
tripleo::profile::base::swift::ringbuilder::raw_disks: tripleo::profile::base::swift::ringbuilder::raw_disk_prefix: 'r1z1-'
yaql: - if:
expression: $.data.raw_disk_lists.flatten() - {get_param: SwiftUseNodeDataLookup}
data: - {}
raw_disk_lists: - tripleo::profile::base::swift::ringbuilder::raw_disks:
- {if: [swift_use_local_dir, [':%PORT%/d1'], []]} list_concat:
- repeat: - if:
template: ':%PORT%/DEVICE' - swift_use_local_dir
for_each: - - ':%PORT%/d1'
DEVICE: {get_param: SwiftRawDisks} - repeat:
template: ':%PORT%/DEVICE'
for_each:
DEVICE: {get_param: SwiftRawDisks}
service_config_settings: {} service_config_settings: {}
# BEGIN DOCKER SETTINGS # BEGIN DOCKER SETTINGS
puppet_config: puppet_config:

View File

@ -62,6 +62,10 @@ parameters:
default: false default: false
description: Value of mount_check in Swift account/container/object -server.conf description: Value of mount_check in Swift account/container/object -server.conf
type: boolean type: boolean
SwiftUseNodeDataLookup:
default: false
description: Use NodeDataLookup for disk devices in order to use persistent naming
type: boolean
SwiftAccountWorkers: SwiftAccountWorkers:
default: 0 default: 0
description: Number of workers for Swift account service. description: Number of workers for Swift account service.
@ -118,6 +122,7 @@ conditions:
account_workers_zero: {equals : [{get_param: SwiftAccountWorkers}, '0']} account_workers_zero: {equals : [{get_param: SwiftAccountWorkers}, '0']}
container_workers_zero: {equals : [{get_param: SwiftContainerWorkers}, '0']} container_workers_zero: {equals : [{get_param: SwiftContainerWorkers}, '0']}
object_workers_zero: {equals : [{get_param: SwiftObjectWorkers}, '0']} object_workers_zero: {equals : [{get_param: SwiftObjectWorkers}, '0']}
use_node_data_lookup: {equals : [{get_param: SwiftUseNodeDataLookup}, true]}
resources: resources:
@ -169,8 +174,12 @@ outputs:
- healthcheck - healthcheck
- recon - recon
- account-server - account-server
swift::storage::disks::args: {get_param: SwiftRawDisks} -
swift::storage::all::storage_local_net_ip: if:
- use_node_data_lookup
- {}
- swift::storage::disks::args: {get_param: SwiftRawDisks}
- swift::storage::all::storage_local_net_ip:
str_replace: str_replace:
template: template:
"%{hiera('$NETWORK')}" "%{hiera('$NETWORK')}"
@ -619,6 +628,9 @@ outputs:
- name: Set swift_use_local_disks fact - name: Set swift_use_local_disks fact
set_fact: set_fact:
swift_use_local_disks: {get_param: SwiftUseLocalDir} swift_use_local_disks: {get_param: SwiftUseLocalDir}
- name: Set use_node_data_lookup fact
set_fact:
use_node_data_lookup: {get_param: SwiftUseNodeDataLookup}
- name: Create Swift d1 directory if needed - name: Create Swift d1 directory if needed
file: file:
path: "/srv/node/d1" path: "/srv/node/d1"
@ -627,6 +639,15 @@ outputs:
- name: Set fact for SwiftRawDisks - name: Set fact for SwiftRawDisks
set_fact: set_fact:
swift_raw_disks: {get_param: SwiftRawDisks} swift_raw_disks: {get_param: SwiftRawDisks}
when: not use_node_data_lookup|bool
- name: Get hiera swift::storage::disks::args
shell: hiera -c /etc/puppet/hiera.yaml swift::storage::disks::args | sed =e 's/=>/:/g'
register: hiera_output
when: use_node_data_lookup|bool
- name: Set fact for swift_raw_disks
set_fact:
swift_raw_disks: "{{ hiera_output.stdout | from_json }}"
when: use_node_data_lookup|bool
- name: Format SwiftRawDisks - name: Format SwiftRawDisks
filesystem: filesystem:
fstype: xfs fstype: xfs

View File

@ -55,6 +55,7 @@ resources:
cnt = ast.literal_eval(input) cnt = ast.literal_eval(input)
print(json.dumps(cnt.get('${node_id}', {}))) print(json.dumps(cnt.get('${node_id}', {})))
" > /etc/puppet/hieradata/${node_id}.json " > /etc/puppet/hieradata/${node_id}.json
echo "- ${node_id}" >> /etc/puppet/hiera.yaml
# handle upper case node id LP#1816652 # handle upper case node id LP#1816652
echo $node_lookup | $(get_python) -c " echo $node_lookup | $(get_python) -c "
import ast import ast
@ -67,6 +68,7 @@ resources:
cnt = ast.literal_eval(input) cnt = ast.literal_eval(input)
print(json.dumps(cnt.get('${node_id_upper}', {}))) print(json.dumps(cnt.get('${node_id_upper}', {})))
" > /etc/puppet/hieradata/${node_id_upper}.json " > /etc/puppet/hieradata/${node_id_upper}.json
echo "- ${node_id_upper}" >> /etc/puppet/hiera.yaml
NodeSpecificDeployment: NodeSpecificDeployment:
type: OS::Heat::SoftwareDeployment type: OS::Heat::SoftwareDeployment