Skip to content

Commit e25d590

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add minimum value in max_concurrent_live_migrations"
2 parents 5868303 + 37c42c9 commit e25d590

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

nova/compute/manager.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,11 @@ def __init__(self, compute_driver=None, *args, **kwargs):
518518
CONF.max_concurrent_builds)
519519
else:
520520
self._build_semaphore = compute_utils.UnlimitedSemaphore()
521-
if max(CONF.max_concurrent_live_migrations, 0) != 0:
521+
if CONF.max_concurrent_live_migrations > 0:
522522
self._live_migration_executor = futurist.GreenThreadPoolExecutor(
523523
max_workers=CONF.max_concurrent_live_migrations)
524524
else:
525-
if CONF.max_concurrent_live_migrations < 0:
526-
LOG.warning('The value of the max_concurrent_live_migrations '
527-
'config option is less than 0. '
528-
'It is treated as 0 and will raise ValueError '
529-
'in a future release.')
525+
# CONF.max_concurrent_live_migrations is 0 (unlimited)
530526
self._live_migration_executor = futurist.GreenThreadPoolExecutor()
531527
# This is a dict, keyed by instance uuid, to a two-item tuple of
532528
# migration object and Future for the queued live migration.

nova/conf/compute.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,9 @@
621621
* 0 : treated as unlimited.
622622
* Any positive integer representing maximum concurrent builds.
623623
"""),
624-
# TODO(sfinucan): Add min parameter
625624
cfg.IntOpt('max_concurrent_live_migrations',
626625
default=1,
626+
min=0,
627627
help="""
628628
Maximum number of live migrations to run concurrently. This limit is enforced
629629
to avoid outbound live migrations overwhelming the host/network and causing
@@ -633,7 +633,6 @@
633633
Possible values:
634634
635635
* 0 : treated as unlimited.
636-
* Negative value defaults to 0.
637636
* Any positive integer representing maximum number of live migrations
638637
to run concurrently.
639638
"""),

nova/tests/unit/compute/test_compute_mgr.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7437,22 +7437,11 @@ def test_max_concurrent_live_semaphore_limited(self, mock_executor):
74377437
manager.ComputeManager()
74387438
mock_executor.assert_called_once_with(max_workers=123)
74397439

7440-
@ddt.data(0, -2)
7441-
def test_max_concurrent_live_semaphore_unlimited(self, max_concurrent):
7442-
self.flags(max_concurrent_live_migrations=max_concurrent)
7443-
with test.nested(
7444-
mock.patch('futurist.GreenThreadPoolExecutor'),
7445-
mock.patch('nova.compute.manager.LOG'),
7446-
) as (mock_executor, mock_log):
7447-
manager.ComputeManager()
7440+
@mock.patch('futurist.GreenThreadPoolExecutor')
7441+
def test_max_concurrent_live_semaphore_unlimited(self, mock_executor):
7442+
self.flags(max_concurrent_live_migrations=0)
7443+
manager.ComputeManager()
74487444
mock_executor.assert_called_once_with()
7449-
if max_concurrent < 0:
7450-
mock_log.warning.assert_called_once_with(
7451-
'The value of the max_concurrent_live_migrations config '
7452-
'option is less than 0. It is treated as 0 and will raise '
7453-
'ValueError in a future release.')
7454-
else:
7455-
mock_log.warning.assert_not_called()
74567445

74577446
def test_pre_live_migration_cinder_v3_api(self):
74587447
# This tests that pre_live_migration with a bdm with an
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
upgrade:
3+
- The ``max_concurrent_live_migrations`` configuration option has been
4+
restricted by the minimum value and now raises a ValueError
5+
if the value is less than 0.

0 commit comments

Comments
 (0)