Added default value to the max_instances parameter of dpm.py

The default value is set to -1, which means that there is no artificial
upper bound for the number of instances on this CPC. The number of
instances is only limited by the number of (free) partitions on this
CPC.
closes-Bug: 1683318

Change-Id: I80f8b36fa21cef313e0b5a821a26877afd1af980
This commit is contained in:
sreeteja 2017-04-26 17:04:08 +05:30
parent ff1b77f71a
commit dbe45cf03f
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.