Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,22 @@ protected List<CGroupController> getCGroupControllers() {
}

@Override
protected Map<String, Set<String>> parsePreConfiguredMountPath() throws IOException {
protected Map<String, Set<String>> parsePreConfiguredMountPath() {
Map<String, Set<String>> controllerMappings = new HashMap<>();
controllerMappings.put(this.cGroupsMountConfig.getV2MountPath(),
readControllersFile(this.cGroupsMountConfig.getV2MountPath()));
try {
controllerMappings.put(this.cGroupsMountConfig.getV2MountPath(),
readControllersFile(this.cGroupsMountConfig.getV2MountPath()));
} catch (IOException e) {
// Failing to read the cgroup.controllers file in the preconfigured might mean
// that the node is not using cgroup v2, or no cgroup v2 hierarchy is mounted
// under the specified path. If the node is using v1 we will fall back to cgroup v1
// in ResourceHandlerModule.initializeCGroupHandlers. If the cgroup v2 hierarchy is
// not mounted and no cgroup v1 hierarchy is mounted, we will fail to start the NM.
LOG.info("Failed to read the cgroup controllers file in the preconfigured directory: {}. " +
"The cgroup v2 hierarchy may not be mounted under the specified path, or the node" +
" might be using cgroup v1.", this.cGroupsMountConfig.getV2MountPath());
LOG.debug("Exception while reading the cgroup.controllers file: ", e);
}
return controllerMappings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,17 @@ public class ResourceHandlerModule {
cGroupsCpuResourceHandler;

private static void initializeCGroupHandlers(Configuration conf,
CGroupsHandler.CGroupController controller) throws ResourceHandlerException {
initializeCGroupV1Handler(conf);
if (cgroupsV2Enabled && !isMountedInCGroupsV1(controller)) {
CGroupsHandler.CGroupController controller)
throws ResourceHandlerException {
if (cgroupsV2Enabled) {
initializeCGroupV2Handler(conf);
if (!isMountedInCGroupsV2(controller)) {
LOG.info("Cgroup v2 is enabled but {} is not mounted in cgroups v2, falling back to v1",
controller);
initializeCGroupV1Handler(conf);
}
} else {
initializeCGroupV1Handler(conf);
}
}

Expand Down