IBM / ansible-power-aix

Developer contributions for Ansible Automation on Power
https://ibm.github.io/ansible-power-aix/
GNU General Public License v3.0
80 stars 92 forks source link

Failed to remove a varied off VG #432

Closed BladesOfSteele closed 1 month ago

BladesOfSteele commented 3 months ago

Describe the bug When trying to remove an existing, non-varied on altinst_rootvg, the process fails: FAILED! => {"changed": false, "cmd": "lsvg", "msg": "Volume group altinst_rootvg is deactivated. Unable to reduce volume group.", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "rootvg\naltinst_rootvg\n", "stdout_lines": ["rootvg", "altinst_rootvg"]}

To Reproduce Steps to reproduce the behavior: When running task that removes a non-varied on VG

Expected behavior Would expect the process to run a reducevg and a chpv -C hdisk#

Environment (please complete the following information):

Additional context This would be something I'd expect comes up, when people are using viosupgrade to upgrade VIO servers from v3 to v4, as in my case. It should allow for an easy clean up of any previous failed or aborted attempts before running. To that note, if all you do is run reducvevg on an existing altinst_rootvg, the upgrade fails, since the disk still looks used, hence the requirement for chpv -C hdisk#.

BladesOfSteele commented 3 months ago

If I do try to varyon the VG using state=varyon and then try to delete the VG with the delete_lvs=true, I get: 0516-304 getlvodm: Unable to find device id *****

without the delete_lvs, it fails with 0516-016 ldeletepv: Cannot delete physical volume with allocated partitions.

schamola commented 2 months ago

Hi @BladesOfSteele This is the expected behaviour of AIX. The volume group must be in activated stated (varied on) if you want to reduce it. Furthermore, If the VG is in activated state but reducevg is still not working (i.e. this error is coming - 0516-016 ldeletepv: Cannot delete physical volume with allocated partitions)... You need to set delete_lvs attribute to true.

Setting delete_lvs attribute to true will deallocate existing logical volume partitions and then delete the resultant empty logical volumes from the specified physical volumes.

BladesOfSteele commented 1 month ago

And therein lies the catch-22 situation. In this scenario, you cannot vary on the VG. That fails with: 0516-082 varyonvg: Unable to access a special device file. Execute redefinevg and synclvodm to build correct environment.

schamola commented 1 month ago

Hi @BladesOfSteele It seems that there is Inconsistency between the VGDA on disk and the ODM in your environment.

Have a look at this:

https://www.ibm.com/support/pages/0516-082-varyonvg-unable-access-special-device-file-execute-redefinevg-and-synclvodm-build-correct-environment

nitismis commented 1 month ago

This seems to be a limitation from AIX itself and not with the collection. Please follow the link above and provided workaround there. That will fix the issue.

BladesOfSteele commented 1 month ago

Running redefinevg -d did clear the issue. Worth considering running as part of the collection as part of the varyon?