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 List<PrivilegedOperation> bootstrap(Configuration configuration)
} }
// Add device set. Here we trust the plugin's return value // Add device set. Here we trust the plugin's return value
deviceMappingManager.addDeviceSet(resourceName, availableDevices); deviceMappingManager.addDeviceSet(resourceName, availableDevices);
// TODO: Init cgroups // Init cgroups
this.cGroupsHandler.initializeCGroupController(
CGroupsHandler.CGroupController.DEVICES);
return null; return null;
} }

View File

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