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 default setup for multipathd #988

Merged

Conversation

ibrokethecloud
Copy link
Contributor

change default kernel argument to disable multipath and overwrite multipathd system unit definition to allow multipathd to still be run after boot

Problem:

PR #938 changed kernel arguments to disable multipathd during boot. The original idea was to allow end users to still enable multipathd post boot for 3rd party CSI.

However the change seems to have broken boot in kvm when using ide, scsi and sata buses. The same issue has also been noticed on HP DL360's when using a raid controller.

Solution:

  • revert default argument to disable multipathd back to multipath=off
  • override multipathd.service file via /etc/systemd/system, where we drop the condition check for multipath=off

Related Issue:
harvester/harvester#7622

Test plan:

  • Install harvester using this build to a KVM setup using sata, scsi or ide bus
  • post install machine should boot successfully
  • ssh to host and run systemctl enable multipathd && systemctl start multipathd
  • multipath should start successfully, and can be checked using systemctl status multipathd

On a fresh v1.4.1 install user will not be able to enable and start multipath

…tipathd system unit definition to allow multipathd to still be run after boot
@w13915984028
Copy link
Member

I did not test the systemd service related part yet, put some questions for discussion:

(1) If user adds systemctl enable multipathd && systemctl start multipathd to configuration file to automate the system installation, will it work?
https://docs.harvesterhci.io/v1.4/install/harvester-configuration#osafter_install_chroot_commands

(2) Should harvester/harvester#7476 be reverted as well?

(3) After user enable multipathd service, will it affect v150->v160 upgrade?

(4) The default multipathd configuration file, we did not add, and system will use the internal defaults

defaults {
  find_multipaths "greedy"
}

blacklist {
  devnode "!^(sd[a-z]|dasd[a-z]|nvme[0-9])"

...

Seems we may add a multipath.conf to harvester os, change above 2 to:

defaults {
  find_multipaths "strict"
}

blacklist {
  devnode "!^(sd[a-z]|dasd[a-z]|vd[a-z]|nvme[0-9])"  // vd* is for kvm
}
...

@ibrokethecloud
Copy link
Contributor Author

upgrade path PR: harvester/harvester#7678

@ibrokethecloud
Copy link
Contributor Author

I did not test the systemd service related part yet, put some questions for discussion:

(1) If user adds systemctl enable multipathd && systemctl start multipathd to configuration file to automate the system installation, will it work? https://docs.harvesterhci.io/v1.4/install/harvester-configuration#osafter_install_chroot_commands

this is not needed as the installer already sets up the instructions https://github.com/harvester/harvester-installer/blob/master/pkg/config/cos.go#L883 and these persist across upgrades.

(2) Should harvester/harvester#7476 be reverted as well?

Already changed to reflect what the install path does: harvester/harvester#7678

(3) After user enable multipathd service, will it affect v150->v160 upgrade?

Should not affect the upgrade since the patch will already be done via the install instructions or upgrade path instructions being added via /oem/99_disable_lh_multipathd.yaml

(4) The default multipathd configuration file, we did not add, and system will use the internal defaults

defaults {
  find_multipaths "greedy"
}

blacklist {
  devnode "!^(sd[a-z]|dasd[a-z]|nvme[0-9])"

...

Seems we may add a multipath.conf to harvester os, change above 2 to:

defaults {
  find_multipaths "strict"
}

blacklist {
  devnode "!^(sd[a-z]|dasd[a-z]|vd[a-z]|nvme[0-9])"  // vd* is for kvm
}

This is not really needed. we just need to ensure dracut and kernel do not load the module during boot. I am concerned about blacklisting by device names as when performing external iscsi based installs, the external iscsi disks appear as sda,sdb...

Copy link
Contributor

@tserong tserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, this feels like a bit of a weird hack, but I don't have any better ideas...

// this is needed to allow users to still manually start multipath post boot for
// 3rd party csi integration
multipathdUnitPatch := []byte(`[Unit]
Description=Device-Mapper Multipath Device Controller
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibrokethecloud Following is the systemd service on my local pc, it looks with slight differences, did you notice such?

...5.15.0-131-generic #141~20.04.1-Ubuntu SMP Thu Jan 16 18:38:51 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

[Unit]
Description=Device-Mapper Multipath Device Controller
Wants=systemd-udev-trigger.service systemd-udev-settle.service
Before=iscsi.service iscsid.service lvm2-activation-early.service
Before=local-fs-pre.target blk-availability.service
After=multipathd.socket systemd-udev-trigger.service systemd-udev-settle.service
DefaultDependencies=no
Conflicts=shutdown.target
ConditionKernelCommandLine=!nompath
ConditionKernelCommandLine=!multipath=off
ConditionVirtualization=!container

[Service]
Type=notify
NotifyAccess=main
LimitCORE=infinity
ExecStartPre=-/sbin/modprobe -a scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath
ExecStart=/sbin/multipathd -d -s
ExecReload=/sbin/multipathd reconfigure
TasksMax=infinity

[Install]
WantedBy=sysinit.target
Also=multipathd.socket
Alias=multipath-tools.service

Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@ibrokethecloud ibrokethecloud merged commit bf37545 into harvester:master Feb 25, 2025
7 checks passed
@ibrokethecloud
Copy link
Contributor Author

@Mergifyio backport v1.5

Copy link

mergify bot commented Feb 25, 2025

backport v1.5

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants