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

fix: Call wipefs -a in LonghornV2Provisioner.Format() #157

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

tserong
Copy link
Contributor

@tserong tserong commented Oct 21, 2024

Problem:
When using the Longhorn V2 data engine, for NVMe devices where Longhorn decides to use the nvme bdev driver, device activation will fail if there's an existing filesystem. This does not appear to be a problem when using the aio driver.

Solution:
Run wipefs -a $devPath during provisioning.

Without this, we'll potentially have devices stuck unschedulable with an obscure error message like this:

Disk c1fd02d173a3f4b9176705e9b2e37d39(0003:03:00.0) on node altra is not ready: failed to generate disk config: error: rpc error: code = Internal desc = rpc error: code = Internal desc = failed to add disk block device: failed to create disk bdev: failed to attach NVMe disk 0003:03:00.0: error sending message, id 3126, method bdev_nvme_attach_controller, params {c1fd02d173a3f4b9176705e9b2e37d39 {PCIe 0003:03:00.0 } 30 2 15 disable}: {"code": -19,"message": "No such device"}

Related Issue:
harvester/harvester#6828

Test plan:

  • On a host with an extra nvme device, run mkfs.ext4 /dev/nvme0n1 (or whatever the device name is) to make a filesystem.
  • Try to add the disk to the host for Longhorn V2 usage. It should be stuck unschedulable (check kubectl -n longhorn-system get lhn -o yaml and look under diskStatus for an error message similar to the description above).
  • Re-test with this fix applied. The disk should provision fine.

Copy link
Collaborator

@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

@Vicente-Cheng Vicente-Cheng self-requested a review October 21, 2024 10:24
Copy link
Collaborator

@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

pkg/provisioner/longhornv2.go Outdated Show resolved Hide resolved
Format should really be a no-op for V2 disks given they just take the
whole device, but for NVMe devices where Longhorn decides to use the
nvme bdev driver, device activation will fail if there's an existing
filesystem on the device, so we need to make sure to wipe before use.

Without this, we'll potentially have devices stuck unschedulable with
an obscure error message like this:

Disk c1fd02d173a3f4b9176705e9b2e37d39(0003:03:00.0) on node altra is
not ready: failed to generate disk config: error: rpc error: code =
Internal desc = rpc error: code = Internal desc = failed to add disk
block device: failed to create disk bdev: failed to attach NVMe disk
0003:03:00.0: error sending message, id 3126, method
bdev_nvme_attach_controller, params {c1fd02d173a3f4b9176705e9b2e37d39
{PCIe  0003:03:00.0  }   30 2 15 disable}: {"code": -19,"message":
"No such device"}

Related issue: harvester/harvester#6828

Signed-off-by: Tim Serong <[email protected]>
@tserong
Copy link
Contributor Author

tserong commented Oct 22, 2024

@Mergifyio backport v0.7.x

Copy link

mergify bot commented Oct 22, 2024

backport v0.7.x

✅ 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