Skip to content

Commit

Permalink
fix(host): shared lvm activte with auto activation option (#22193)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyaoqi authored Feb 27, 2025
1 parent bc8e922 commit 969c443
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/hostman/storageman/lvmutils/lvmutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,14 @@ func VgDisplay(vgName string) error {
return nil
}

func VgActive(vgName string, active bool) error {
func VgActive(vgName string, active, autoActivation bool) error {
opts := "-ay"
if !active {
opts = "-an"
}
if active && autoActivation {
opts = "-aay"
}
out, err := procutils.NewRemoteCommandAsFarAsPossible("lvm", "vgchange", opts, vgName).Output()
if err != nil {
return errors.Wrapf(err, "vgchange %s %s failed %s", opts, vgName, out)
Expand Down
3 changes: 3 additions & 0 deletions pkg/hostman/storageman/storage_slvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func (s *SSLVMStorage) DeleteSnapshot(ctx context.Context, params interface{}) (
}

func (s *SSLVMStorage) Accessible() error {
if err := lvmutils.VgActive(s.Path, true, true); err != nil {
log.Warningf("vgactive got %s", err)
}
if err := lvmutils.VgDisplay(s.Path); err != nil {
return err
}
Expand Down

0 comments on commit 969c443

Please sign in to comment.