#set hostname=$getVar('hostname',None) #set partition = $getVar('partition', None) #set partition_size = $getVar('partition_size', None) #set partition_maxsize = $getVar('partition_maxsize', None) #set disk_reserve_size = $getVar('disk_reserve_size', None) #set disk_max_size = $getVar('disk_max_size', None) #set default_disk_reserve_size = $getVar('default_disk_reserve_size', '0') #set default_disk_max_size = $getVar('default_disk_max_size', '0') #if $hostname == None #set $vgname = "VolGroup00" #else #set $vgname = $hostname.split('.')[0] #end if declare -A disk_mapping declare -A disk_path_mapping declare -A ignore_disk_mapping declare -A ignore_disk_path_mapping if [ -e /dev/disk/by-path ]; then set \$(ls -s -l /dev/disk/by-path | awk '{print \$10, \$12}') let disk_mapping_nums=\$#/2 let disk_mapping_offset=0 echo "disk_mapping_nums: \$disk_mapping_nums" > /tmp/log echo "disk_mapping: \$*" >> /tmp/log while [ \$disk_mapping_offset -lt \$disk_mapping_nums ]; do let found_disk_type=0 #if $getVar('disk_type_only','') != "" if expr match "\$1" ".*-${disk_type_only}-.*"; then let found_disk_type=1 fi #else let found_disk_type=1 #end if path_name=\$(basename \$1) disk_name=\$(basename \$2) let disk_mapping_offset=\$disk_mapping_offset+1 shift 2 if [ \$found_disk_type -gt 0 ]; then disk_mapping[\${disk_name}]="/dev/disk/by-path/\${path_name}" disk_mapping[\${path_name}]="/dev/disk/by-path/\${path_name}" disk_path_mapping[\${disk_name}]="/dev/\${disk_name}" disk_path_mapping[\${path_name}]="/dev/\${disk_name}" else ignore_disk_mapping[\${disk_name}]="/dev/disk/by-path/\${path_name}" ignore_disk_mapping[\${path_name}]="/dev/disk/by-path/\${path_name}" ignore_disk_path_mapping[\${disk_name}]="/dev/\${disk_name}" ignore_disk_path_mapping[\${path_name}]="/dev/\${disk_name}" fi done for key in \${!disk_mapping[@]}; do echo "disk mapping \$key => \${disk_mapping[\$key]}" >> /tmp/log done for key in \${!disk_path_mapping[@]}; do echo "disk path mapping \$key => \${disk_path_mapping[\$key]}" >> /tmp/log done else echo "/dev/disk/by-path does not exist" >> /tmp/log fi declare -A partition_disks declare -A disks set \$(list-harddrives) let disk_nums=\$#/2 let disk_offset=0 let found_disk_offset=0 while [ \$disk_offset -lt \$disk_nums ]; do disk=\$1 disk_name=\$(basename \$disk) let offset=\${disk_offset} let disk_offset=\${disk_offset}+1 shift 2 if [[ x"\${disk_mapping[\${disk_name}]}" == x"" ]]; then if [[ x"\${ignore_disk_mapping[\${disk_name}]}" != x"" ]]; then echo "ignore disk \${disk_name} since it is not in disk_mapping" >> /tmp/log continue else echo "did not found disk path for \$disk but it is not ignored" >> /tmp/log disk_mapping[\${disk_name}]="/dev/\${disk_name}" disk_path_mapping[\${disk_name}]="/dev/\${disk_name}" fi fi let found_disk=0 #if $getVar('partition_by_path', '0') != "0" disk=\${disk_mapping[\${disk_name}]} #end if disks[\$offset]=\$disk #if $getVar('partitions_only', '') != "" #for $partition_only in $partitions_only.split(',') #if not $partition_only #continue #end if if expr match "\${disk_name}" "$partition_only"; then let found_disk=1 else echo "disk \${disk_name} does not match $partition_only" >> /tmp/log fi #end for #else let found_disk=1 #end if if [ \${found_disk} -gt 0 ]; then echo "add disk \${disk_name} in partitioning list" >> /tmp/log partition_disks[\${found_disk_offset}]=\$disk let found_disk_offset=\${found_disk_offset}+1 fi done echo "partition disks \${partition_disks[@]}" >> /tmp/log echo "disks \${disks[@]}" >> /tmp/log #if $getVar('sort_disks', '0') != "0" sorted_disks=(\$(printf '%s\n' \${partition_disks[@]} | sort)) #else sorted_disks=(\${partition_disks[@]}) #end if echo "sorted disks \${sorted_disks[@]}" >> /tmp/log #if $getVar('start_from_disk', '') != "" #set $start_from_disk = $int($start_from_disk) #if $start_from_disk > 0 #set $disk_start_offset = $start_from_disk - 1 #else #set $disk_start_offset = 0 #end if set \${sorted_disks[@]} shift $disk_start_offset unset sorted_disks sorted_disks=(\$@) echo "sorted disks begin from the $start_from_disk: \${sorted_disks[@]}" >> /tmp/log #end if #if $getVar('disk_num', '') != "" set \${sorted_disks[@]} unset sorted_disks sorted_disks=(\$(printf '%s\n' \$@ | head -n${disk_num})) echo "sorted disks for $disk_num disks: \${sorted_disks[@]}" >> /tmp/log #end if first_disk="" for disk in \${sorted_disks}; do if [ -z "\${first_disk}" ]; then first_disk=\${disk} break fi done echo "first disk \${first_disk}" >> /tmp/log let disk_nums=\${#sorted_disks[@]} sorted_disks_str="" for disk in \${sorted_disks[@]}; do if [ -z "${sorted_disks_str}" ]; then sorted_disks_str="\${disk}" else sorted_disks_str="\${sorted_disks_str},\${disk}" fi done echo "clearpart --all --initlabel" > /tmp/part-include declare -A remove_disks let remove_disk_offset=0 #if $getVar('keep_old_partitions', '0') != "0" for disk in \${sorted_disks[@]}; do dd if=/dev/zero of=\${disk} bs=512 count=1 remove_disks[\${remove_disk_offset}]=\$disk let remove_disk_offset=\${remove_disk_offset}+1 done echo "only partition \$sorted_disks_str" >> /tmp/log echo "ignoredisk --only-use=\$sorted_disks_str" >> /tmp/part-include #else for disk in \${disks[@]}; do dd if=/dev/zero of=\${disk} bs=512 count=1 remove_disks[\${remove_disk_offset}]=\$disk let remove_disk_offset=\${remove_disk_offset}+1 done #end if echo "remove disks \${remove_disks[@]}" >> /tmp/log disk_partitions=\$(pvs --noheadings --separator :| cut -d: -f1) remove_partitions="" remove_vgs="" for disk_partition in \${disk_partitions}; do vg=\$(pvs --noheadings --separator : \${disk_partition} | cut -d: -f2) remove_vg="" remove_partition="" for remove_disk in \${remove_disks[@]}; do #if $getVar('partition_by_path', '0') != "0" path_name=\$(basename \${remove_disk}) remove_disk_path=\${remove_disk} remove_disk=\${disk_path_mapping[\${path_name}]} #else disk_name=\$(basename \${remove_disk}) remove_disk_path=\${disk_mapping[\${disk_name}]} #end if if [ -z "\${remove_disk}" ]; then continue fi if [ -z "\${remove_disk_path}" ]; then continue fi
# Copyright (c) 2017 Dell Inc. or its subsidiaries.
#
# 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.
heat_template_version: ocata
description: >
Openstack Cinder Dell EMC PS Series backend
parameters:
CinderEnableDellPsBackend:
type: boolean
default: true
CinderDellPsBackendName:
type: string
default: 'tripleo_dellps'
CinderDellPsSanIp:
type: string
CinderDellPsSanLogin:
type: string
CinderDellPsSanPassword:
type: string
hidden: true
CinderDellPsSanThinProvision:
type: boolean
default: true
CinderDellPsGroupname:
type: string
default: 'group-0'
Cinde