xapi-project / sm

Xapi Project storage managers
GNU Lesser General Public License v2.1
21 stars 91 forks source link

CA-393194: Fix pvremove failure #694

Closed stephenchengCloud closed 4 months ago

stephenchengCloud commented 4 months ago

In lvmohba test, the test failed at SR.destroy(sr_ref) -> removeVG -> pvremove with the lvm error message "No devices to process". The root cause is that the PV which was to be removed was not really used as PV when it comes to multipathed devices. The LVM official document says: "Since each LUN has multiple device nodes in /dev  that point to the same underlying data, they all contain the same LVM metadata and thus LVM commands will find the same metadata multiple times and report them as duplicates. These duplicate messages are only warnings and do not mean the LVM operation has failed. Rather, they are alerting the user that only one of the devices has been used as a physical volume and the others are being ignored."  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

This fix is to find the real PV in a VG before removing the VG.

Test passed: 4038532

MarkSymsCtx commented 4 months ago

@rdn32 we probably want to backport this to 8.2 as I suspect it will resolve your partner issue.

MarkSymsCtx commented 4 months ago

Whilst this change is in itself fine we will need to add unit tests for the code modified in order to be able to release it. Either in this PR or in a follow-up.

test_lvutil.py has separate classes for the various operations and currently does not have anything for VG/PV management

stephenchengCloud commented 4 months ago

Whilst this change is in itself fine we will need to add unit tests for the code modified in order to be able to release it. Either in this PR or in a follow-up.

test_lvutil.py has separate classes for the various operations and currently does not have anything for VG/PV management

Sure. I will add unit tests in this PR.

stephenchengCloud commented 4 months ago

Added unit tests. Passed: drivers/lvutil.py 511 260 134 9 47%