summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-02-12 22:46:46 +0000
committerGerrit Code Review <review@openstack.org>2021-02-12 22:46:46 +0000
commitd65c4865924e47df623e94262fbfd78fab111c23 (patch)
treeb5f8db7d1f405e60459b126f32272ea97a91cd08
parent1adee0cf5dbadd639264702dc648480174e100e3 (diff)
parent5f6a51e178d9f1539c4776230f16176a15445d63 (diff)
downloadironic-16.2.0.tar.gz
Merge "Set default to prevent out of memory conditions"16.2.0
-rw-r--r--ironic/conf/default.py2
-rw-r--r--ironic/tests/unit/common/test_utils.py15
-rw-r--r--releasenotes/notes/conductor-now-waits-when-low-on-memory-d73892a79cde0516.yaml6
3 files changed, 20 insertions, 3 deletions
diff --git a/ironic/conf/default.py b/ironic/conf/default.py
index f5becc370..bb5ec3918 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 e39a8f7db..9bfcddb86 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 000000000..4c8676182
--- /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``.