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

change multipath default behaviour (backport #938) #978

Open
wants to merge 1 commit into
base: v1.5
Choose a base branch
from
Open
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
34 changes: 34 additions & 0 deletions pkg/config/cos.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"encoding/base64"
"errors"
"fmt"
"io/ioutil"
Expand Down Expand Up @@ -180,6 +181,9 @@ func ConvertToCOS(config *HarvesterConfig) (*yipSchema.YipConfig, error) {
return nil, err
}

// disable multipath for longhorn
disableLonghornMultipathing(&initramfs)

// TOP
if cfg.Mode != ModeInstall {
if err := initRancherdStage(config, &initramfs); err != nil {
Expand Down Expand Up @@ -892,3 +896,33 @@ func setupExternalStorage(config *HarvesterConfig, stage *yipSchema.Stage) error
})
return nil
}

// disableLonghornMultipathing tidy's up multipath configuration
// irrespective of if multipath is needed or not, multipath module is loaded in the kernel
// which can result in interfering with LH devices
// to avoid this we drop in a default stage in /etc/multipath/conf.d/99-longhorn.conf
// which contains a blacklist directive for Longhorn specific VENDOR/PRODUCT combination
func disableLonghornMultipathing(stage *yipSchema.Stage) {
ignoreLonghorn := []byte(`blacklist {
device {
vendor "IET"
product "VIRTUAL-DISK"
}
}`)
directives := base64.StdEncoding.EncodeToString(ignoreLonghorn)
stage.Directories = append(stage.Directories, yipSchema.Directory{
Path: "/etc/multipath/conf.d",
Permissions: 0644,
Owner: 0,
Group: 0,
})

stage.Files = append(stage.Files, yipSchema.File{
Path: "/etc/multipath/conf.d/99-longhorn.conf",
Content: directives,
Encoding: "base64",
Permissions: 0644,
Owner: 0,
Group: 0,
})
}
Loading