Merge "compute: Stop silently ignore --(no-)disk-overcommit"
This commit is contained in:
commit
8e94044710
@ -2519,7 +2519,10 @@ revert to release the new server and restart the old one.""")
|
||||
'--disk-overcommit',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Allow disk over-commit on the destination host'),
|
||||
help=_(
|
||||
'Allow disk over-commit on the destination host'
|
||||
'(supported with --os-compute-api-version 2.24 or below)'
|
||||
),
|
||||
)
|
||||
disk_group.add_argument(
|
||||
'--no-disk-overcommit',
|
||||
@ -2528,6 +2531,7 @@ revert to release the new server and restart the old one.""")
|
||||
default=False,
|
||||
help=_(
|
||||
'Do not over-commit disk on the destination host (default)'
|
||||
'(supported with --os-compute-api-version 2.24 or below)'
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
@ -2603,6 +2607,15 @@ revert to release the new server and restart the old one.""")
|
||||
|
||||
if compute_client.api_version < api_versions.APIVersion('2.25'):
|
||||
kwargs['disk_over_commit'] = parsed_args.disk_overcommit
|
||||
elif parsed_args.disk_overcommit is not None:
|
||||
# TODO(stephenfin): Raise an error here in OSC 7.0
|
||||
msg = _(
|
||||
'The --disk-overcommit and --no-disk-overcommit '
|
||||
'options are only supported by '
|
||||
'--os-compute-api-version 2.24 or below; this will '
|
||||
'be an error in a future release'
|
||||
)
|
||||
self.log.warning(msg)
|
||||
|
||||
server.live_migrate(**kwargs)
|
||||
else:
|
||||
|
@ -4832,6 +4832,40 @@ class TestServerMigrate(TestServer):
|
||||
self.assertNotCalled(self.servers_mock.migrate)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_server_live_migrate_with_disk_overcommit_post_v224(self):
|
||||
arglist = [
|
||||
'--live-migration',
|
||||
'--disk-overcommit',
|
||||
self.server.id,
|
||||
]
|
||||
verifylist = [
|
||||
('live', None),
|
||||
('live_migration', True),
|
||||
('block_migration', None),
|
||||
('disk_overcommit', True),
|
||||
('wait', False),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.app.client_manager.compute.api_version = \
|
||||
api_versions.APIVersion('2.25')
|
||||
|
||||
with mock.patch.object(self.cmd.log, 'warning') as mock_warning:
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.servers_mock.get.assert_called_with(self.server.id)
|
||||
# There should be no 'disk_over_commit' value present
|
||||
self.server.live_migrate.assert_called_with(
|
||||
block_migration='auto',
|
||||
host=None)
|
||||
self.assertNotCalled(self.servers_mock.migrate)
|
||||
self.assertIsNone(result)
|
||||
# A warning should have been logged for using --disk-overcommit.
|
||||
mock_warning.assert_called_once()
|
||||
self.assertIn(
|
||||
'The --disk-overcommit and --no-disk-overcommit options ',
|
||||
str(mock_warning.call_args[0][0]))
|
||||
|
||||
def test_server_live_migrate_with_false_value_options(self):
|
||||
arglist = [
|
||||
'--live', 'fakehost', '--no-disk-overcommit',
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
A warning will now be emitted when using the ``--disk-overcommit``
|
||||
or ``--no-disk-overcommit`` flags of the ``server migrate`` command on
|
||||
Compute API microversion 2.25 or greater. This feature is only supported
|
||||
before this microversion and previously the flag was silently ignored on
|
||||
newer microversions. This warning will become an error in a future
|
||||
release.
|
Loading…
Reference in New Issue
Block a user