Set default to prevent out of memory conditions

Change-Id: I00efd4784346adb89b137424ed35bdeafe9b6f24
This commit is contained in:
Julia Kreger 2020-05-08 15:15:06 -07:00
parent d9913370de
commit 5f6a51e178
3 changed files with 20 additions and 3 deletions

View File

@ -354,7 +354,7 @@ service_opts = [
'conductor and API services')),
cfg.BoolOpt('minimum_memory_warning_only',
mutable=True,
default=True,
default=False,
help=_('Setting to govern if Ironic should only warn instead '
'of attempting to hold back the request in order to '
'prevent the exhaustion of system memory.')),

View File

@ -452,7 +452,6 @@ class TempFilesTestCase(base.TestCase):
@mock.patch.object(time, 'sleep', autospec=True)
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
def test_is_memory_insufficent(self, mock_vm_check, mock_sleep):
self.config(minimum_memory_warning_only=False)
class vm_check(object):
available = 1000000000
@ -465,7 +464,6 @@ class TempFilesTestCase(base.TestCase):
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
def test_is_memory_insufficent_good(self, mock_vm_check,
mock_sleep):
self.config(minimum_memory_warning_only=False)
class vm_check(object):
available = 3276700000
@ -492,6 +490,19 @@ class TempFilesTestCase(base.TestCase):
self.assertFalse(utils.is_memory_insufficent())
self.assertEqual(3, mock_vm_check.call_count)
@mock.patch.object(time, 'sleep', autospec=True)
@mock.patch.object(psutil, 'virtual_memory', autospec=True)
def test_is_memory_insufficent_warning_only(self, mock_vm_check,
mock_sleep):
self.config(minimum_memory_warning_only=True)
class vm_check_bad(object):
available = 1023000000
mock_vm_check.side_effect = vm_check_bad
self.assertFalse(utils.is_memory_insufficent())
self.assertEqual(2, mock_vm_check.call_count)
class GetUpdatedCapabilitiesTestCase(base.TestCase):

View File

@ -0,0 +1,6 @@
---
features:
- |
By default Ironic will now not start new memory intensive work IF
insufficent system memory exists. This can be disabled by setting
the ``[DEFAULT]minimum_memory_warning_only`` value to ``True``.