mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
cgroups: use subsystems namedtuple in the controllers mounting loop
This is just a simple re-factoring patch in preparation of the following one. Since we have a list of CGroups subsystems, which includes the hierarchy ID for each entry, let's use directly these namedtuples in the mouting loop. The following patch will make use of the hierarchy ID to properly mount each controller. Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
parent
b2ec957bf8
commit
103f792736
@ -318,17 +318,17 @@ class CgroupsModule(Module):
|
|||||||
self.cgroup_root = target.path.join(
|
self.cgroup_root = target.path.join(
|
||||||
target.working_directory, 'cgroups')
|
target.working_directory, 'cgroups')
|
||||||
|
|
||||||
# Load list of available controllers
|
# Get the list of the available controllers
|
||||||
controllers = []
|
|
||||||
subsys = self.list_subsystems()
|
subsys = self.list_subsystems()
|
||||||
for (n, h, c, e) in subsys:
|
if len(subsys) == 0:
|
||||||
controllers.append(n)
|
self.logger.warning('No CGroups controller available')
|
||||||
self.logger.debug('Available controllers: %s', controllers)
|
return
|
||||||
|
|
||||||
# Initialize controllers
|
# Initialize controllers
|
||||||
|
self.logger.info('Available controllers:')
|
||||||
self.controllers = {}
|
self.controllers = {}
|
||||||
for idx in controllers:
|
for ss in subsys:
|
||||||
controller = Controller(idx)
|
controller = Controller(ss.name)
|
||||||
self.logger.debug('Init %s controller...', controller.kind)
|
self.logger.debug('Init %s controller...', controller.kind)
|
||||||
if not controller.probe(self.target):
|
if not controller.probe(self.target):
|
||||||
continue
|
continue
|
||||||
@ -338,7 +338,7 @@ class CgroupsModule(Module):
|
|||||||
message = 'cgroups {} controller is not supported by the target'
|
message = 'cgroups {} controller is not supported by the target'
|
||||||
raise TargetError(message.format(controller.kind))
|
raise TargetError(message.format(controller.kind))
|
||||||
self.logger.debug('Controller %s enabled', controller.kind)
|
self.logger.debug('Controller %s enabled', controller.kind)
|
||||||
self.controllers[idx] = controller
|
self.controllers[ss.name] = controller
|
||||||
|
|
||||||
def list_subsystems(self):
|
def list_subsystems(self):
|
||||||
subsystems = []
|
subsystems = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user