Merge "Not allow overcommit ratios to be negative"
This commit is contained in:
@@ -189,6 +189,7 @@ allocation_ratio_opts = [
|
||||
# TODO(sfinucan): Add min parameter
|
||||
cfg.FloatOpt('cpu_allocation_ratio',
|
||||
default=0.0,
|
||||
min=0.0,
|
||||
help="""
|
||||
This option helps you specify virtual CPU to physical CPU allocation
|
||||
ratio which affects all CPU filters.
|
||||
@@ -208,6 +209,7 @@ Possible values:
|
||||
# TODO(sfinucan): Add min parameter
|
||||
cfg.FloatOpt('ram_allocation_ratio',
|
||||
default=0.0,
|
||||
min=0.0,
|
||||
help="""
|
||||
This option helps you specify virtual RAM to physical RAM
|
||||
allocation ratio which affects all RAM filters.
|
||||
@@ -227,6 +229,7 @@ Possible values:
|
||||
# TODO(sfinucan): Add min parameter
|
||||
cfg.FloatOpt('disk_allocation_ratio',
|
||||
default=0.0,
|
||||
min=0.0,
|
||||
help="""
|
||||
This option helps you specify virtual disk to physical disk
|
||||
allocation ratio used by the disk_filter.py script to determine if
|
||||
|
@@ -14,6 +14,7 @@ import copy
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import units
|
||||
|
||||
@@ -38,6 +39,7 @@ from nova.tests import uuidsentinel as uuids
|
||||
|
||||
_HOSTNAME = 'fake-host'
|
||||
_NODENAME = 'fake-node'
|
||||
CONF = cfg.CONF
|
||||
|
||||
_VIRT_DRIVER_AVAIL_RESOURCES = {
|
||||
'vcpus': 4,
|
||||
@@ -2273,3 +2275,20 @@ class TestIsTrackableMigration(test.NoDBTestCase):
|
||||
mig.migration_type = mig_type
|
||||
|
||||
self.assertFalse(resource_tracker._is_trackable_migration(mig))
|
||||
|
||||
|
||||
class OverCommitTestCase(BaseTestCase):
|
||||
def test_cpu_allocation_ratio_none_negative(self):
|
||||
self.assertRaises(ValueError,
|
||||
CONF.set_default, 'cpu_allocation_ratio', -1.0,
|
||||
enforce_type=True)
|
||||
|
||||
def test_ram_allocation_ratio_none_negative(self):
|
||||
self.assertRaises(ValueError,
|
||||
CONF.set_default, 'ram_allocation_ratio', -1.0,
|
||||
enforce_type=True)
|
||||
|
||||
def test_disk_allocation_ratio_none_negative(self):
|
||||
self.assertRaises(ValueError,
|
||||
CONF.set_default, 'disk_allocation_ratio', -1.0,
|
||||
enforce_type=True)
|
||||
|
7
releasenotes/notes/bug-1604116-87a823c3c165d057.yaml
Normal file
7
releasenotes/notes/bug-1604116-87a823c3c165d057.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
upgrade:
|
||||
- The three configuration options ``cpu_allocation_ratio``,
|
||||
``ram_allocation_ratio`` and ``disk_allocation_ratio`` for
|
||||
the nova compute are now checked against negative values.
|
||||
If any of these three options is set to negative value
|
||||
then nova compute service will fail to start.
|
Reference in New Issue
Block a user