@@ -182,7 +182,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
182182
183183 // If there is no validation error, immediately return success
184184 klog .V (4 ).Infof ("CreateVolume succeeded for disk %v, it already exists and was compatible" , volKey )
185- return generateCreateVolumeResponse (existingDisk , capBytes , zones ), nil
185+ return generateCreateVolumeResponse (existingDisk , zones ), nil
186186 }
187187
188188 snapshotID := ""
@@ -234,7 +234,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
234234 }
235235
236236 klog .V (4 ).Infof ("CreateVolume succeeded for disk %v" , volKey )
237- return generateCreateVolumeResponse (disk , capBytes , zones ), nil
237+ return generateCreateVolumeResponse (disk , zones ), nil
238238
239239}
240240
@@ -979,16 +979,17 @@ func getDefaultZonesInRegion(ctx context.Context, gceCS *GCEControllerServer, ex
979979 return ret , nil
980980}
981981
982- func generateCreateVolumeResponse (disk * gce.CloudDisk , capBytes int64 , zones []string ) * csi.CreateVolumeResponse {
982+ func generateCreateVolumeResponse (disk * gce.CloudDisk , zones []string ) * csi.CreateVolumeResponse {
983983 tops := []* csi.Topology {}
984984 for _ , zone := range zones {
985985 tops = append (tops , & csi.Topology {
986986 Segments : map [string ]string {common .TopologyKeyZone : zone },
987987 })
988988 }
989+ realDiskSizeBytes := common .GbToBytes (disk .GetSizeGb ())
989990 createResp := & csi.CreateVolumeResponse {
990991 Volume : & csi.Volume {
991- CapacityBytes : capBytes ,
992+ CapacityBytes : realDiskSizeBytes ,
992993 VolumeId : cleanSelfLink (disk .GetSelfLink ()),
993994 VolumeContext : nil ,
994995 AccessibleTopology : tops ,
0 commit comments