project-machine / disko

Disk Operations API in Go
Apache License 2.0
13 stars 9 forks source link

Use --force twice and add --yes in calls to pvremove. #129

Closed smoser closed 1 year ago

smoser commented 1 year ago

There was a case we hit where LVM was in a bad state and in order to remove a PV it wanted you to use --force twice and would still prompt. The LVM in use was from Ubuntu 22.04 (2.03.11).

I'm not able to easily add a test for this because the LVM state isn't easily created (it included broken state as seen below):

$ pvs
WARNING: PV /dev/sdf5 is marked in use but no VG was found using it.
WARNING: PV /dev/sdf5 might need repairing.
PV         VG        Fmt  Attr PSize   PFree
/dev/sdf5  [unknown] lvm2 u--  150.00g    0

$ lvm pvremove --force --force --verbose --debug /dev/sdf5
WARNING: PV /dev/sdf5 is used by VG <unknown>.
  Really WIPE LABELS from physical volume "/dev/sdf5" of
     volume group "<unknown>" [y/n]? yes
Accepted input: [y]
WARNING: Wiping physical volume label from /dev/sdf5 of
  volume group "<unknown>".
Labels on physical volume "/dev/sdf5" successfully wiped.
codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7c84241) 66.86% compared to head (28bca3b) 66.86%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #129 +/- ## ======================================= Coverage 66.86% 66.86% ======================================= Files 16 16 Lines 2161 2161 ======================================= Hits 1445 1445 Misses 520 520 Partials 196 196 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.