lvol – Configure AIX LVM logical volumes¶
Requirements¶
The below requirements are needed on the host that executes this module.
AIX >= 7.1 TL3
Python >= 2.7
Privileged user with authorizations: aix.lvm.manage.change,aix.lvm.manage.create,aix.lvm.manage.remove
Parameters¶
- state (True, str, None)
Specifies the action to be performed on the logical volume.
present
creates or modifies the logical volume if already exists with lv_attributes.
absent
removes a logial volume.- lv (True, str, None)
Specified the logical volume name.
- vg (optional, str, None)
Specifies the volume group name this logical volume is part of.
Required when state=present.
- lv_type (optional, str, jfs2)
Specifies the type of the logical volume to create.
The standard types are
jfs
for journaled file systems,jfslog
for journaled file system logs,jfs2
for enhanced journaled file system,jfs2log
for enhanced journaled file system logs,paging
for paging spaces.But you can define other logical volume types with this flag.
You cannot create a striped logical volume of type
boot
.Can be used to create a logical volume, hence when state=present.
- size (optional, str, None)
Specifies the size of the logical volume to create.
Can be used to create a logical volume, hence when state=present.
- extra_opts (optional, str, None)
Any other options to be passed by the user to mklv or chlv command
- copies (optional, int, 1)
Specifies number of copies of logical volume
Maximum value allowed is 3
Can be used to create a logical volume, hence when state=present.
- num_of_logical_partitions (optional, int, 1)
Specifies the number of logical partitions
Can be used to create a logical volume, hence when state=present.
- pv_list (optional, list, None)
List of pysical volumes.
Can be used to create a logical volume, hence when state=present.
- policy (optional, str, maximum)
Specifies the inter-physical volume allocation policy. It is the number of physical volumes to extend across, using the volumes that provide the best allocation.
maximum
allocates across the maximum number of physical volumes.
minimum
allocates logical partitions across the minimum number of physical volumes.Can be used to create or modify a logical volume, hence when state=present.
- lv_new_name (optional, str, None)
Specifies the name of the logical volume to change an existing logical volume.
Can be used to modify a logical volume, hence when state=present.
Notes¶
Note
Attention: using state=absent destroys all data in the specified logical volumes. If the logical volume spans multiple physical volumes, the removal of only logical partitions on the physical volume can jeopardize the integrity of the entire logical volume.
You can refer to the IBM documentation for additional information on the commands used at https://www.ibm.com/support/knowledgecenter/ssw_aix_72/c_commands/chlv.html, https://www.ibm.com/support/knowledgecenter/ssw_aix_72/m_commands/mklv.html, https://www.ibm.com/support/knowledgecenter/ssw_aix_72/r_commands/rmlv.html.
Examples¶
- name: Create a logical volume of 64M
ibm.power_aix.lvol:
vg: test1vg
lv: test1lv
size: 64M
- name: Create a logical volume of 32M with disks testdisk1 and testdisk2
ibm.power_aix.lvol:
vg: test2vg
lv: test2lv
size: 32M
pvs: [ testdisk1, testdisk2 ]
- name: Create a logical volume of 32M with a minimum placement policy
ibm.power_aix.lvol:
vg: rootvg
lv: test4lv
size: 32M
policy: minimum
- name: Create a logical volume with extra options like mirror pool
ibm.power_aix.lvol:
vg: testvg
lv: testlv
size: 128M
extra_opts: -p copy1=poolA -p copy2=poolB
- name: Remove the logical volume
ibm.power_aix.lvol:
vg: test1vg
lv: test1lv
state: absent
Return Values¶
- msg (always, str, Logical volume test1lv created.)
The execution message.
- cmd (always, str, )
The command executed.
- rc (When the command is executed., int, )
The command return code.
- stdout (always, str, )
The standard output of the command.
- stderr (always, str, )
The standard error of the command.