@@ -44,11 +44,14 @@ type GCENodeServer struct {
44
44
var _ csi.NodeServer = & GCENodeServer {}
45
45
46
46
// The constants are used to map from the machine type to the limit of
47
- // persistent disks that can be attached to an instance. Please refer to gcloud doc
48
- // https://cloud.google.com/compute/docs/disks/#pdnumberlimits
47
+ // persistent disks that can be attached to an instance. Please refer to gcloud
48
+ // doc https://cloud.google.com/compute/docs/disks/#pdnumberlimits
49
+ // These constants are all the documented attach limit minus one because the
50
+ // node boot disk is considered an attachable disk so effective attach limit is
51
+ // one less.
49
52
const (
50
- volumeLimit16 int64 = 16
51
- volumeLimit128 int64 = 128
53
+ volumeLimitSmall int64 = 15
54
+ volumeLimitBig int64 = 127
52
55
)
53
56
54
57
func (ns * GCENodeServer ) NodePublishVolume (ctx context.Context , req * csi.NodePublishVolumeRequest ) (* csi.NodePublishVolumeResponse , error ) {
@@ -327,9 +330,9 @@ func (ns *GCENodeServer) GetVolumeLimits() (int64, error) {
327
330
// Machine-type format: n1-type-CPUS or custom-CPUS-RAM or f1/g1-type
328
331
machineType := ns .MetadataService .GetMachineType ()
329
332
if strings .HasPrefix (machineType , "n1-" ) || strings .HasPrefix (machineType , "custom-" ) {
330
- volumeLimits = volumeLimit128
333
+ volumeLimits = volumeLimitBig
331
334
} else {
332
- volumeLimits = volumeLimit16
335
+ volumeLimits = volumeLimitSmall
333
336
}
334
337
return volumeLimits , nil
335
338
}
0 commit comments