1
0
Fork 0

Merge pull request #269 from yarda/containers-fix

Fixed crash when running inside container
This commit is contained in:
Jaroslav Škarvada 2020-06-04 19:24:36 +02:00 committed by GitHub
commit 379fe5e9e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -25,7 +25,11 @@ class Inventory(object):
buffer_size = consts.CFG_DEF_UDEV_BUFFER_SIZE
if (set_receive_buffer_size):
self._udev_monitor.set_receive_buffer_size(buffer_size)
try:
self._udev_monitor.set_receive_buffer_size(buffer_size)
except EnvironmentError:
log.warn("cannot set udev monitor receive buffer size, we are probably running inside " +
"container or with limited capabilites, Tuned functionality may be limited")
if monitor_observer_factory is None:
monitor_observer_factory = _MonitorObserverFactory()

View file

@ -150,7 +150,10 @@ class CPULatencyPlugin(base.Plugin):
instance._first_instance = False
log.info("Latency settings from non-first CPU plugin instance '%s' will be ignored." % instance.name)
instance._first_device = list(instance.assigned_devices)[0]
try:
instance._first_device = list(instance.assigned_devices)[0]
except IndexError:
instance._first_device = None
def _instance_cleanup(self, instance):
if instance._first_instance: