Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA-407507: Fix pvremove issue for multipathed devices #737

Conversation

stephenchengCloud
Copy link
Contributor

In the previous commit eb29245, we fixed an issue where the pvremove removed a device that didn't represent the PV because of multipath.
We fixed that issue by finding the real PV before removing the VG and PVs.

Now another issue occured for a similar reason: after removing the VG, LVM cache reassign the underlying device represents the PV, then we failed pvremove dev using the original device node.
The issue can be reproduced repeatly on XenServer 9. It might be caused by the update of lvm or multipath logic.

The solution is:
Before vgremove, save the uuid of the PVs attached to the VG. After vgremove, use the uuid to get the underlying device that represents the PV, then pvremove it.

For PV on multipathed devices, please refer to:
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/duplicate_pv_multipath#duplicate_pv_multipath

In the previous commit eb29245,
we fixed an issue where the pvremove removed a device that
didn't represent the PV because of multipath.
We fixed that issue by finding the real PV before removing the VG and PVs.

Now another issue occured for a similar reason: after removing the VG,
LVM cache reassign the underlying device represents the PV, then we failed
`pvremove dev` using the original device node.
The issue can be reproduced repeatly on XenServer 9.
It might be caused by the update of lvm or multipath logic.

The solution is:
Before vgremove, save the uuid of the PVs attached to the VG.
After vgremove, use the uuid to get the underlying device that
represents the PV, then pvremove it.

For PV on multipathed devices, please refer to:
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/duplicate_pv_multipath#duplicate_pv_multipath

Signed-off-by: Stephen Cheng <stephen.cheng@cloud.com>
@stephenchengCloud
Copy link
Contributor Author

  • Added unit test:
Test coverage
Name                              Stmts   Miss Branch BrPart  Cover   Missing
-----------------------------------------------------------------------------
...
tests/test_lvutil.py                268      0    115      0   100%
  • XenRT test passed
    4245923 StorageCertHBA

@MarkSymsCtx MarkSymsCtx merged commit a42ed38 into xapi-project:master Mar 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants