-
-#logger.verbose("Cgroups: Recognizing already existing cgroups...")
-#for virt in VIRT_TECHS:
-# filenames = os.listdir(os.path.join(BASE_DIR, virt))
-# for filename in filenames:
-# path = os.path.join(BASE_DIR, virt, filename)
-# if os.path.isdir(path):
-# CGROUPS[filename] = path
-
-#logger.verbose("Cgroups: Initializing watchers...")
-#wm = pyinotify.WatchManager()
-#notifier = pyinotify.ThreadedNotifier(wm, CgroupWatch())
-#for virt in VIRT_TECHS:
-# wdd = wm.add_watch(os.path.join(BASE_DIR, virt),
-# pyinotify.IN_DELETE | pyinotify.IN_CREATE,
-# rec=False)
-#notifier.daemon = True
-#notifier.start()
-
-def get_cgroup_paths():
- cpusetBase = os.path.join(BASE_DIR, 'cpuset', 'libvirt', 'lxc')
- return filter(os.path.isdir,
- map(lambda f: os.path.join(cpusetBase, f),
- os.listdir(cpusetBase)))
-
-def get_cgroup_path(name):
- """ Returns the base path for the cgroup with a specific name or None."""
- return reduce(lambda a, b: b if os.path.basename(b) == name else a,
- get_cgroup_paths(), None)