Skip to content

Commit

Permalink
v1.0.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI User committed Aug 22, 2023
1 parent a173ba8 commit a237a59
Show file tree
Hide file tree
Showing 101 changed files with 4,792 additions and 2,084 deletions.
178 changes: 94 additions & 84 deletions README.md

Large diffs are not rendered by default.

178 changes: 94 additions & 84 deletions cli/README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions cli/ansible/roles/hdbclusterhooks/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
group: sapsys
mode: 0755

- name: Pause for 15 minutes to allow all started processes to complete
ansible.builtin.pause:
minutes: 15

- name: Stop HANADB instance
shell: |
/usr/sap/{{ hana_sid | upper }}/HDB{{ hana_sysno }}/HDB stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@
path: /etc/hosts
regexp: "^(?!{{ ansible_default_ipv4.address }}.*{{ sap_short_hostname.stdout }})(.*)({{ sap_short_hostname.stdout }}.*)"
replace: '\1'

- name: Disable ipv6 localhost
replace:
path: /etc/hosts
regexp: '^\:\:1(\s)'
replace: '# ::1 \1'
...
15 changes: 0 additions & 15 deletions cli/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml

This file was deleted.

19 changes: 0 additions & 19 deletions cli/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml

This file was deleted.

28 changes: 0 additions & 28 deletions cli/ansible/roles/s4appreq/vars/RedHat7.yml

This file was deleted.

4 changes: 4 additions & 0 deletions cli/ansible/roles/s4pasinst/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Pause for 10 minutes to make sure HANA is up
ansible.builtin.pause:
minutes: 10

- name: Generate parameter file for sapinst
template:
src: pasconfig.cfg
Expand Down
64 changes: 64 additions & 0 deletions cli/ansible/roles/saphanareq/filter_plugins/filesystemdata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/python

class FilterModule(object):
'''Data related to filesystems for HANA VM'''

def filters(self):
return {
'filesystemdata': self.filesystemdata
}

def filesystemdata(self, data_list):
final_list = []
data_map = data_list[0]
sid = data_list[1]
for k, v in data_map.items():
key_to_check = 'lvm'
if key_to_check in v:
for m in v['lvm']['lv']:
temp_list = []
fs_device = "/dev/" + sid + "_" + v['lvm']['vg']['vg_name'] + "/" + sid + "_" + m['lv_name']
mp = None
fs_options = ""
label = ""
mount_source = fs_device
if m['lv_name'] == 'hana_data_lv':
label = "HANA_DATA"
elif m['lv_name'] == 'hana_log_lv':
label = "HANA_LOG"
elif m['lv_name'] == 'hana_shared_lv':
label = "HANA_SHARED"
else:
label = ""
if label != "":
fs_options = "-L " + label
mount_source = "LABEL=" + label
if "mount_point" in m.keys():
mp = m['mount_point']
fs_info = { "fs_device": fs_device, "fs_type": m['fs_type'], "mp": mp, "fs_options": fs_options, "mount_source": mount_source }
temp_list.append(fs_info)
final_list.append(temp_list)
else:
temp_list = []
fs_device = v['device'][0] + "1"
fs_options = ""
label = ""
mount_source = fs_device
mp = None
if "mount_point" in v.keys():
mp = v['mount_point']
if mp == "/hana/data":
label = "HANA_DATA"
elif mp == "/hana/log":
label = "HANA_LOG"
elif mp == "/hana/shared":
label = "HANA_SHARED"
else:
label = ""
if label != "":
fs_options = "-L " + label
mount_source = "LABEL=" + label
fs_info = { "fs_device": fs_device, "fs_type": v['fs_type'], "mp": mp, "fs_options": fs_options, "mount_source": mount_source }
temp_list.append(fs_info)
final_list.append(temp_list)
return final_list
45 changes: 45 additions & 0 deletions cli/ansible/roles/saphanareq/filter_plugins/lvmdata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/python

class FilterModule(object):
'''Data related to LVM for HANA VM'''

def filters(self):
return {
'lvmdata': self.lvmdata
}

def lvmdata(self, data_map):
final_list = []
for k, v in data_map.items():
key_to_check = 'lvm'
if key_to_check in v:
# In case the sum of the sizes of all LVs from the VG is lower than VG size
# and we don't want 'hana_data_lv' to be created as '100%FREE'
lv100free = True
total_lv_size = 0
vgsize = 0
for t in v['disk_size']:
vgsize += int(t)
lvminfo = v['lvm']['lv']
for n in lvminfo:
total_lv_size += int(n['lv_size'])
if vgsize > total_lv_size:
lv100free = False
for m in v['lvm']['lv']:
temp_list = []
lv_size = ""
# For HANA VMs, SWAP size is always 2 GB
# The volume group 'hana_vg' will always contain logical volume 'hana_data_lv'
if k == 'swap' or (k == 'hana_vg' and m['lv_name'] != 'hana_data_lv') or (lv100free == False and k == 'hana_vg' and m['lv_name'] == 'hana_data_lv'):
lv_size = m['lv_size'] + "G"
else:
lv_size = '100%FREE'
lvm_info = { "vg_name": v['lvm']['vg']['vg_name'], "lv_name": m['lv_name'], "lv_size": lv_size, "lv_stripes": m['lv_stripes'], "lv_stripe_size": m['lv_stripe_size'] }
temp_list.append(lvm_info)
final_list.append(temp_list)
for i in range(len(final_list)):
# LVM data 'hana_data_lv' should be last in array (in case it will be created in 'hana_vg') as we want 100%FREE as size
if final_list[i][0]['vg_name'] == 'hana_vg' and final_list[i][0]['lv_name'] == 'hana_data_lv':
final_list.append(final_list.pop(i))
break
return final_list
17 changes: 17 additions & 0 deletions cli/ansible/roles/saphanareq/filter_plugins/partitionlist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/python

