diff --git a/.changelog/12573.txt b/.changelog/12573.txt new file mode 100644 index 000000000..95505f36d --- /dev/null +++ b/.changelog/12573.txt @@ -0,0 +1,3 @@ +```release-note:bug +csi: Fixed a bug where per-alloc volumes used the incorrect ID when querying for `alloc status -verbose` +``` diff --git a/command/alloc_status.go b/command/alloc_status.go index 0d8b413c0..e8d26b6ce 100644 --- a/command/alloc_status.go +++ b/command/alloc_status.go @@ -826,9 +826,14 @@ FOUND: fmt.Sprintf("%s|%v", volReq.Name, *volMount.ReadOnly)) case structs.VolumeTypeCSI: if verbose { + source := volReq.Source + if volReq.PerAlloc { + source = source + structs.AllocSuffix(alloc.Name) + } + // there's an extra API call per volume here so we toggle it // off with the -verbose flag - vol, _, err := client.CSIVolumes().Info(volReq.Source, nil) + vol, _, err := client.CSIVolumes().Info(source, nil) if err != nil { c.Ui.Error(fmt.Sprintf("Error retrieving volume info for %q: %s", volReq.Name, err))