From e9f5ca13f3baeaa87ff369450e8f913355391e8c Mon Sep 17 00:00:00 2001 From: Gaurav Mehta Date: Thu, 23 Jan 2025 16:56:24 +1100 Subject: [PATCH] minor change to default kernel argument being passed when multipath is not needed. This allows dracut to still boot with nvme disks as it ignores multipath module packaged in dracut, while allowing multipathd to be enable subsequently add default multipath directives to ignore Longhorn disks --- pkg/config/cos.go | 34 ++++++++++++++++++++++++++++++++++ pkg/console/util.go | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/pkg/config/cos.go b/pkg/config/cos.go index 4b1a1b948..ec8a8f7ba 100644 --- a/pkg/config/cos.go +++ b/pkg/config/cos.go @@ -1,6 +1,7 @@ package config import ( + "encoding/base64" "errors" "fmt" "io/ioutil" @@ -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 { @@ -866,3 +870,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, + }) +} diff --git a/pkg/console/util.go b/pkg/console/util.go index 50171560d..bb63c6d1a 100644 --- a/pkg/console/util.go +++ b/pkg/console/util.go @@ -51,7 +51,7 @@ You can see the full installation log by: ElementalConfigDir = "/tmp/elemental" ElementalConfigFile = "config.yaml" - multipathOff = "multipath=off" + multipathOff = "rd.multipath=0" PartitionType = "part" MpathType = "mpath" CosDiskLabelPrefix = "COS_OEM"