@@ -37,11 +37,12 @@ type ERDMADevicePlugin struct {
3737	devices               map [string ]* types.ERdmaDeviceInfo 
3838	allocAllDevices       bool 
3939	devicepluginPreStart  bool 
40+ 	allocRdmaCM           bool 
4041	sync.Locker 
4142}
4243
4344// NewERDMADevicePlugin returns an initialized ERDMADevicePlugin 
44- func  NewERDMADevicePlugin (devices  []* types.ERdmaDeviceInfo , allocAllDevices   bool , devicepluginPreStart  bool ) (* ERDMADevicePlugin , error ) {
45+ func  NewERDMADevicePlugin (devices  []* types.ERdmaDeviceInfo , allocAllDevices , devicepluginPreStart ,  allocRdmaCM  bool ) (* ERDMADevicePlugin , error ) {
4546	devMap  :=  map [string ]* types.ERdmaDeviceInfo {}
4647	for  _ , d  :=  range  devices  {
4748		devMap [d .Name ] =  d 
@@ -60,6 +61,7 @@ func NewERDMADevicePlugin(devices []*types.ERdmaDeviceInfo, allocAllDevices bool
6061		Locker :               & sync.Mutex {},
6162		allocAllDevices :      allocAllDevices ,
6263		devicepluginPreStart : devicepluginPreStart ,
64+ 		allocRdmaCM :          allocRdmaCM ,
6365		stop :                 make (chan  struct {}, 1 ),
6466	}, nil 
6567}
@@ -292,6 +294,13 @@ func (m *ERDMADevicePlugin) Allocate(ctx context.Context, r *pluginapi.AllocateR
292294				}
293295			})... )
294296		})
297+ 		if  m .allocRdmaCM  {
298+ 			devicePaths  =  append (devicePaths , & pluginapi.DeviceSpec {
299+ 				ContainerPath : "/dev/infiniband/rdma_cm" ,
300+ 				HostPath :      "/dev/infiniband/rdma_cm" ,
301+ 				Permissions :   "rw" ,
302+ 			})
303+ 		}
295304		if  len (devicePaths ) >  0  {
296305			response .ContainerResponses  =  append (response .ContainerResponses ,
297306				& pluginapi.ContainerAllocateResponse {
0 commit comments