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