fix(host): shared lvm activte with auto activation option (#22189)

This commit is contained in:
wanyaoqi
2025-02-27 16:05:05 +08:00
committed by GitHub
parent 48453911ca
commit 137d6a674c
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -280,11 +280,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)
+1 -1
View File
@@ -152,7 +152,7 @@ func (s *SSLVMStorage) DeleteSnapshot(ctx context.Context, params interface{}) (
}
func (s *SSLVMStorage) Accessible() error {
if err := lvmutils.VgActive(s.Path, true); err != nil {
if err := lvmutils.VgActive(s.Path, true, true); err != nil {
log.Warningf("vgactive got %s", err)
}