Skip to content

nomad volume status -verbose command crashes #10816

@ivoronin

Description

@ivoronin

nomad volume status -verbose command crashes because of out of range index access:

~# nomad volume status -verbose
Container Storage Interface
ID                Name              Plugin ID  Schedulable  Access Mode
volume1           volume1           gcepd      true         single-node-writer
volume2           volume2           gcepd      true         single-node-writer
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/hashicorp/nomad/command.(*VolumeStatusCommand).listVolumes(0xc000117110, 0xc000262ee0, 0x70)
        github.com/hashicorp/nomad/command/volume_status_csi.go:123 +0x671
github.com/hashicorp/nomad/command.(*VolumeStatusCommand).csiStatus(0xc000117110, 0xc000262ee0, 0x0, 0x0, 0x0)
        github.com/hashicorp/nomad/command/volume_status_csi.go:23 +0x5fc
github.com/hashicorp/nomad/command.(*VolumeStatusCommand).Run(0xc000117110, 0xc000132030, 0x1, 0x1, 0xc0001b1ed0)
        github.com/hashicorp/nomad/command/volume_status.go:126 +0x46a
github.com/mitchellh/cli.(*CLI).Run(0xc0001da3c0, 0xc0001da3c0, 0xc00000f080, 0x37)
        github.com/mitchellh/[email protected]/cli.go:260 +0x41a
main.RunCustom(0xc000132010, 0x3, 0x3, 0xc000102058)
        github.com/hashicorp/nomad/main.go:142 +0x4a7
main.Run(...)
        github.com/hashicorp/nomad/main.go:87
main.main()
        github.com/hashicorp/nomad/main.go:83 +0x65

Something is definitely wrong with this code:

rows := []string{}
rows[0] = "External ID|Condition|Nodes"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions