diff --git a/ironic/conf/default.py b/ironic/conf/default.py index f5becc3708..bb5ec39180 100644 --- a/ironic/conf/default.py +++ b/ironic/conf/default.py @@ -361,7 +361,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.')), diff --git a/ironic/tests/unit/common/test_utils.py b/ironic/tests/unit/common/test_utils.py index e39a8f7dbf..9bfcddb863 100644 --- a/ironic/tests/unit/common/test_utils.py +++ b/ironic/tests/unit/common/test_utils.py @@ -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): diff --git a/releasenotes/notes/conductor-now-waits-when-low-on-memory-d73892a79cde0516.yaml b/releasenotes/notes/conductor-now-waits-when-low-on-memory-d73892a79cde0516.yaml new file mode 100644 index 0000000000..4c86761820 --- /dev/null +++ b/releasenotes/notes/conductor-now-waits-when-low-on-memory-d73892a79cde0516.yaml @@ -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``.