mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(host): shared lvm activte with auto activation option (#22189)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user