Skip to content

Commit

Permalink
Populate published node IDs in ListVolumesResponse
Browse files Browse the repository at this point in the history
According to [1], this "helps the CO [container orchestrator] reconcile
the actual state when the volume may have been Unpublished from the node
out of band from the CO".

[1] container-storage-interface/spec#374
  • Loading branch information
Timo Reimann committed Dec 19, 2021
1 parent c3db7d6 commit 69026ba
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 69026ba

Please sign in to comment.