Set min=0 for block_device_allocate_retries option
The compute manager code that uses the block_device_allocate_retries option was handling values less than zero, logging a warning and treating the value as 0. This change removes that code and just sets min=0 on the option itself. A release note is added for the potential upgrade impact. Change-Id: Ia5b99f7c96a8b6bce6899a6ff04019ab65487db9 Closes-Bug: #1819049
This commit is contained in:
parent
3e6bf09a70
commit
5106d340f7
@ -1311,13 +1311,8 @@ class ComputeManager(manager.Manager):
|
||||
# TODO(yamahata): eliminate dumb polling
|
||||
start = time.time()
|
||||
retries = CONF.block_device_allocate_retries
|
||||
if retries < 0:
|
||||
LOG.warning("Treating negative config value (%(retries)s) for "
|
||||
"'block_device_retries' as 0.",
|
||||
{'retries': retries})
|
||||
# (1) treat negative config value as 0
|
||||
# (2) the configured value is 0, one attempt should be made
|
||||
# (3) the configured value is > 0, then the total number attempts
|
||||
# (1) if the configured value is 0, one attempt should be made
|
||||
# (2) if the configured value is > 0, then the total number attempts
|
||||
# is (retries + 1)
|
||||
attempts = 1
|
||||
if retries >= 1:
|
||||
|
@ -639,6 +639,7 @@ Possible values:
|
||||
"""),
|
||||
cfg.IntOpt('block_device_allocate_retries',
|
||||
default=60,
|
||||
min=0,
|
||||
help="""
|
||||
The number of times to check for a volume to be "available" before attaching
|
||||
it during server create.
|
||||
@ -662,7 +663,6 @@ Possible values:
|
||||
|
||||
* 60 (default)
|
||||
* If value is 0, then one attempt is made.
|
||||
* Any negative value is treated as 0.
|
||||
* For any value > 0, total attempts are (value + 1)
|
||||
|
||||
Related options:
|
||||
|
@ -636,21 +636,6 @@ class ComputeVolumeTestCase(BaseTestCase):
|
||||
attempts = c._await_block_device_map_created(self.context, '1')
|
||||
self.assertEqual(attempts, 3)
|
||||
|
||||
def test_await_block_device_created_retries_negative(self):
|
||||
c = self.compute
|
||||
self.flags(block_device_allocate_retries=-1)
|
||||
self.flags(block_device_allocate_retries_interval=0.1)
|
||||
|
||||
def volume_get(self, context, vol_id):
|
||||
return {
|
||||
'status': 'available',
|
||||
'id': 'blah',
|
||||
}
|
||||
|
||||
self.stub_out('nova.volume.cinder.API.get', volume_get)
|
||||
attempts = c._await_block_device_map_created(self.context, '1')
|
||||
self.assertEqual(1, attempts)
|
||||
|
||||
def test_await_block_device_created_retries_zero(self):
|
||||
c = self.compute
|
||||
self.flags(block_device_allocate_retries=0)
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The ``[DEFAULT]/block_device_allocate_retries`` configuration option now
|
||||
has a minimum required value of 0. Any previous configuration with a value
|
||||
less than zero will now result in an error.
|
Loading…
Reference in New Issue
Block a user