Skip to content

Commit

Permalink
minor change to default kernel argument being passed when multipath i…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
ibrokethecloud committed Feb 12, 2025
1 parent e2cc599 commit e9f5ca1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
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 @@ -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,
})
}
2 changes: 1 addition & 1 deletion pkg/console/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e9f5ca1

Please sign in to comment.