Skip to content

Commit

Permalink
Merge pull request #410 from digitalocean/populate-published-node-ids
Browse files Browse the repository at this point in the history
Populate published node IDs in ListVolumesResponse
  • Loading branch information
Timo Reimann authored Dec 20, 2021
2 parents 0ec2cf4 + 69026ba commit cdc94aa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,19 @@ func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (

var entries []*csi.ListVolumesResponse_Entry
for _, vol := range volumes {
attachedDropletIDs := make([]string, 0, len(vol.DropletIDs))
for _, dropletID := range vol.DropletIDs {
attachedDropletIDs = append(attachedDropletIDs, strconv.Itoa(dropletID))
}

entries = append(entries, &csi.ListVolumesResponse_Entry{
Volume: &csi.Volume{
VolumeId: vol.ID,
CapacityBytes: vol.SizeGigaBytes * giB,
},
Status: &csi.ListVolumesResponse_VolumeStatus{
PublishedNodeIds: attachedDropletIDs,
},
})
}

Expand Down Expand Up @@ -609,6 +617,7 @@ func (d *Driver) ControllerGetCapabilities(ctx context.Context, req *csi.Control
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS,
csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
csi.ControllerServiceCapability_RPC_LIST_VOLUMES_PUBLISHED_NODES,
} {
caps = append(caps, newCap(cap))
}
Expand Down

0 comments on commit cdc94aa

Please sign in to comment.