class FilterModule(object):
'''List of devices for partitions on HANA VM'''

def filters(self):
return {
'partitionlist': self.partitionlist
}

def partitionlist(self, data_map):
final_list = []
for k, v in data_map.items():
key_to_check = 'lvm'
if key_to_check not in v:
final_list.append(v['device'])
return final_list
100 changes: 100 additions & 0 deletions cli/ansible/roles/saphanareq/filter_plugins/storagedetails.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/usr/bin/python

import decimal
import re

class FilterModule(object):
'''Storage details from profile containing also the devices for HANA VM'''

def filters(self):
return {
'storagedetails': self.storagedetails
}

def storagedetails(self, data_list):
# data_list[0] - json file data
# data_list[1] - ansible_devices data
# data_list[2] - selected storage profile
json_file_data = data_list[0]
ansible_devices_data = data_list[1]
hana_profile = data_list[2]

storage_profile_info = json_file_data['profiles'][hana_profile]['storage']

# Create a sorted list with all disks device keys available on the VM
pattern = 'dm-'
all_disk_device_keys = sorted([item for item in ansible_devices_data if re.match(pattern, item) == None])

# Get the number of the disks to be configured
necessary_disks_number = ""
count_disks = 0
for k, v in storage_profile_info.items():
count_disks += int(v['disk_count'])
necessary_disks_number = str(count_disks)

# Get a list with the device keys for disks to be configured
N = int(necessary_disks_number)
disk_device_keys = all_disk_device_keys[-N:]

# Get a list with the provisioned disk sizes corresponding to the device keys for disks to be configured
size_provisioned_disks = []
for m, n in ansible_devices_data.items():
if m in disk_device_keys and 'KB' not in n['size']:
size_provisioned_disks.append(n['size'])

# Sort the list with provisioned disk sizes
size_provisioned_disks_sorted = sorted(size_provisioned_disks)

# Get a list of disk sizes corresponding to the selected profile
size_profile_disks = []
for k, v in storage_profile_info.items():
display_size = ""
if int(v['disk_size']) >= 1024:
rounded_val = round(decimal.Decimal(int(v['disk_size']) / 1024), 2)
no_decimal_places = abs(rounded_val.as_tuple().exponent)
if no_decimal_places == 0:
display_size = str(rounded_val) + ".00 TB"
elif no_decimal_places == 1:
display_size = str(rounded_val) + "0 TB"
elif no_decimal_places == 2:
display_size = str(rounded_val) + " TB"
else:
display_size = v['disk_size'] + ".00 GB"
for t in range(int(v['disk_count'])):
size_profile_disks.append(display_size)

# Sort the list with disk sizes from profile
size_profile_disks_sorted = sorted(size_profile_disks)

# Get the missing disks
if (len(list(set(size_profile_disks_sorted) - set(size_provisioned_disks_sorted))) > 0) or (len(size_profile_disks_sorted) != len(size_provisioned_disks_sorted)):
msg = "The disks required for profile '" + hana_profile + "' are missing. The following disks sizes are required: " + str(size_profile_disks_sorted)[1:-1] + ". The following disk sizes were deployed: " + str(size_provisioned_disks_sorted)[1:-1]
return msg
else:
temp_list = []
for k, v in storage_profile_info.items():
new_list1 = []
new_list2 = []
display_size = ""
if int(v['disk_size']) >= 1024:
rounded_val = round(decimal.Decimal(int(v['disk_size']) / 1024), 2)
no_decimal_places = abs(rounded_val.as_tuple().exponent)
if no_decimal_places == 0:
display_size = str(rounded_val) + ".00 TB"
elif no_decimal_places == 1:
display_size = str(rounded_val) + "0 TB"
elif no_decimal_places == 2:
display_size = str(rounded_val) + " TB"
else:
display_size = v['disk_size'] + ".00 GB"
for t in range(int(v['disk_count'])):
new_list1.append(v['disk_size'])
for m, n in ansible_devices_data.items():
if (n['size'] == display_size) and (m in disk_device_keys) and (m not in temp_list):
new_list2.append("/dev/" + m)
temp_list.append(m)
break
storage_profile_info[k]['disk_size'] = new_list1
storage_profile_info[k]['device'] = new_list2
final_storage = storage_profile_info
return final_storage
Loading

0 comments on commit a237a59

Please sign in to comment.