compute: Deprecate 'server create --file'

The parameter isn't actually deprecated, since we need to support older
API microversion, however, we now emit an error if someone attempts to
boot a server with the wrong microversion. This would happen server-side
anyway since this parameter was removed entirely in API microversion
2.57.

Change-Id: I73864ccbf5bf181fecf505ca168c1a35a8b0af3a
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2021-01-21 12:06:57 +00:00
parent 8868c77a20
commit 6f3969a0c8
2 changed files with 18 additions and 1 deletions

View File

@ -989,8 +989,9 @@ class CreateServer(command.ShowOne):
action='append',
default=[],
help=_(
'File to inject into image before boot '
'File(s) to inject into image before boot '
'(repeat option to set multiple files)'
'(supported by --os-compute-api-version 2.57 or below)'
),
)
parser.add_argument(
@ -1201,6 +1202,15 @@ class CreateServer(command.ShowOne):
flavor = utils.find_resource(
compute_client.flavors, parsed_args.flavor)
if parsed_args.file:
if compute_client.api_version >= api_versions.APIVersion('2.57'):
msg = _(
'Personality files are deprecated and are not supported '
'for --os-compute-api-version greater than 2.56; use '
'user data instead'
)
raise exceptions.CommandError(msg)
files = {}
for f in parsed_args.file:
dst, src = f.split('=', 1)

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The ``server create`` command will now error out if the ``--file`` option
is specified alongside ``--os-compute-api-version`` of ``2.57`` or greater.
This reflects the removal of this feature from the compute service in this
microversion.