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

Automated cherry pick of #22189: fix(host): shared lvm activte with auto activation option #22193

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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