YARN-9331. [YARN-8851] Fix a bug that lacking cgroup initialization when bootstrap DeviceResourceHandlerImpl. Contributed by Zhankun Tang.

This commit is contained in:
Weiwei Yang 2019-02-26 10:05:31 +08:00
parent a6ab37192a
commit c6ea28c480
2 changed files with 5 additions and 2 deletions

View File

@ -122,8 +122,9 @@ public class DeviceResourceHandlerImpl implements ResourceHandler {
}
// Add device set. Here we trust the plugin's return value
deviceMappingManager.addDeviceSet(resourceName, availableDevices);
// TODO: Init cgroups
// Init cgroups
this.cGroupsHandler.initializeCGroupController(
CGroupsHandler.CGroupController.DEVICES);
return null;
}

View File

@ -164,6 +164,8 @@ public class TestDevicePluginAdapter {
mockShellWrapper);
adapter.setDeviceResourceHandler(drhl);
adapter.getDeviceResourceHandler().bootstrap(conf);
verify(mockCGroupsHandler).initializeCGroupController(
CGroupsHandler.CGroupController.DEVICES);
int size = dmm.getAvailableDevices(resourceName);
Assert.assertEquals(3, size);
// Case 1. A container c1 requests 1 device