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

Nomad volume deregister prevents deregistration when a volume id is a prefix of another #11846

Closed
RickyGrassmuck opened this issue Jan 14, 2022 · 3 comments · Fixed by #11852
Closed

Comments

@RickyGrassmuck
Copy link
Contributor

Nomad version

# nomad version
Nomad v1.2.3 (a79efc8422082c4790046c3f5ad92c542592a54f)

Issue

When a registered volume whose full ID is a prefix of another volumes ID, the deregister command will not deregister the volume and will print a message about multiple prefix matches. This creates a situation where you must first deregister any volumes who's ID is prefixed with the ID of the volume you are trying to deregister.

Reproduction steps

  1. Create 2 volumes with the ID's test_volume and test_volume_1
# cat <<EOF | nomad volume create - 
id        = "test_volume"
name      = "test_volume"
type      = "csi"
plugin_id = "cinder-csi-hashistack"
capacity_min = "1G"
capacity_max = "1G"

capability {
  access_mode = "single-node-writer"
  attachment_mode = "file-system"
}

mount_options {
  fs_type     = "ext4"
  mount_flags = ["rw", "noatime"]
}
EOF
# cat <<EOF | nomad volume create - 
id        = "test_volume_1"
name      = "test_volume_1"
type      = "csi"
plugin_id = "cinder-csi-hashistack"
capacity_min = "1G"
capacity_max = "1G"

capability {
  access_mode = "single-node-writer"
  attachment_mode = "file-system"
}

mount_options {
  fs_type     = "ext4"
  mount_flags = ["rw", "noatime"]
}
EOF
  1. Run nomad volume deregister test_volume and note that the command returns the message Prefix matched multiple volumes instead of the success message for deregistering a volume.
# nomad volume deregister test_volume 
Prefix matched multiple volumes

ID        Name           Plugin ID              Schedulable  Access Mode
test_vol  test_volume    cinder-csi-hashistack  true         <none>
test_vol  test_volume_1  cinder-csi-hashistack  true         <none>

Expected Result

Providing a full ID to the deregister command should result in the volume being deregistered

Actual Result

The volume is not deregistered and you must first deregister all volumes who's ID is prefixed with the volume ID you are trying to remove.

Job file (if appropriate)

N/A

Nomad Server logs (if appropriate)

N/A

Nomad Client logs (if appropriate)

N/A

@tgross
Copy link
Member

tgross commented Jan 14, 2022

Hi @RickyGrassmuck! I took a quick look and this looks like a bug in the state store (ref state_store.go#L2373-L2378), where we're using the ID prefix instead of the ID. Not sure how that happened but should be straightforward to fix. Thanks for opening this issue!

@tgross tgross added this to Needs Triage in Nomad - Community Issues Triage via automation Jan 14, 2022
@tgross tgross self-assigned this Jan 14, 2022
@tgross tgross moved this from Needs Triage to In Progress in Nomad - Community Issues Triage Jan 14, 2022
@tgross
Copy link
Member

tgross commented Jan 14, 2022

Fixed in #11852

@tgross tgross added this to the 1.2.4 milestone Jan 14, 2022
Nomad - Community Issues Triage automation moved this from In Progress to Done Jan 14, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants