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

External disk support #778

Merged

Conversation

ibrokethecloud
Copy link
Contributor

Problem:

Currently harvester can only be installed on local disks due to lack of multipath support and ability to configure additional kernel arguments as part of the installation process

Solution:

The PR attempts to address this by allowing user to perform the following via harvester config

  • enable multipathd
  • configure multipathd to support specific devices
  • enable boot from multipath device

Related Issue:
harvester/harvester#5150
Test plan:

To test the following config.yaml, will enable and configure multipath even for a single local disk in a kvm environment

os:
  externalStorageConfig:
    enabled: true
    multiPathConfig:
    - vendor: "ATA"
      product: "QEMU HARDDISK"
  additionalKernelArguments: "rd.iscsi.firmware rd.iscsi.ibft"

post install, when the VM boots, the disks used will be corresponding multipathd mapper devices

Filesystem                              1K-blocks     Used Available Use% Mounted on
devtmpfs                                     4096        0      4096   0% /dev
tmpfs                                    10236112        4  10236108   1% /dev/shm
tmpfs                                     4094448     9200   4085248   1% /run
tmpfs                                        4096        0      4096   0% /sys/fs/cgroup
/dev/mapper/QEMU_HARDDISK_QM00003-part4  15375304  4866216   9706272  34% /run/initramfs/cos-state
/dev/loop0                                3091752  1609416   1325052  55% /
tmpfs                                     5118060    13208   5104852   1% /run/overlay
overlay                                   5118060    13208   5104852   1% /boot
overlay                                   5118060    13208   5104852   1% /etc
/dev/mapper/QEMU_HARDDISK_QM00003-part2     42851      285     38982   1% /oem
overlay                                   5118060    13208   5104852   1% /srv
/dev/mapper/QEMU_HARDDISK_QM00003-part5 153707984 29135744 116691536  20% /usr/local
overlay                                   5118060    13208   5104852   1% /var
tmpfs                                    10236116        0  10236116   0% /tmp
/dev/mapper/QEMU_HARDDISK_QM00003-part6  78841476       32  74790756   1% /var/lib/harvester/defaultdisk

without the additional config, there should be no impact to how harvester behaves post install

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.

LGTM in general, just a couple of comments on comments ;-) and one question about the blacklist.

(Also I do wonder if we shouldn't just enable multipathd in the installer... But in that case we'd probably still need to add logic to hide multipath children so they couldn't be selected by mistake :-/ ... What you've got here is probably more straightforward and/or less risky).

package/harvester-os/files/usr/sbin/harv-install Outdated Show resolved Hide resolved
@@ -0,0 +1,8 @@
blacklist {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a default devnode line here that blacklists everything? I was just looking at the manpage for multipath.conf, and it says:

The default blacklist consists of the regular expression "!^(sd[a-z]|dasd[a-z]|nvme[0-9])". This causes all device types other than scsi, dasd, and nvme to be excluded from multipath handling by default."

My reading is that with multipathd enabled all scsi, dasd and nvme devices are still up for grabs. Is this correct, or am I confused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from my experiments we are blacklisting everything apart from the negated expression in blacklist which whitelists the devices.

for example on my kvm setup the following config.yaml is used

os:
  externalStorageConfig:
    enabled: true
    multiPathConfig:
    - vendor: "QEMU"
      product: "QEMU HARDDISK"

This gets converted into multipath config

blacklist {

    device {
        vendor "!QEMU"
        product "!QEMU HARDDISK"
    }

}

end result is multipath is enabled on the qemu scsi disks

0QEMU_QEMU_HARDDISK_disk1 dm-0 QEMU,QEMU HARDDISK
size=250G features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 0:0:0:1 sda 8:0  active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 0:0:0:2 sdb 8:16 active ready running

Longhorn disks in use by VM's are ignored by mutlipath since they do not match the expression

  *-disk
       description: SCSI Disk
       product: VIRTUAL-DISK
       vendor: IET
       physical id: 0.0.1
       bus info: scsi@7:0.0.1
       logical name: /dev/sdc
       version: 0001
       serial: beaf11
       size: 10GiB (10GB)
       capabilities: gpt-1.00 partitioned partitioned:gpt
       configuration: ansiversion=5 guid=57debec6-c414-4d56-a0a1-788da7c89c52 logicalsectorsize=512 sectorsize=512

pkg/console/util.go Outdated Show resolved Hide resolved
Copy link

mergify bot commented Aug 23, 2024

This pull request is now in conflict. Could you fix it @ibrokethecloud? 🙏

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.

LGTM!

Copy link
Contributor

@Vicente-Cheng Vicente-Cheng left a comment

Choose a reason for hiding this comment

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

just a nit, others LGTM!

BTW, could we squash some commits if they are similar?

Copy link
Member

@bk201 bk201 left a comment

Choose a reason for hiding this comment

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

@ibrokethecloud please help squash commits and we can merge this. Thanks!

…kernel arguments

fix typo in grub2-editenv

fixing issues for multipath config and kernel arguments

enable multipath in initrd

tidy up and vendor go mod deps

add logic to filter interfaces in use for iscsi session

additional logic to dedup disks and only show one device for multipath'd disks

tweak disk filter logic and make multipathd conditional

tweak comments on disk deduplication logic

fix comment in harv-install describing usage of HARVESTER_ADDITIONAL_KERNEL_ARGUMENTS

rebase upstream changes

remove dracut config files needed to enable multipathd. This is now handled in harvester/os2 directly
Copy link
Contributor

@Vicente-Cheng Vicente-Cheng left a comment

Choose a reason for hiding this comment

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

thanks!

@ibrokethecloud ibrokethecloud merged commit f0b21b9 into harvester:master Aug 28, 2024
7 checks passed
@ibrokethecloud
Copy link
Contributor Author

@Mergifyio backport v1.4

Copy link

mergify bot commented Aug 28, 2024

backport v1.4

✅ 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.

4 participants