Devices Management Overview
Devices Overview
Devices refer to the hardware components managed within a logical partition (LPAR) on AIX systems. The module allows configuring, modifying, and unconfiguring devices, ensuring they are in the desired state. Devices can be set to different states such as 'available', 'defined', or 'removed', depending on the required operation.
Devices Management
The module supports operations on individual devices or all devices within the LPAR, providing flexibility in device management. It also includes options for forcing changes on locked devices and recursively unconfiguring devices along with their children.
Device States
Attributes of devices can be changed when they are in the 'available' state, and devices can be unconfigured or stopped when in the 'defined' state.
Example of Configuring a Device
This example shows how to configure a device named proc0
Example of configuring a device named proc0
- name: Configure a device
devices:
device: proc0
state: available
Example of Unconfiguring a Device
This example demonstrates how to unconfigure a device named proc0
Example of unconfiguring a device named proc0
- name: Unconfigure a device
devices:
device: proc0
state: defined
Example of Removing a Device
This example illustrates how to remove a device named fcs0
Example of removing a device named fcs0
- name: Remove (delete) fcs0 device and children
devices:
device: fcs0
state: removed
recursive: 'true'
Main Functions
There are several main functions in this folder. Some of them are chdev
cfgdev
rmdev
chdev
cfgdev
chdev
The chdev
get_device_attributes
check_idempotency
The chdev
def chdev(module, device):
"""
Changes the attributes of the device.
param module: Ansible module argument spec.
param device: Volume Group name.
return: changed - True/False(device state modified or not),
msg - message
"""
attributes = module.params["attributes"]
force = module.params["force"]
chtype = module.params["chtype"]
parent_device = module.params["parent_device"]
msg = ''
''' get initial properties of the device before
attempting to modfiy it. '''
init_props = get_device_attributes(module, device)
attributes, msg = check_idempotency(module, init_props, attributes, msg)
opts = ""
cfgdev
The cfgdev
get_device_state
The cfgdev
def cfgdev(module, device):
"""
Configure the device or discover all devices (device=all)
param module: Ansible module argument spec.
param device: device name.
return: changed - True/False(device state modified or not),
msg - message
"""
current_state = 'None'
cmd = "cfgmgr "
if device != 'all':
current_state = get_device_state(module, device)
if current_state is True:
msg = f"Device { device } is already in Available state."
return False, msg
if current_state is None:
msg = f"Device { device } does not exist."
module.fail_json(msg=msg)
cmd += f"-l { device } "
rmdev
The rmdev
get_device_state
The rmdev
def rmdev(module, device, state):
"""
Unconfigure/stop the device when state is 'defined'
Removes the device definition in Customized Devices object class when state is 'removed'
param module: Ansible module argument spec.
param device: device name.
param state: state of the device
return: changed - True/False(device state modified or not or device definition
is removed or not),
msg - message
"""
parent_device = module.params["parent_device"]
force = module.params["force"]
recursive = module.params["recursive"]
rmtype = module.params["rmtype"]
current_state = None
opts = ""
if device != 'all':
current_state = get_device_state(module, device)
if current_state is None:
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human