@@ -182,7 +182,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
182
182
183
183
// If there is no validation error, immediately return success
184
184
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
186
186
}
187
187
188
188
snapshotID := ""
@@ -234,7 +234,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
234
234
}
235
235
236
236
klog .V (4 ).Infof ("CreateVolume succeeded for disk %v" , volKey )
237
- return generateCreateVolumeResponse (disk , capBytes , zones ), nil
237
+ return generateCreateVolumeResponse (disk , zones ), nil
238
238
239
239
}
240
240
@@ -979,16 +979,17 @@ func getDefaultZonesInRegion(ctx context.Context, gceCS *GCEControllerServer, ex
979
979
return ret , nil
980
980
}
981
981
982
- func generateCreateVolumeResponse (disk * gce.CloudDisk , capBytes int64 , zones []string ) * csi.CreateVolumeResponse {
982
+ func generateCreateVolumeResponse (disk * gce.CloudDisk , zones []string ) * csi.CreateVolumeResponse {
983
983
tops := []* csi.Topology {}
984
984
for _ , zone := range zones {
985
985
tops = append (tops , & csi.Topology {
986
986
Segments : map [string ]string {common .TopologyKeyZone : zone },
987
987
})
988
988
}
989
+ realDiskSizeBytes := common .GbToBytes (disk .GetSizeGb ())
989
990
createResp := & csi.CreateVolumeResponse {
990
991
Volume : & csi.Volume {
991
- CapacityBytes : capBytes ,
992
+ CapacityBytes : realDiskSizeBytes ,
992
993
VolumeId : cleanSelfLink (disk .GetSelfLink ()),
993
994
VolumeContext : nil ,
994
995
AccessibleTopology : tops ,
0 commit comments