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

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

Merged

Conversation

smoser
Copy link
Collaborator

@smoser smoser commented Nov 14, 2023

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.

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

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

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Signed-off-by: Scott Moser <[email protected]>
@smoser smoser force-pushed the fix/pvremove-double-force-yes branch from 4cc87ec to 28bca3b Compare November 14, 2023 13:48
Copy link
Collaborator

@raharper raharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rchamarthy rchamarthy merged commit 02b41ac into project-machine:main Nov 14, 2023
4 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