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() (backport #157) #158

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Oct 22, 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.

This is an automatic backport of pull request #157 done by [Mergify](https://mergify.com).

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 <tserong@suse.com>
(cherry picked from commit b258580)
@tserong tserong requested a review from bk201 October 22, 2024 07:54
@bk201 bk201 merged commit 8d0be66 into v0.7.x Oct 22, 2024
6 checks passed
@Vicente-Cheng Vicente-Cheng deleted the mergify/bp/v0.7.x/pr-157 branch October 23, 2024 02:20
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