Handling the NIM updateios Operation
This document explains the process of performing a NIM updateios operation. The process involves initializing the Ansible module, validating input parameters, checking the target NIM clients, and executing the updateios command.
The flow starts with initializing the Ansible module and setting up the required parameters and results structure. It then validates the input parameters and checks the target NIM clients. If the target list is empty, it logs a warning and exits. Otherwise, it proceeds to perform the update operation by calling the nim_updateios
Flow drill down
Handling the NIM updateios operation
First, the main
nim_updateios
def main():
global module
global results
module = AnsibleModule(
argument_spec=dict(
action=dict(choices=['install', 'commit', 'cleanup', 'remove'], required=True, type='str'),
targets=dict(required=True, type='list', elements='str'),
filesets=dict(type='str'),
installp_bundle=dict(type='str'),
lpp_source=dict(type='str'),
accept_licenses=dict(type='bool', default=True),
manage_cluster=dict(type='bool', default=False),
preview=dict(type='bool', default=True),
time_limit=dict(type='str'),
vios_status=dict(type='dict'),
nim_node=dict(type='dict')
),
required_if=[
['action', 'install', ['lpp_source']],
],
Performing the updateios operation
Next, the nim_updateios
def nim_updateios(module, targets_list, vios_status, time_limit):
"""
Execute the updateios command
For each VIOS tuple,
- retrieve the previous status if any (looking for SUCCESS-HC and SUCCESS-UPDT)
- for each VIOS of the tuple, check the cluster name and node status
- stop the cluster if necessary
- perform the updateios operation
- wait for the copy to finish
- start the cluster if necessary
arguments:
module (dict): The Ansible module
targets_list (list): Target tuple list of VIOS
vios_status (dict): provided previous status for each tuple
time_limit (str): Date and time to perform tuple update
note:
Set the update status in results['status'][vios_key].
return:
none
"""
Checking the cluster status
Then, the check_vios_cluster_status
def check_vios_cluster_status(module, target_tuple):
"""
Check the cluster status of the VIOS tuple.
Update IOS can only be performed when both VIOSes in the tuple
refer to the same cluster and the node states is OK.
For a single VIOS, when the cluster status is inactive.
arguments:
module (dict): The Ansible module
target_tuple (list): The tuple of VIOS(es) to check
return:
True if the cluster status is valid for update.
False otherwise.
"""
vios_key = tuple_str(target_tuple)
tuple_len = len(target_tuple)
for vios in target_tuple:
results['nim_node']['vios'][vios]['cluster'] = {}
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human