diff --git a/pkg/common/constants.go b/pkg/common/constants.go index 6ef51d7d5..c90acd0a0 100644 --- a/pkg/common/constants.go +++ b/pkg/common/constants.go @@ -23,4 +23,7 @@ const ( // Keys for Topology. This key will be shared amonst drivers from GCP TopologyKeyZone = "com.google.topology/zone" + + // VolumeAttributes for Partition + VolumeAttributePartition = "partition" ) diff --git a/pkg/gce-pd-csi-driver/node.go b/pkg/gce-pd-csi-driver/node.go index 728752b34..bcca6de7e 100644 --- a/pkg/gce-pd-csi-driver/node.go +++ b/pkg/gce-pd-csi-driver/node.go @@ -174,9 +174,12 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage } // Part 1: Get device path of attached device - // TODO(#83): Get real partitions partition := "" + if part, ok := req.GetVolumeAttributes()[common.VolumeAttributePartition]; ok { + partition = part + } + deviceName, err := common.GetDeviceName(volumeKey) if err != nil { status.Error(codes.Internal, fmt.Sprintf("error getting device name: %v", err))