Lines Matching +full:modules +full:- +full:2
2 # -*- coding: utf-8 -*-
30 def initialize(self, modules): argument
34 @param modules: Array of all available cgroup modules.
37 self.root = modules.get_pwd(self.module)
42 return -1
54 pwd = mkdtemp(prefix='cgroup-', dir=root) + '/'
56 pwd = mkdtemp(prefix='cgroup-', dir=self.root) + '/'
76 return -1
105 return -1
128 return -1
132 return -1
155 if tmp[0][-1] == '\n':
156 tmp[0] = tmp[0][:-1]
183 Sets the one-line property value concerning the K,M,G postfix
193 if value[-1] == '\n':
194 value = value[:-1]
195 if value[-1] == 'K':
196 value = int(value[:-1]) * 1024
197 elif value[-1] == 'M':
198 value = int(value[:-1]) * 1048576
199 elif value[-1] == 'G':
200 value = int(value[:-1]) * 1073741824
223 return -1
225 # Get the first line - '\n'
226 _value = self.get_property(prop, pwd)[0][:-1]
230 return -1
243 return -1
249 return -1
254 return -1
261 return -1
267 return -1
274 return -1
281 return -1
288 return -1
293 time.sleep(2)
296 return -1
306 self.modules = []
307 self.modules.append([])
308 self.modules.append([])
309 self.modules.append([])
310 self.mountdir = mkdtemp(prefix='cgroup-') + '/'
315 Checks the mounted modules and if necessary mounts them into tmp
317 @param _modules: Desired modules.
318 @return: Number of initialized modules.
320 logging.debug("Desired cgroup modules: %s", _modules)
325 if line[2] == 'cgroup':
334 if mount[3].find(module) != -1:
335 self.modules[0].append(module)
336 self.modules[1].append(mount[1] + '/')
337 self.modules[2].append(False)
343 cmd = ('mount -t cgroup -o %s %s %s' %
347 self.modules[0].append(module)
348 self.modules[1].append(self.mountdir + module)
349 self.modules[2].append(True)
353 logging.debug("Initialized cgroup modules: %s", self.modules[0])
354 return len(self.modules[0])
361 for i in range(len(self.modules[0])):
362 if self.modules[2][i]:
363 utils.system('umount %s -l' % self.modules[1][i],
375 i = self.modules[0].index(module)
379 return self.modules[1][i]