- nr_hp = int(math.ceil(settings.getValue('HUGEPAGE_RAM_ALLOCATION')/hp_size))
- _LOGGER.info('Will allocate %s hugepages.', nr_hp)
-
- nr_hugepages = 'vm.nr_hugepages=' + str(nr_hp)
- try:
- tasks.run_task(['sudo', 'sysctl', nr_hugepages],
- _LOGGER, 'Trying to allocate hugepages..', True)
- except subprocess.CalledProcessError:
- _LOGGER.error('Unable to allocate hugepages.')
- return False
- global _allocated_hugepages
- _allocated_hugepages = True
- return True
+ nr_hp = int(math.ceil(settings.getValue('HUGEPAGE_RAM_ALLOCATION')/hp_size))
+ _LOGGER.info('Will allocate %s hugepages.', nr_hp)
+
+ nr_hugepages = 'vm.nr_hugepages=' + str(nr_hp)
+ try:
+ tasks.run_task(['sudo', 'sysctl', nr_hugepages],
+ _LOGGER, 'Trying to allocate hugepages..', True)
+ except subprocess.CalledProcessError:
+ _LOGGER.error('Unable to allocate hugepages.')
+ return False
+ # pylint: disable=global-statement
+ global _ALLOCATED_HUGEPAGES
+ _ALLOCATED_HUGEPAGES = True
+ return True