compute: Stop silently ignore --(no-)disk-overcommit
These options are not supported from Nova API microversion 2.25 and above. This can be a source of confusion. Start warning, with an eye on erroring out in the future. Change-Id: I53f27eb3e3c1a84d0d77a1672c008d0e8bb8536f Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
2bdf34dcc3
commit
8868c77a20
@ -2519,7 +2519,10 @@ revert to release the new server and restart the old one.""")
|
|||||||
'--disk-overcommit',
|
'--disk-overcommit',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
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(
|
disk_group.add_argument(
|
||||||
'--no-disk-overcommit',
|
'--no-disk-overcommit',
|
||||||
@ -2528,6 +2531,7 @@ revert to release the new server and restart the old one.""")
|
|||||||
default=False,
|
default=False,
|
||||||
help=_(
|
help=_(
|
||||||
'Do not over-commit disk on the destination host (default)'
|
'Do not over-commit disk on the destination host (default)'
|
||||||
|
'(supported with --os-compute-api-version 2.24 or below)'
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
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'):
|
if compute_client.api_version < api_versions.APIVersion('2.25'):
|
||||||
kwargs['disk_over_commit'] = parsed_args.disk_overcommit
|
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)
|
server.live_migrate(**kwargs)
|
||||||
else:
|
else:
|
||||||
|
@ -4832,6 +4832,40 @@ class TestServerMigrate(TestServer):
|
|||||||
self.assertNotCalled(self.servers_mock.migrate)
|
self.assertNotCalled(self.servers_mock.migrate)
|
||||||
self.assertIsNone(result)
|
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):
|
def test_server_live_migrate_with_false_value_options(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--live', 'fakehost', '--no-disk-overcommit',
|
'--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…
x
Reference in New Issue
Block a user