Skip to content

Commit 6d11056

Browse files
committed
Remove cross validation of access modes, multiple access modes can be specified that represent all the capabilities of the volume
1 parent e1c01f8 commit 6d11056

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

pkg/gce-pd-csi-driver/utils.go

-25
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,6 @@ func validateVolumeCapabilities(vcs []*csi.VolumeCapability) error {
7272
return err
7373
}
7474
}
75-
if err := crossValidateAccessModes(vcs); err != nil {
76-
return err
77-
}
78-
return nil
79-
}
80-
81-
func crossValidateAccessModes(vcs []*csi.VolumeCapability) error {
82-
m := map[csi.VolumeCapability_AccessMode_Mode]bool{}
83-
84-
for _, vc := range vcs {
85-
m[vc.GetAccessMode().GetMode()] = true
86-
}
87-
88-
hasWriter := m[csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER]
89-
hasSingleReader := m[csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY]
90-
hasMultiReader := m[csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY]
91-
92-
if hasWriter && (hasSingleReader || hasMultiReader) {
93-
return fmt.Errorf("both SINGLE_NODE_WRITER and READER_ONLY access mode specified")
94-
}
95-
96-
if hasSingleReader && hasMultiReader {
97-
return fmt.Errorf("both SINGLE_NODE_READER_ONLY and MULTI_NODE_READY_ONLY specified")
98-
}
99-
10075
return nil
10176
}
10277

0 commit comments

Comments
 (0)