Skip to main content

NIM VIOS Upgrade Overview

Overview

NIM VIOS Upgrade refers to the process of upgrading Virtual I/O Servers (VIOS) using the Network Installation Management (NIM) tool from a NIM master. The nim_viosupgrade module is used to perform this upgrade, which includes backing up virtual and logical configuration data, installing the specified image, and restoring the configuration data.

Supported Actions

The module supports different actions such as bosinst for a new installation on the current rootvg disk, altdisk for installation on an alternative disk, and get_status to check the status of an ongoing upgrade operation.

Requirements

The module requires AIX version 7.2 TL3 or later, Python 3.6 or later, and a privileged user with specific authorizations.

Module Updates

The nim_viosupgrade module has been updated to fix issues related to altdisk and bosinst operations, ensuring a smoother upgrade process.

Main Functions

There are several main functions in this module. Some of them are param_one_of, refresh_nim_node, viosupgrade_query, and viosupgrade. We will dive a little into param_one_of and viosupgrade.

param_one_of

The param_one_of function checks that at least one parameter from a given list is defined in the module's parameters dictionary. It ensures that either one or none of the parameters is defined based on the required and exclusive flags.


The param_one_of function ensures that at least one parameter from a given list is defined in the module's parameters dictionary.

def param_one_of(one_of_list, required=True, exclusive=True):
"""
Check that parameter of one_of_list is defined in module.params dictionary.

arguments:
one_of_list (list) list of parameter to check
required (bool) at least one parameter has to be defined.
exclusive (bool) only one parameter can be defined.
note:
Ansible might have this embedded in some version: require_if 4th parameter.
Exits with fail_json in case of error
"""

count = 0
for param in one_of_list:
if module.params[param] is not None and module.params[param]:
count += 1
break
action = module.params['action']
if count == 0 and required:
results['msg'] = f'Missing parameter: action is {action} but one of the following is missing: '

refresh_nim_node

The refresh_nim_node function retrieves NIM client information of a specified type and updates the nim_node dictionary with this information. It ensures that the NIM node information is current and accurate.


The refresh_nim_node function retrieves NIM client information of a specified type and updates the nim_node dictionary with this information.

def refresh_nim_node(module, type):
"""
Get nim client information of provided type and update nim_node dictionary.

arguments:
module (dict): The Ansible module
type (str): type of the nim object to get information
note:
Exits with fail_json in case of error
return:
none
"""

if module.params['nim_node']:
results['nim_node'] = module.params['nim_node']

nim_info = get_nim_type_info(module, type)

if type not in results['nim_node']:
results['nim_node'].update({type: nim_info})

viosupgrade_query

The viosupgrade_query function queries the status of the VIOS upgrade. It constructs and runs the appropriate command to get the status and updates the results dictionary with the command output and status information.


The viosupgrade_query function queries the status of the VIOS upgrade and updates the results dictionary with the command output and status information.

def viosupgrade_query(module, params_flags):
"""
Query to get the status of the upgrade .

arguments:
module (dict): The Ansible module
params_flags (dict): Supported parameter flags.
module.param used:
target_file (optional) filename with targets info
targets (required if not target_file)
viosupgrade_params (required)
note:
Set the upgrade status in results['status'][vios] or results['status']['all'].
return:
ret (int) the number of error
"""

ret = 0

# viosupgrade -q { [-n hostname | -f filename] }
cmd = ['/usr/sbin/viosupgrade', '-q']

viosupgrade

The viosupgrade function performs the actual upgrade of each VIOS. It constructs the command based on the provided parameters, runs the command, and updates the results dictionary with the command output and status information.


The viosupgrade function performs the actual upgrade of each VIOS and updates the results dictionary with the command output and status information.

def viosupgrade(module, params_flags):
"""
Upgrade each VIOS.

arguments:
module (dict): The Ansible module
params_flags (dict): Supported parameter flags.
module.param used:
action (required)
target_file (optional) filename with targets info
targets (required if not target_file)
viosupgrade_params (required)
note:
Set the upgrade status in results['status'][vios] or results['status']['all'].
return:
ret (int) the number of error
"""

ret = 0

cmd = ['/usr/sbin/viosupgrade']

 

This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human