Skip to main content

NIM Update IOS Overview

NIM Update IOS Overview

NIM Update IOS refers to the process of using the Network Installation Management (NIM) to perform updates and customization on Virtual I/O Server (VIOS) targets. This module allows for updating a single VIOS or a pair of VIOSes together, ensuring that the VIOSes in a pair are on the same cluster and their node states are OK.

Update Process

The update process involves checking the status of previous operations, stopping the cluster before updating, performing the update, and then restarting the cluster. The module supports actions such as installing new filesets, committing uncommitted updates, cleaning up incomplete installations, and removing specified filesets.

Features

The module includes features like previewing the update operation without making changes, managing clusters during updates, and specifying a time limit for the update operation.

Usage Example

The nim_updateios module is used to perform updates on VIOS targets. For example, to preview an update on a pair of VIOSes, you can use the following playbook snippet: - name: Preview updateios onapair of VIOSes nim_updateios: targets: 'nimvios01, nimvios02' action: install lpp_source: 723lpp_res preview: true.


This code snippet shows how to use the nim_updateios module to preview an update on a pair of VIOSes, update VIOSes as a pair and a VIOS alone, and remove a fileset of a VIOS.

'''

EXAMPLES = r'''
- name: Preview updateios on a pair of VIOSes
nim_updateios:
targets: 'nimvios01, nimvios02'
action: install
lpp_source: 723lpp_res
preview: true
- name: Update VIOSes as a pair and a VIOS alone discarding cluster
nim_updateios:
targets:
- nimvios01,nimvios02
- nimvios03
action: install
lpp_source: 723lpp_res
time_limit: '07/21/2020 17:02'
manage_cluster: false
preview: false
- name: Remove a fileset of a VIOS
nim_updateios:

Main Functions

There are several main functions in this folder. Some of them are nim_exec, check_vios_targets, and nim_updateios. We will dive a little into nim_exec and nim_updateios.

nim_exec

The nim_exec function executes a specified command on a specified NIM client using c_rsh. It constructs the command, runs it, and returns the result code, stdout, and stderr.


The nim_exec function constructs the command, runs it, and returns the result code, stdout, and stderr.

def nim_exec(module, node, command):
"""
Execute the specified command on the specified nim client using c_rsh.

arguments:
module (dict): The Ansible module
node (dict): nim client to execute the command on to
command (list): command to execute
return:
rc (int) return code of the command
stdout (str) stdout of the command
stderr (str) stderr of the command
"""

cmd = ' '.join(command)
rcmd = f'( LC_ALL=C {cmd} ); echo rc=$?'
cmd = ['/usr/lpp/bos.sysmgt/nim/methods/c_rsh', node, rcmd]

rc, stdout, stderr = module.run_command(cmd)
if rc != 0:
return (rc, stdout, stderr)

check_vios_targets

The check_vios_targets function checks the list of VIOS targets to ensure each target can be reached. It validates the target names and ensures they are known by the NIM master.


The check_vios_targets function validates the target names and ensures they are known by the NIM master.

def check_vios_targets(module, targets):
"""
Check the list of VIOS targets.
Check that each target can be reached.

A target name can be of the following form:
vios1,vios2 or vios3

arguments:
module (dict): the Ansible module
targets (list): list of tuple of NIM name of vios machine
return:
res_list (list): The list of the existing vios tuple matching the target list
"""

vios_list = []
res_list = []

# Build targets list
for elems in targets:
module.debug(f'Checking elems: {elems}')

nim_updateios

The nim_updateios function executes the updateios command for each VIOS tuple. It retrieves the previous status, checks the cluster name and node status, stops the cluster if necessary, performs the update, waits for the copy to finish, and starts the cluster if necessary.


The nim_updateios function performs the updateios operation and manages the cluster during the update process.

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
"""

 

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