Merge "Added default value to the max_instances parameter of dpm.py"

This commit is contained in:
Jenkins 2017-05-30 08:42:07 +00:00 committed by Gerrit Code Review
commit 5c5b2e0af6
3 changed files with 46 additions and 2 deletions

View File

@ -34,9 +34,14 @@ ALL_DPM_OPTS = [
cfg.IntOpt('max_memory', help="""
Maximum amount of memory (in MiB) on the target CPC that can be used for
this OpenStack hypervisor host"""),
cfg.IntOpt('max_instances', help="""
cfg.IntOpt('max_instances', default=-1, min=-1, help="""
Maximum number of instances (partitions) that can be created for this
OpenStack hypervisor host"""),
OpenStack hypervisor host. Valid values are:
-1: The number of instances is only limited by the
number of free partitions on this CPC
0: A technically valid upper bound but useless.
>0: If this value is reached,
this host won't be able to spawn new instances."""),
MultiStorageAdapterMappingOpt('physical_storage_adapter_mappings', help="""
Physical storage adapter with port details for hba creation"""),
cfg.ListOpt('target_wwpn_ignore_list', default='', help="""

View File

@ -0,0 +1,32 @@
# Copyright 2017 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import nova_dpm.conf
from nova.test import TestCase
class TestConfigParameters(TestCase):
def setUp(self):
super(TestConfigParameters, self).setUp()
self.CONF = nova_dpm.conf.CONF
def test_default_value(self):
max_instance = self.CONF.dpm.max_instances
self.assertEqual(-1, max_instance)
def test_min_value(self):
self.assertRaises(ValueError, self.CONF.set_override, "max_instances",
-2, group="dpm")

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
Default value of -1 has been set for the configuration option
``max_instances``. This means that by default, there is no upper
limit set on the maximum number of instances that can be created for
this host.