Skip to content

Commit ebeec89

Browse files
authored
Block shared disks from being attached to pod VMs (#3346)
1 parent 55536dc commit ebeec89

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/csi/service/wcp/controller.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,19 @@ func (c *controller) ControllerPublishVolume(ctx context.Context, req *csi.Contr
13711371
log.Errorf(msg)
13721372
return nil, csifault.CSIInvalidArgumentFault, err
13731373
}
1374+
1375+
if commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.SharedDiskFss) {
1376+
// Cannot be nil as it is already verified in validateWCPControllerPublishVolumeRequest
1377+
volCap := req.GetVolumeCapability()
1378+
caps := []*csi.VolumeCapability{volCap}
1379+
if isSharedRawBlockRequest(ctx, caps) {
1380+
// Shared Disk feature is not supported for PodVMs.
1381+
err := fmt.Errorf("shared disks are not supportd for PodVMs. Invalid request %+v", *req)
1382+
log.Errorf("failed to verify if volume is a shared disk. Err: %+v", err)
1383+
return nil, csifault.CSIInvalidArgumentFault, err
1384+
}
1385+
}
1386+
13741387
volumeType = prometheus.PrometheusBlockVolumeType
13751388
volumeAttachment, err := commonco.ContainerOrchestratorUtility.GetVolumeAttachment(ctx, req.VolumeId, req.NodeId)
13761389
if err != nil {

0 commit comments

Comments
 (0)